Skip to content

Commit 40ba707

Browse files
committed
vsftpd_232: Add report_service & report_note
1 parent 7e704ce commit 40ba707

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

modules/auxiliary/dos/ftp/vsftpd_232.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class MetasploitModule < Msf::Auxiliary
77
include Msf::Exploit::Remote::Ftp
88
include Msf::Auxiliary::Dos
9+
include Msf::Auxiliary::Report
910

1011
def initialize(info = {})
1112
super(
@@ -43,6 +44,10 @@ def initialize(info = {})
4344
])
4445
end
4546

47+
def sanitize_ftp_response(str)
48+
Rex::Text.to_hex_ascii(str.to_s.gsub(/^\d{3}[\s-]/, '').strip.gsub(/\A\(|\)\z/, ''))
49+
end
50+
4651
def check
4752
# attempt to connect
4853
begin
@@ -51,6 +56,27 @@ def check
5156
return Exploit::CheckCode::Unknown('Failed to connect or authenticate via FTP')
5257
end
5358

59+
if banner
60+
vprint_status("FTP banner: #{sanitize_ftp_response(banner)}")
61+
62+
# Cleaned up FTP banner
63+
report_service(
64+
host: rhost,
65+
port: rport,
66+
proto: 'tcp',
67+
name: 'ftp',
68+
info: sanitize_ftp_response(banner)
69+
)
70+
71+
# Raw FTP banner
72+
report_note(
73+
host: rhost,
74+
port: rport,
75+
proto: 'tcp',
76+
type: 'ftp.banner',
77+
data: { banner: banner.strip }
78+
)
79+
end
5480
rescue Rex::ConnectionRefused
5581
print_error('Connection refused')
5682
return Exploit::CheckCode::Unknown('Connection refused by the target')

0 commit comments

Comments
 (0)