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 @@ -44,44 +44,15 @@ def initialize(info = {})
4444 ] )
4545 end
4646
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-
5147 def check
5248 # attempt to connect
5349 begin
54- if !connect_login
55- print_error ( 'Connection refused' )
56- return Exploit ::CheckCode ::Unknown ( 'Failed to connect or authenticate via FTP' )
57- end
58-
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
50+ return Exploit ::CheckCode ::Unknown ( 'Failed to connect or authenticate via FTP' ) unless connect_login
8051 rescue Rex ::ConnectionRefused
81- print_error ( 'Connection refused' )
52+ report_host ( host : rhost )
8253 return Exploit ::CheckCode ::Unknown ( 'Connection refused by the target' )
8354 rescue Rex ::ConnectionTimeout
84- print_error ( 'Connection timed out' )
55+ report_host ( host : rhost )
8556 return Exploit ::CheckCode ::Unknown ( 'Connection timed out' )
8657 end
8758
@@ -129,7 +100,6 @@ def run
129100
130101 attempts = 0
131102 max = datastore [ 'MAX_ATTEMPTS' ] . to_i
132-
133103 loop do
134104 attempts += 1
135105 if max > 0 && attempts > max
You can’t perform that action at this time.
0 commit comments