File tree Expand file tree Collapse file tree
modules/auxiliary/dos/ftp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66class 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' )
You can’t perform that action at this time.
0 commit comments