File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
modules/auxiliary/scanner/http Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,9 @@ def request_raw(opts={})
209
209
req << set_agent_header ( c_ag )
210
210
211
211
if ( c_auth . length > 0 )
212
- req << set_basic_auth_header ( c_auth )
212
+ unless c_head [ 'Authorization' ] and c_head [ 'Authorization' ] . include? "Basic"
213
+ req << set_basic_auth_header ( c_auth )
214
+ end
213
215
end
214
216
215
217
req << set_cookie_header ( c_cook )
@@ -239,6 +241,7 @@ def request_raw(opts={})
239
241
# @return [Request]
240
242
def request_cgi ( opts = { } )
241
243
c_ag = opts [ 'agent' ] || config [ 'agent' ]
244
+ c_auth = opts [ 'basic_auth' ] || config [ 'basic_auth' ] || ''
242
245
c_body = opts [ 'data' ] || ''
243
246
c_cgi = opts [ 'uri' ] || '/'
244
247
c_conn = opts [ 'connection' ]
@@ -313,6 +316,12 @@ def request_cgi(opts={})
313
316
req << set_host_header ( c_host )
314
317
req << set_agent_header ( c_ag )
315
318
319
+ if ( c_auth . length > 0 )
320
+ unless c_head [ 'Authorization' ] and c_head [ 'Authorization' ] . include? "Basic"
321
+ req << set_basic_auth_header ( c_auth )
322
+ end
323
+ end
324
+
316
325
req << set_cookie_header ( c_cook )
317
326
req << set_connection_header ( c_conn )
318
327
req << set_extra_headers ( c_head )
Original file line number Diff line number Diff line change @@ -87,10 +87,6 @@ def run_host(ip)
87
87
vprint_error ( "http://#{ rhost } :#{ rport } #{ uri } - No response" )
88
88
return
89
89
end
90
- if res . code != 401
91
- vprint_error ( "http://#{ rhost } :#{ rport } - Authorization not requested" )
92
- return
93
- end
94
90
95
91
each_user_pass { |user , pass |
96
92
do_login ( user , pass )
@@ -107,10 +103,8 @@ def do_login(user='tomcat', pass='tomcat')
107
103
res = send_request_cgi ( {
108
104
'uri' => uri ,
109
105
'method' => 'GET' ,
110
- 'headers' =>
111
- {
112
- 'Authorization' => "Basic #{ user_pass } " ,
113
- }
106
+ 'username' => user ,
107
+ 'password' => pass
114
108
} , 25 )
115
109
unless ( res . kind_of? Rex ::Proto ::Http ::Response )
116
110
vprint_error ( "http://#{ rhost } :#{ rport } #{ uri } not responding" )
You can’t perform that action at this time.
0 commit comments