File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
lib/metasploit/framework/login_scanner Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,14 @@ def query_magic_value_and_cookies
5757 return { status : :failure , error : 'Received an empty body from GET request' }
5858 end
5959
60- # The magic name and value are hidden on the login form, so we extract them using Nokogiri.
61- form_inputs = :: Nokogiri :: HTML ( res . body ) . search ( 'input' )
62- magic_field = form_inputs . find { | field | field [ 'type' ] == 'hidden' }
63- if magic_field . nil?
60+ # The magic name and value are hidden on the login form, so we extract them using get_html_document
61+ form_input = res . get_html_document &. at ( 'input' )
62+
63+ if form_input . nil? || form_input [ 'type' ] != 'hidden'
6464 return { status : :failure , error : 'Could not find hidden magic field in the login form.' }
6565 end
6666
67- magic_value = { name : magic_field [ 'name' ] , value : magic_field [ 'value' ] }
67+ magic_value = { name : form_input [ 'name' ] , value : form_input [ 'value' ] }
6868 cookies = "PHPSESSID=#{ get_cookie_value ( res , 'PHPSESSID' ) } ; cookie_test=#{ get_cookie_value ( res , 'cookie_test' ) } "
6969 { status : :success , result : { magic_value : magic_value , cookies : cookies } }
7070 end
You can’t perform that action at this time.
0 commit comments