Skip to content

Commit e3d92c8

Browse files
committed
ftp_login: Add check() support
1 parent 66dc50c commit e3d92c8

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
@@ -66,6 +66,22 @@ def initialize(info = {})
6666
deregister_options('FTPUSER', 'FTPPASS') # Can use these, but should use 'username' and 'password'
6767
end
6868

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

0 commit comments

Comments
 (0)