Skip to content

Commit daddc6e

Browse files
authored
Update lib/metasploit/framework/login_scanner/opnsense.rb
1 parent 9808172 commit daddc6e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/metasploit/framework/login_scanner/opnsense.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)