From 94aac0c51754672e8ce2fbca56bebc242964e25d Mon Sep 17 00:00:00 2001 From: James Lee Date: Mon, 30 Aug 2010 22:17:26 +0000 Subject: [PATCH] dunno why i never thought of this before. clean up spawned exploits when stopping browser_autopwn git-svn-id: file:///home/svn/framework3/trunk@10197 4d416f70-5f16-0410-b530-b9f4589650da --- modules/auxiliary/server/browser_autopwn.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/auxiliary/server/browser_autopwn.rb b/modules/auxiliary/server/browser_autopwn.rb index dfe5b5c0fc..ec148f8ce7 100644 --- a/modules/auxiliary/server/browser_autopwn.rb +++ b/modules/auxiliary/server/browser_autopwn.rb @@ -408,6 +408,7 @@ class Metasploit3 < Msf::Auxiliary end end end + @handler_job_ids = [] # start handlers for each type of payload [@win_lport, @lin_lport, @osx_lport, @gen_lport, @java_lport].each do |lport| if (lport and @payloads[lport]) @@ -428,6 +429,7 @@ class Metasploit3 < Msf::Auxiliary 'LocalOutput' => self.user_output, 'Payload' => @payloads[lport], 'RunAsJob' => true) + @handler_job_ids.push(multihandler.job_id) end end # let the handlers get set up @@ -839,5 +841,16 @@ class Metasploit3 < Msf::Auxiliary return "" end + def cleanup + print_status("Cleaning up exploits...") + @exploits.each_pair do |name, mod| + framework.jobs[mod.job_id.to_s].stop if framework.jobs[mod.job_id.to_s] + end + @handler_job_ids.each do |id| + framework.jobs[id.to_s].stop if framework.jobs[id.to_s] + end + super + end + end