Skip to content

Commit 116233e

Browse files
committed
ftp_version: Add report_host
1 parent 00e9793 commit 116233e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

modules/auxiliary/scanner/ftp/ftp_version.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def sanitize_ftp_response(str)
3737
Rex::Text.to_hex_ascii(str.to_s.gsub(/^\d{3}[\s-]/, '').strip.gsub(/\A\(|\)\z/, ''))
3838
end
3939

40-
def run_host(_target_host)
40+
def run_host(target_host)
4141
connect(true, false)
4242

4343
if banner
@@ -56,12 +56,15 @@ def run_host(_target_host)
5656
type: 'ftp.banner',
5757
data: { banner: banner.strip }
5858
)
59+
else
60+
vprint_error('No FTP banner received')
5961
end
6062

6163
disconnect
6264
rescue ::Interrupt
6365
raise $ERROR_INFO
64-
rescue ::Rex::ConnectionError, ::IOError => e
66+
rescue EOFError, ::Rex::ConnectionRefused, ::Errno::ECONNREFUSED => e
6567
vprint_error(e.message)
68+
report_host(host: target_host)
6669
end
6770
end

0 commit comments

Comments
 (0)