Skip to content

Commit 32ca702

Browse files
committed
Merge pull request #7 from jvazquez-r7/review_3388
make MSF_MODULES a constant
2 parents 6160374 + e585d11 commit 32ca702

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

modules/post/windows/gather/enum_patches.rb

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ class Metasploit3 < Msf::Post
1212
include Msf::Post::Common
1313
include Msf::Post::Windows::ExtAPI
1414

15+
MSF_MODULES = {
16+
'KB977165' => "KB977165 - Possibly vulnerable to MS10-015 kitrap0d if Windows 2K SP4 - Windows 7 (x86)",
17+
'KB2305420' => "KB2305420 - Possibly vulnerable to MS10-092 schelevator if Vista, 7, and 2008",
18+
'KB2592799' => "KB2592799 - Possibly vulnerable to MS11-080 afdjoinleaf if XP SP2/SP3 Win 2k3 SP2",
19+
'KB2778930' => "KB2778930 - Possibly vulnerable to MS13-005 hwnd_broadcast, elevates from Low to Medium integrity",
20+
'KB2850851' => "KB2850851 - Possibly vulnerable to MS13-053 schlamperei if x86 Win7 SP0/SP1",
21+
'KB2870008' => "KB2870008 - Possibly vulnerable to MS13-081 track_popup_menu if x86 Windows 7 SP0/SP1"
22+
}
23+
1524
def initialize(info={})
1625
super(update_info(info,
1726
'Name' => "Windows Enumerate Applied Patches",
@@ -38,21 +47,13 @@ def initialize(info={})
3847
# The sauce starts here
3948
def run
4049
patches = []
41-
msfmodules = [
42-
'KB977165', # MS10-015 kitrap0d
43-
'KB2305420', # MS10-092 schelevator
44-
'KB2592799', # MS11-080 afdjoinleaf
45-
'KB2778930', # MS13-005 hwnd_broadcast
46-
'KB2850851', # MS13-053 schlamperei
47-
'KB2870008' # MS13-081 track_popup_menu
48-
]
4950

5051
datastore['KB'].split(',').each do |kb|
5152
patches << kb.strip
5253
end
5354

5455
if datastore['MSFLOCALS']
55-
patches = patches + msfmodules
56+
patches = patches + MSF_MODULES.keys
5657
end
5758

5859
extapi_loaded = load_extapi
@@ -64,30 +65,23 @@ def run
6465
return
6566
end
6667
kb_ids = objects[:values].map { |kb| kb[0] }
67-
patches.each do |kb|
68-
if kb_ids.include?(kb)
69-
print_status("#{kb} applied")
68+
report_info(patches, kb_ids)
69+
else
70+
print_error "ExtAPI failed to load"
71+
end
72+
end
73+
74+
def report_info(patches, kb_ids)
75+
patches.each do |kb|
76+
if kb_ids.include?(kb)
77+
print_status("#{kb} applied")
78+
else
79+
if MSF_MODULES.include?(kb)
80+
print_good(MSF_MODULES[kb])
7081
else
71-
case kb
72-
when "KB977165"
73-
print_good("KB977165 - Possibly vulnerable to MS10-015 kitrap0d if Windows 2K SP4 - Windows 7 (x86)")
74-
when "KB2305420"
75-
print_good("KB2305420 - Possibly vulnerable to MS10-092 schelevator if Vista, 7, and 2008")
76-
when "KB2592799"
77-
print_good("KB2592799 - Possibly vulnerable to MS11-080 afdjoinleaf if XP SP2/SP3 Win 2k3 SP2")
78-
when "KB2778930"
79-
print_good("KB2778930 - Possibly vulnerable to MS13-005 hwnd_broadcast, elevates from Low to Medium integrity")
80-
when "KB2850851"
81-
print_good("KB2850851 - Possibly vulnerable to MS13-053 schlamperei if x86 Win7 SP0/SP1")
82-
when "KB2870008"
83-
print_good("KB2870008 - Possibly vulnerable to MS13-081 track_popup_menu if x86 Windows 7 SP0/SP1")
84-
else
85-
print_good("#{kb} is missing")
86-
end
82+
print_good("#{kb} is missing")
8783
end
8884
end
89-
else
90-
print_error "ExtAPI failed to load"
9185
end
9286
end
9387
end

0 commit comments

Comments
 (0)