Properly handle a no-payload-selected scenario

unstable
sinn3r 2012-07-06 16:32:18 -05:00
parent 08c6b94460
commit 3f58aff979
1 changed files with 7 additions and 2 deletions

View File

@ -94,7 +94,7 @@ def select_payload(exploit)
else
# WTF? This exploit supports NONE of our favorite payloads?
# What kinda BS is this?
return payload
return nil
end
end
@ -128,7 +128,12 @@ def auto_exploit(module_path)
get_payload = select_payload(exploit)
lhost = Rex::Socket.source_address('50.50.50.50')
print_status("Payload selected: #{get_payload} (lhost=#{lhost})")
if get_payload.nil?
raise RuntimeError, "No payload selected for this exploit"
else
print_status("Payload selected: #{get_payload} (lhost=#{lhost})")
end
framework.db.workspace.vulns.each do |vuln|
next if not ref_has_match(vuln.refs, exploit_refs)