2011-01-12 18:11:24 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2011-01-12 03:55:19 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2011-01-12 18:11:24 +00:00
|
|
|
##
|
2011-01-12 03:55:19 +00:00
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex'
|
|
|
|
require 'msf/core/post/windows/registry'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
2011-06-21 00:38:04 +00:00
|
|
|
include Msf::Post::Windows::Registry
|
2011-01-12 03:55:19 +00:00
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super( update_info( info,
|
2011-04-27 16:25:15 +00:00
|
|
|
'Name' => 'Windows Gather Installed Application Enumeration',
|
2011-02-26 02:47:40 +00:00
|
|
|
'Description' => %q{ This module will enumerate all installed applications },
|
2011-01-12 03:55:19 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
2012-10-23 18:33:01 +00:00
|
|
|
'Platform' => [ 'win' ],
|
2011-01-12 03:55:19 +00:00
|
|
|
'SessionTypes' => [ 'meterpreter' ]
|
|
|
|
))
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def app_list
|
|
|
|
tbl = Rex::Ui::Text::Table.new(
|
|
|
|
'Header' => "Installed Applications",
|
|
|
|
'Indent' => 1,
|
|
|
|
'Columns' =>
|
2011-01-12 17:36:58 +00:00
|
|
|
[
|
2011-01-12 03:55:19 +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',
|
|
|
|
]
|
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)
|
|
|
|
if found_keys
|
|
|
|
found_keys.each do |ak|
|
|
|
|
apps << keyx86 +"\\" + ak
|
|
|
|
end
|
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 = []
|
|
|
|
while(not apps.empty?)
|
2011-11-06 22:02:26 +00:00
|
|
|
|
2011-01-12 23:24:17 +00:00
|
|
|
1.upto(16) do
|
|
|
|
t << framework.threads.spawn("Module(#{self.refname})", false, apps.shift) do |k|
|
|
|
|
begin
|
|
|
|
dispnm = registry_getvaldata("#{k}","DisplayName")
|
|
|
|
dispversion = registry_getvaldata("#{k}","DisplayVersion")
|
2011-03-18 21:46:01 +00:00
|
|
|
tbl << [dispnm,dispversion] if dispnm and dispversion
|
2011-01-12 23:24:17 +00:00
|
|
|
rescue
|
|
|
|
end
|
|
|
|
end
|
2011-01-12 03:55:19 +00:00
|
|
|
|
2011-01-12 23:24:17 +00:00
|
|
|
end
|
|
|
|
t.map{|x| x.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
|
|
|
|
2012-02-20 20:15:55 +00:00
|
|
|
p = store_loot("host.applications", "text/plain", session, results, "applications.txt", "Installed Applications")
|
|
|
|
print_status("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
|