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/gather/enum_applications.rb
Views: 11655
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::Windows::Registry78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Windows Gather Installed Application Enumeration',13'Description' => %q{ This module will enumerate all installed applications on a Windows system },14'License' => MSF_LICENSE,15'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],16'Platform' => [ 'win' ],17'SessionTypes' => [ 'meterpreter' ]18)19)20end2122def app_list23tbl = Rex::Text::Table.new(24'Header' => 'Installed Applications',25'Indent' => 1,26'Columns' =>27[28'Name',29'Version'30]31)32appkeys = [33'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',34'HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',35'HKLM\\SOFTWARE\\WOW6432NODE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',36'HKCU\\SOFTWARE\\WOW6432NODE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',37]38apps = []39appkeys.each do |keyx86|40found_keys = registry_enumkeys(keyx86)41next unless found_keys4243found_keys.each do |ak|44apps << keyx86 + '\\' + ak45end46end4748t = []49until apps.empty?50511.upto(16) do52t << framework.threads.spawn("Module(#{refname})", false, apps.shift) do |k|53dispnm = registry_getvaldata(k.to_s, 'DisplayName')54dispversion = registry_getvaldata(k.to_s, 'DisplayVersion')55tbl << [dispnm, dispversion] if dispnm && dispversion56rescue StandardError57end58end59t.map(&:join)60end6162results = tbl.to_s6364print_line("\n" + results + "\n")6566p = store_loot('host.applications', 'text/plain', session, results, 'applications.txt', 'Installed Applications')67print_good("Results stored in: #{p}")68end6970def run71print_status("Enumerating applications installed on #{sysinfo['Computer']}")72app_list73end74end757677