Do a fail_with in case nonce is not found at all

bug/bundler_fix
wchen-r7 2016-06-30 11:21:45 -05:00
parent e2b9225907
commit 1ecef265a1
1 changed files with 8 additions and 2 deletions

View File

@ -106,12 +106,18 @@ class MetasploitModule < Msf::Exploit::Remote
)
unless res && res.code == 200
fail_with Failure::UnexpectedReply, "Unable to access FORM_PATH: #{datastore['FORM_PATH']}"
fail_with(Failure::UnexpectedReply, "Unable to access FORM_PATH: #{datastore['FORM_PATH']}")
end
form_wpnonce = res.get_hidden_inputs.first['_wpnonce']
res.body[/var nfFrontEnd = \{"ajaxNonce":"([a-zA-Z0-9]+)"/i, 1] || form_wpnonce
nonce = res.body[/var nfFrontEnd = \{"ajaxNonce":"([a-zA-Z0-9]+)"/i, 1] || form_wpnonce
unless nonce
fail_with(Failure::Unknown, 'Cannot find wpnonce or ajaxNonce from FORM_PATH')
end
nonce
end
def upload_payload(data)