Move print of my_target.name to after nil check

Avoids
  "Exception handling request: undefined method `name' for nil:NilClass"
when we don't have a target for the connecting browser.

[FixRM #7593]
unstable
James Lee 2012-12-07 10:57:20 -06:00
parent c66777d028
commit 8812285678
1 changed files with 3 additions and 2 deletions

View File

@ -159,8 +159,6 @@ class Metasploit3 < Msf::Exploit::Remote
def on_request_uri(cli, request)
agent = request.headers['User-Agent']
my_target = get_target(agent)
print_status("Target selected: #{my_target.name}")
print_status("Client requesting: #{request.uri}")
# Avoid the attack if the victim doesn't have the same setup we're targeting
if my_target.nil?
@ -169,6 +167,9 @@ class Metasploit3 < Msf::Exploit::Remote
return
end
print_status("Target selected: #{my_target.name}")
print_status("Client requesting: #{request.uri}")
# The SWF request itself
if request.uri =~ /\.swf$/
print_status("Sending SWF")