Adding respond code/body check for successful command execution

master
rsp3ar 2019-01-10 00:01:19 -08:00
parent 3aabeee959
commit 71aa4c8d9e
1 changed files with 8 additions and 2 deletions

View File

@ -98,8 +98,14 @@ class MetasploitModule < Msf::Exploit::Remote
rescue Rex::ConnectionError, Errno::ENOTCONN => e
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
end
if res && res.code == 401
fail_with(Failure::NoAccess, 'Authorization Failure, valid agent registration credential is required')
if res
if res.code == 401
fail_with(Failure::NoAccess, 'Authorization Failure, valid agent registration credential is required')
end
unless res.code == 406 and res.body.include?("impctl")
fail_with(Failure::Unknown, 'Server did not respond in an expected way')
end
end
res
end