2011-01-12 18:11:24 +00:00
|
|
|
##
|
2017-07-24 06:26:21 -07:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 13:50:46 -05:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2011-01-12 18:11:24 +00:00
|
|
|
##
|
2011-01-12 03:55:19 +00:00
|
|
|
|
2016-03-08 14:02:44 +01:00
|
|
|
class MetasploitModule < Msf::Post
|
2011-06-21 00:38:04 +00:00
|
|
|
include Msf::Post::Windows::Registry
|
2011-01-12 03:55:19 +00:00
|
|
|
|
2023-02-08 13:47:34 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
|
super(
|
|
|
|
|
update_info(
|
|
|
|
|
info,
|
|
|
|
|
'Name' => 'Windows Gather Installed Application Enumeration',
|
|
|
|
|
'Description' => %q{ This module will enumerate all installed applications on a Windows system },
|
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
|
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
|
|
|
|
'Platform' => [ 'win' ],
|
|
|
|
|
'SessionTypes' => [ 'meterpreter' ]
|
|
|
|
|
)
|
|
|
|
|
)
|
2011-01-12 03:55:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def app_list
|
2016-08-10 13:30:09 -05:00
|
|
|
tbl = Rex::Text::Table.new(
|
2023-02-08 13:47:34 +00:00
|
|
|
'Header' => 'Installed Applications',
|
|
|
|
|
'Indent' => 1,
|
2011-01-12 03:55:19 +00:00
|
|
|
'Columns' =>
|
2011-01-12 17:36:58 +00:00
|
|
|
[
|
2023-02-08 13:47:34 +00:00
|
|
|
'Name',
|
|
|
|
|
'Version'
|
|
|
|
|
]
|
|
|
|
|
)
|
2011-03-18 21:46:01 +00:00
|
|
|
appkeys = [
|
|
|
|
|
'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
|
|
|
|
'HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
|
|
|
|
'HKLM\\SOFTWARE\\WOW6432NODE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
|
|
|
|
'HKCU\\SOFTWARE\\WOW6432NODE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
2023-02-08 13:47:34 +00:00
|
|
|
]
|
2011-01-12 23:24:17 +00:00
|
|
|
apps = []
|
2011-01-12 03:55:19 +00:00
|
|
|
appkeys.each do |keyx86|
|
2011-07-12 21:05:44 +00:00
|
|
|
found_keys = registry_enumkeys(keyx86)
|
2023-02-08 13:47:34 +00:00
|
|
|
next unless found_keys
|
|
|
|
|
|
|
|
|
|
found_keys.each do |ak|
|
|
|
|
|
apps << keyx86 + '\\' + ak
|
2011-01-12 03:55:19 +00:00
|
|
|
end
|
2011-01-12 23:24:17 +00:00
|
|
|
end
|
2011-01-12 03:55:19 +00:00
|
|
|
|
2011-01-12 23:24:17 +00:00
|
|
|
t = []
|
2023-02-08 13:47:34 +00:00
|
|
|
until apps.empty?
|
2011-11-06 22:02:26 +00:00
|
|
|
|
2011-01-12 23:24:17 +00:00
|
|
|
1.upto(16) do
|
2023-02-08 13:47:34 +00:00
|
|
|
t << framework.threads.spawn("Module(#{refname})", false, apps.shift) do |k|
|
|
|
|
|
dispnm = registry_getvaldata(k.to_s, 'DisplayName')
|
|
|
|
|
dispversion = registry_getvaldata(k.to_s, 'DisplayVersion')
|
|
|
|
|
tbl << [dispnm, dispversion] if dispnm && dispversion
|
|
|
|
|
rescue StandardError
|
2011-01-12 23:24:17 +00:00
|
|
|
end
|
|
|
|
|
end
|
2023-02-08 13:47:34 +00:00
|
|
|
t.map(&:join)
|
2011-01-12 03:55:19 +00:00
|
|
|
end
|
2011-07-19 21:52:38 +00:00
|
|
|
|
|
|
|
|
results = tbl.to_s
|
2011-11-06 22:02:26 +00:00
|
|
|
|
2011-07-19 21:52:38 +00:00
|
|
|
print_line("\n" + results + "\n")
|
2011-11-06 22:02:26 +00:00
|
|
|
|
2023-02-08 13:47:34 +00:00
|
|
|
p = store_loot('host.applications', 'text/plain', session, results, 'applications.txt', 'Installed Applications')
|
2017-07-19 13:02:49 +01:00
|
|
|
print_good("Results stored in: #{p}")
|
2011-01-12 03:55:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def run
|
|
|
|
|
print_status("Enumerating applications installed on #{sysinfo['Computer']}")
|
|
|
|
|
app_list
|
|
|
|
|
end
|
2011-01-12 18:11:24 +00:00
|
|
|
end
|