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={})
209209 req << set_agent_header ( c_ag )
210210
211211 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
213215 end
214216
215217 req << set_cookie_header ( c_cook )
@@ -239,6 +241,7 @@ def request_raw(opts={})
239241 # @return [Request]
240242 def request_cgi ( opts = { } )
241243 c_ag = opts [ 'agent' ] || config [ 'agent' ]
244+ c_auth = opts [ 'basic_auth' ] || config [ 'basic_auth' ] || ''
242245 c_body = opts [ 'data' ] || ''
243246 c_cgi = opts [ 'uri' ] || '/'
244247 c_conn = opts [ 'connection' ]
@@ -313,6 +316,12 @@ def request_cgi(opts={})
313316 req << set_host_header ( c_host )
314317 req << set_agent_header ( c_ag )
315318
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+
316325 req << set_cookie_header ( c_cook )
317326 req << set_connection_header ( c_conn )
318327 req << set_extra_headers ( c_head )
Original file line number Diff line number Diff line change @@ -87,10 +87,6 @@ def run_host(ip)
8787 vprint_error ( "http://#{ rhost } :#{ rport } #{ uri } - No response" )
8888 return
8989 end
90- if res . code != 401
91- vprint_error ( "http://#{ rhost } :#{ rport } - Authorization not requested" )
92- return
93- end
9490
9591 each_user_pass { |user , pass |
9692 do_login ( user , pass )
@@ -107,10 +103,8 @@ def do_login(user='tomcat', pass='tomcat')
107103 res = send_request_cgi ( {
108104 'uri' => uri ,
109105 'method' => 'GET' ,
110- 'headers' =>
111- {
112- 'Authorization' => "Basic #{ user_pass } " ,
113- }
106+ 'username' => user ,
107+ 'password' => pass
114108 } , 25 )
115109 unless ( res . kind_of? Rex ::Proto ::Http ::Response )
116110 vprint_error ( "http://#{ rhost } :#{ rport } #{ uri } not responding" )
You can’t perform that action at this time.
0 commit comments