@@ -72,7 +72,7 @@ def run_host(ip)
72
72
print_brute ( :level => :vstatus , :ip => ip , :msg => "Starting SMB login bruteforce" )
73
73
74
74
domain = datastore [ 'SMBDomain' ] || ""
75
-
75
+
76
76
if accepts_bogus_logins? ( domain )
77
77
print_error ( "#{ smbhost } - This system accepts authentication with any credentials, brute force is ineffective." )
78
78
return
@@ -111,9 +111,8 @@ def check_login_status(domain, user, pass)
111
111
datastore [ 'SMB::Native_OS' ] ,
112
112
datastore [ 'SMB::Native_LM' ] ,
113
113
{ :use_spn => datastore [ 'NTLM::SendSPN' ] , :name => self . rhost } )
114
-
115
114
# Windows SMB will return an error code during Session Setup, but nix Samba requires a Tree Connect:
116
- simple . connect ( "\\ \\ #{ datastore [ 'RHOST' ] } \\ IPC$" )
115
+ simple . connect ( "\\ \\ #{ datastore [ 'RHOST' ] } \\ IPC$" )
117
116
status_code = 'STATUS_SUCCESS'
118
117
rescue ::Rex ::Proto ::SMB ::Exceptions ::ErrorCode => e
119
118
status_code = e . get_error ( e . error_code )
@@ -127,14 +126,14 @@ def check_login_status(domain, user, pass)
127
126
end
128
127
129
128
# If login is succesful and auth_user is unset
130
- # the login was as a guest user.
129
+ # the login was as a guest user.
131
130
def accepts_guest_logins? ( domain )
132
131
guest = false
133
132
user = Rex ::Text . rand_text_alpha ( 8 )
134
133
pass = Rex ::Text . rand_text_alpha ( 8 )
135
134
136
135
guest_login = ( ( check_login_status ( domain , user , pass ) == 'STATUS_SUCCESS' ) && simple . client . auth_user . nil? )
137
-
136
+
138
137
if guest_login
139
138
@accepts_guest_logins [ 'rhost' ] ||=[ ] unless @accepts_guest_logins . include? ( rhost )
140
139
report_note (
@@ -152,7 +151,7 @@ def accepts_guest_logins?(domain)
152
151
end
153
152
154
153
# If login is successul and auth_user is set
155
- # then bogus creds are accepted.
154
+ # then bogus creds are accepted.
156
155
def accepts_bogus_logins? ( domain )
157
156
user = Rex ::Text . rand_text_alpha ( 8 )
158
157
pass = Rex ::Text . rand_text_alpha ( 8 )
@@ -205,8 +204,8 @@ def try_user_pass(domain, user, pass)
205
204
report_creds ( domain , user , pass , true )
206
205
elsif datastore [ 'VERBOSE' ]
207
206
print_status ( output_message % "GUEST LOGIN" )
208
- end
209
- end
207
+ end
208
+ end
210
209
when *@correct_credentials_status_codes
211
210
print_status ( output_message % "FAILED LOGIN, VALID CREDENTIALS" )
212
211
report_creds ( domain , user , pass , false )
0 commit comments