Skip to content

Commit 707784f

Browse files
committed
Last fix
1 parent fc4da53 commit 707784f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

modules/post/windows/gather/local_admin_search_enum.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,30 +124,30 @@ def enum_users(host)
124124
# For each entry returned, get domain and name of logged in user
125125
begin
126126
count.times{|i|
127-
temp = {}
128-
userptr = mem[(base + 0),4].unpack("V*")[0]
129-
temp[:user] = client.railgun.memread(userptr,255).split("\0\0")[0].split("\0").join
130-
nameptr = mem[(base + 4),4].unpack("V*")[0]
131-
temp[:domain] = client.railgun.memread(nameptr,255).split("\0\0")[0].split("\0").join
132-
133-
# Ignore if empty or machine account
134-
unless temp[:user].empty? or temp[:user][-1, 1] == "$"
135-
136-
# Check if enumerated user's domain matches supplied domain, if there was
137-
# an error, or if option disabled
138-
data = ""
139-
if datastore['DOMAIN'].upcase == temp[:domain].upcase and not @dc_error and datastore['ENUM_GROUPS']
140-
data << " - Groups: #{enum_groups(temp[:user]).chomp(", ")}"
141-
end
142-
line = "\tLogged in user:\t#{temp[:domain]}\\#{temp[:user]}#{data}\n"
143-
144-
# Write user and groups to notes database
145-
db_note(host, "#{temp[:domain]}\\#{temp[:user]}#{data}", "localadmin.user.loggedin")
146-
userlist << line unless userlist.include? line
147-
127+
temp = {}
128+
userptr = mem[(base + 0),4].unpack("V*")[0]
129+
temp[:user] = client.railgun.memread(userptr,255).split("\0\0")[0].split("\0").join
130+
nameptr = mem[(base + 4),4].unpack("V*")[0]
131+
temp[:domain] = client.railgun.memread(nameptr,255).split("\0\0")[0].split("\0").join
132+
133+
# Ignore if empty or machine account
134+
unless temp[:user].empty? or temp[:user][-1, 1] == "$"
135+
136+
# Check if enumerated user's domain matches supplied domain, if there was
137+
# an error, or if option disabled
138+
data = ""
139+
if datastore['DOMAIN'].upcase == temp[:domain].upcase and not @dc_error and datastore['ENUM_GROUPS']
140+
data << " - Groups: #{enum_groups(temp[:user]).chomp(", ")}"
148141
end
142+
line = "\tLogged in user:\t#{temp[:domain]}\\#{temp[:user]}#{data}\n"
143+
144+
# Write user and groups to notes database
145+
db_note(host, "#{temp[:domain]}\\#{temp[:user]}#{data}", "localadmin.user.loggedin")
146+
userlist << line unless userlist.include? line
147+
148+
end
149149

150-
base = base + 8
150+
base = base + 8
151151
}
152152
rescue ::Exception => e
153153
print_error("Issue enumerating users on #{host}")

0 commit comments

Comments
 (0)