Skip to content

Commit ef0826c

Browse files
committed
Fix bugs
1 parent 05c9757 commit ef0826c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

modules/post/windows/gather/enum_services.rb

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def initialize(info={})
4141
def run
4242

4343
# set vars
44-
lootString = ""
4544
credentialCount = {}
4645
qcred = datastore["CRED"] || nil
4746
qpath = datastore["PATH"] || nil
@@ -73,13 +72,7 @@ def run
7372
'Columns' => ['Name', 'Credentials', 'Command', 'Startup']
7473
)
7574

76-
if datastore['VERBOSE']
77-
print_status("Listing Service Info for matching services:")
78-
else
79-
print_status("Detailed output is only printed when VERBOSE is set to True. Running this module can take some time.\n")
80-
end
81-
82-
print_status("Listing Service Info for matching services:")
75+
print_status("Listing Service Info for matching services, please wait...")
8376
service_list.each do |srv|
8477
srv_conf = {}
8578

@@ -103,15 +96,15 @@ def run
10396
end
10497

10598
# count the occurance of specific credentials services are running as
106-
serviceCred = srv_conf['Credentials'].upcase
99+
serviceCred = srv_conf[:startname].upcase
107100
unless serviceCred.empty?
108101
if credentialCount.has_key?(serviceCred)
109102
credentialCount[serviceCred] += 1
110103
else
111104
credentialCount[serviceCred] = 1
112105
# let the user know a new service account has been detected for possible lateral
113106
# movement opportunities
114-
print_good("New service credential detected: #{sname} is running as '#{srv_conf['Credentials']}'")
107+
print_good("New service credential detected: #{srv[:name]} is running as '#{srv_conf[:startname]}'")
115108
end
116109
end
117110

@@ -125,7 +118,7 @@ def run
125118
print_error("An error occurred enumerating service: #{srv[:name]}: #{e}")
126119
end
127120
else
128-
print_error("Problem enumerating services (no service name found)")
121+
print_error("Problem enumerating service - no service name found")
129122
end
130123
end
131124

0 commit comments

Comments
 (0)