Skip to content

Commit 001253a

Browse files
committed
Clean up module some more
1 parent c6e8ffb commit 001253a

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

modules/post/linux/gather/enum_system.rb

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ class Metasploit3 < Msf::Post
1313

1414
def initialize(info = {})
1515
super(update_info(info,
16-
'Name' => 'Linux Gather System and User Information',
17-
'Description' => %q{
18-
This module gathers system information. We collect
19-
installed packages, installed services, mount information,
20-
user list, user bash history and cron jobs
21-
},
22-
'License' => MSF_LICENSE,
23-
'Author' =>
24-
[
25-
'Carlos Perez <carlos_perez[at]darkoperator.com>', # get_packages and get_services
26-
'Stephen Haywood <averagesecurityguy[at]gmail.com>', # get_cron and original enum_linux
27-
'sinn3r', # Testing and modification of original enum_linux
28-
'ohdae <bindshell[at]live.com>', # Combined separate mods, modifications and testing
29-
'Roberto Espreto <robertoespreto[at]gmail.com>', # log files and setuid/setgid
30-
],
31-
'Platform' => ['linux'],
32-
'SessionTypes' => ['shell', 'meterpreter']
33-
))
16+
'Name' => 'Linux Gather System and User Information',
17+
'Description' => %q{
18+
This module gathers system information. We collect
19+
installed packages, installed services, mount information,
20+
user list, user bash history and cron jobs
21+
},
22+
'License' => MSF_LICENSE,
23+
'Author' =>
24+
[
25+
'Carlos Perez <carlos_perez[at]darkoperator.com>', # get_packages and get_services
26+
'Stephen Haywood <averagesecurityguy[at]gmail.com>', # get_cron and original enum_linux
27+
'sinn3r', # Testing and modification of original enum_linux
28+
'ohdae <bindshell[at]live.com>', # Combined separate mods, modifications and testing
29+
'Roberto Espreto <robertoespreto[at]gmail.com>', # log files and setuid/setgid
30+
],
31+
'Platform' => ['linux'],
32+
'SessionTypes' => ['shell', 'meterpreter']
33+
))
3434
end
3535

3636
def run
@@ -89,19 +89,19 @@ def get_host
8989

9090
print_status("Running module against #{host}")
9191

92-
return host
92+
host
9393
end
9494

9595
def execute(cmd)
9696
vprint_status("Execute: #{cmd}")
9797
output = cmd_exec(cmd)
98-
return output
98+
output
9999
end
100100

101101
def cat_file(filename)
102102
vprint_status("Download: #{filename}")
103103
output = read_file(filename)
104-
return output
104+
output
105105
end
106106

107107
def get_packages(distro)
@@ -120,7 +120,7 @@ def get_packages(distro)
120120
else
121121
print_error("Could not determine package manager to get list of installed packages")
122122
end
123-
return packages_installed
123+
packages_installed
124124
end
125125

126126
def get_services(distro)
@@ -142,29 +142,29 @@ def get_services(distro)
142142
else
143143
print_error("Could not determine the Linux Distribution to get list of configured services")
144144
end
145-
return services_installed
145+
services_installed
146146
end
147147

148148
def get_crons(users, user)
149-
if user == "root" && !users.nil?
149+
if user == "root" && users
150150
users = users.chomp.split
151151
users.each do |u|
152152
if u == "root"
153153
vprint_status("Enumerating as root")
154154
cron_data = ""
155155
users.each do |usr|
156-
cron_data += "*****Listing cron jobs for #{usr}*****\n"
157-
cron_data += execute("crontab -u #{usr} -l") + "\n\n"
156+
cron_data << "*****Listing cron jobs for #{usr}*****\n"
157+
cron_data << execute("crontab -u #{usr} -l") + "\n\n"
158158
end
159159
end
160160
end
161161
else
162162
vprint_status("Enumerating as #{user}")
163163
cron_data = "***** Listing cron jobs for #{user} *****\n\n"
164-
cron_data += execute("crontab -l")
164+
cron_data << execute("crontab -l")
165165

166166
# Save cron data to loot
167-
return cron_data
167+
cron_data
168168
end
169169
end
170170
end

0 commit comments

Comments
 (0)