Improve fail_with granularity for 400 error

Also corrects BadConfig to NoTarget in another one of my modules. Oops.
bug/bundler_fix
William Vu 2017-05-15 20:47:22 -05:00
parent 1a644cadc4
commit b41427412b
2 changed files with 7 additions and 3 deletions

View File

@ -89,7 +89,7 @@ class MetasploitModule < Msf::Exploit
target[:template]
))
rescue Errno::ENOENT
fail_with(Failure::BadConfig, "Target has no #{t} support")
fail_with(Failure::NoTarget, "Target has no #{t} support")
end
end

View File

@ -137,9 +137,13 @@ class MetasploitModule < Msf::Exploit::Remote
)
if res.nil?
fail_with(Failure::UnexpectedReply, 'Server returned nil response')
fail_with(Failure::NotFound, 'Server returned nil response')
elsif res && !res.redirect?
fail_with(Failure::UnexpectedReply, "Server returned code #{res.code}")
if res.code == 400 && res.headers['Server'].start_with?('Apache')
fail_with(Failure::NotVulnerable, 'HttpProtocolOptions may be Strict')
else
fail_with(Failure::UnexpectedReply, "Server returned code #{res.code}")
end
end
res