@@ -13,24 +13,24 @@ class Metasploit3 < Msf::Post
13
13
14
14
def initialize ( info = { } )
15
15
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
+ ) )
34
34
end
35
35
36
36
def run
@@ -89,19 +89,19 @@ def get_host
89
89
90
90
print_status ( "Running module against #{ host } " )
91
91
92
- return host
92
+ host
93
93
end
94
94
95
95
def execute ( cmd )
96
96
vprint_status ( "Execute: #{ cmd } " )
97
97
output = cmd_exec ( cmd )
98
- return output
98
+ output
99
99
end
100
100
101
101
def cat_file ( filename )
102
102
vprint_status ( "Download: #{ filename } " )
103
103
output = read_file ( filename )
104
- return output
104
+ output
105
105
end
106
106
107
107
def get_packages ( distro )
@@ -120,7 +120,7 @@ def get_packages(distro)
120
120
else
121
121
print_error ( "Could not determine package manager to get list of installed packages" )
122
122
end
123
- return packages_installed
123
+ packages_installed
124
124
end
125
125
126
126
def get_services ( distro )
@@ -142,29 +142,29 @@ def get_services(distro)
142
142
else
143
143
print_error ( "Could not determine the Linux Distribution to get list of configured services" )
144
144
end
145
- return services_installed
145
+ services_installed
146
146
end
147
147
148
148
def get_crons ( users , user )
149
- if user == "root" && ! users . nil?
149
+ if user == "root" && users
150
150
users = users . chomp . split
151
151
users . each do |u |
152
152
if u == "root"
153
153
vprint_status ( "Enumerating as root" )
154
154
cron_data = ""
155
155
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 "
158
158
end
159
159
end
160
160
end
161
161
else
162
162
vprint_status ( "Enumerating as #{ user } " )
163
163
cron_data = "***** Listing cron jobs for #{ user } *****\n \n "
164
- cron_data += execute ( "crontab -l" )
164
+ cron_data << execute ( "crontab -l" )
165
165
166
166
# Save cron data to loot
167
- return cron_data
167
+ cron_data
168
168
end
169
169
end
170
170
end
0 commit comments