2011-01-12 18:11:24 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
2011-01-12 03:55:19 +00:00
|
|
|
|
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
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2011-01-12 18:11:24 +00:00
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
2011-01-12 03:55:19 +00:00
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex'
|
|
|
|
require 'msf/core/post/windows/registry'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
|
|
|
include Msf::Post::Registry
|
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super( update_info( info,
|
2011-02-25 21:00:33 +00:00
|
|
|
'Name' => 'Microsoft Windows Installed Application Enumeration',
|
|
|
|
'Description' => %q{ This module will enumerate installed applications on a target host},
|
2011-01-12 03:55:19 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Platform' => [ 'windows' ],
|
|
|
|
'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"
|
|
|
|
])
|
|
|
|
appkeys = ['HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
|
|
|
'HKCU\\SOFTWARE\\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-01-12 23:24:17 +00:00
|
|
|
registry_enumkeys(keyx86).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 = []
|
|
|
|
while(not apps.empty?)
|
|
|
|
|
|
|
|
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")
|
|
|
|
tbl << [dispnm,dispversion]
|
|
|
|
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-01-12 23:24:17 +00:00
|
|
|
|
2011-01-12 03:55:19 +00:00
|
|
|
print_line("\n" + tbl.to_s + "\n")
|
2011-02-25 21:48:03 +00:00
|
|
|
|
|
|
|
store_loot("host.applications", "text/plain", session, tbl.to_s, "applications.txt", "Installed Applications")
|
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
|