no threading

bug/bundler_fix
sinn3r 2014-09-03 11:37:30 -05:00
parent f7091d854e
commit 5acbcc80e2
2 changed files with 26 additions and 22 deletions

View File

@ -60,6 +60,8 @@ class Metasploit4 < Msf::Auxiliary
# the connection alive so that the video can keep playing.
#
def send_image_request(opts)
http = nil
begin
http = Rex::Proto::Http::Client.new(
rhost,
@ -85,6 +87,8 @@ class Metasploit4 < Msf::Auxiliary
ensure
cleanup
end
http
end
@ -102,16 +106,14 @@ class Metasploit4 < Msf::Auxiliary
'data' => image
}
# The connection has to stay alive but we don't have to stare at the screen and
# wait for it to finish.
begin
Timeout.timeout(datastore['TIME']) do
framework.threads.spawn("AppleTvImageRequest", false) {
send_image_request(opts)
}
end
rescue ::Timeout::Error
return
res = send_image_request(opts)
if !res
print_status("The connection timed out")
elsif res.code == 200
print_status("Received HTTP 200")
else
print_error("The request failed due to an unknown reason")
end
end
@ -120,4 +122,4 @@ class Metasploit4 < Msf::Auxiliary
print_status("Image request sent. Duration set: #{datastore['TIME']} seconds")
show_image
end
end
end

View File

@ -63,6 +63,8 @@ class Metasploit4 < Msf::Auxiliary
# the connection alive so that the video can keep playing.
#
def send_video_request(opts)
http = nil
begin
http = Rex::Proto::Http::Client.new(
rhost,
@ -87,6 +89,8 @@ class Metasploit4 < Msf::Auxiliary
ensure
cleanup
end
http
end
@ -121,16 +125,14 @@ class Metasploit4 < Msf::Auxiliary
'data' => body
}
# The connection has to stay alive but we don't have to stare at the screen and
# wait for it to finish.
begin
Timeout.timeout(datastore['TIME']) do
framework.threads.spawn("AppleTvVideoRequest", false) {
send_video_request(opts)
}
end
rescue ::Timeout::Error
return
res = send_video_request(opts)
if !res
print_status("The connection timed out")
elsif res.code == 200
print_status("Received HTTP 200")
else
print_error("The request failed due to an unknown reason")
end
end
@ -153,4 +155,4 @@ class Metasploit4 < Msf::Auxiliary
play_video_uri
end
end
end