Skip to content

Commit 0f0e81a

Browse files
committed
ftp_login: Add check() support
1 parent 27fcc6a commit 0f0e81a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

modules/auxiliary/scanner/ftp/ftp_login.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ def initialize(info = {})
6060
deregister_options('FTPUSER', 'FTPPASS') # Can use these, but should use 'username' and 'password'
6161
end
6262

63+
def check_host(ip)
64+
connect
65+
if banner&.match?(/^(120|220)[\s-]/)
66+
report_ftp_service_and_banner(ip)
67+
Exploit::CheckCode::Appears("FTP service detected: #{banner_version}")
68+
else
69+
Exploit::CheckCode::Unknown('No valid FTP banner received')
70+
end
71+
rescue Rex::ConnectionError, Errno::ECONNRESET
72+
Exploit::CheckCode::Unknown('Port closed or connection refused')
73+
rescue Rex::ConnectionTimeout, ::Timeout::Error, ::EOFError => e
74+
Exploit::CheckCode::Unknown(e.message)
75+
ensure
76+
disconnect
77+
end
78+
6379
def run_scanner(ip, scanner)
6480
scanner.scan! do |result|
6581
unless @reported_banner

0 commit comments

Comments
 (0)