@@ -11,8 +11,8 @@ class Metasploit3 < Msf::Post
11
11
include Msf ::Post ::File
12
12
include Msf ::Post ::Linux ::System
13
13
14
- def initialize ( info = { } )
15
- super ( update_info ( info ,
14
+ def initialize ( info = { } )
15
+ super ( update_info ( info ,
16
16
'Name' => 'Linux Gather System and User Information' ,
17
17
'Description' => %q{
18
18
This module gathers system information. We collect
@@ -31,7 +31,6 @@ def initialize(info={})
31
31
'Platform' => [ 'linux' ] ,
32
32
'SessionTypes' => [ 'shell' , 'meterpreter' ]
33
33
) )
34
-
35
34
end
36
35
37
36
def run
@@ -60,7 +59,7 @@ def run
60
59
mount = execute ( "/bin/mount -l" )
61
60
crons = get_crons ( users , user )
62
61
diskspace = execute ( "/bin/df -ahT" )
63
- disks = ( mount + "\n \/ " + diskspace )
62
+ disks = ( mount + "\n \n " + diskspace )
64
63
logfiles = execute ( "find /var/log -type f -perm -4 2> /dev/null" )
65
64
uidgid = execute ( "find / -xdev -type f -perm +6000 -perm -1 2> /dev/null" )
66
65
@@ -74,11 +73,10 @@ def run
74
73
save ( "Setuid/setgid files" , uidgid )
75
74
end
76
75
77
-
78
- def save ( msg , data , ctype = "text/plain" )
76
+ def save ( msg , data , ctype = 'text/plain' )
79
77
ltype = "linux.enum.system"
80
78
loot = store_loot ( ltype , ctype , session , data , nil , msg )
81
- print_status ( "#{ msg } stored in #{ loot . to_s } " )
79
+ print_status ( "#{ msg } stored in #{ loot } " )
82
80
end
83
81
84
82
def get_host
@@ -148,8 +146,8 @@ def get_services(distro)
148
146
end
149
147
150
148
def get_crons ( users , user )
151
- if user == "root" && users != nil
152
- users = users . chomp . split ( )
149
+ if user == "root" && ! users . nil?
150
+ users = users . chomp . split
153
151
users . each do |u |
154
152
if u == "root"
155
153
vprint_status ( "Enumerating as root" )
@@ -164,10 +162,9 @@ def get_crons(users, user)
164
162
vprint_status ( "Enumerating as #{ user } " )
165
163
cron_data = "***** Listing cron jobs for #{ user } *****\n \n "
166
164
cron_data += execute ( "crontab -l" )
167
- end
168
165
169
- # Save cron data to loot
170
- return cron_data
166
+ # Save cron data to loot
167
+ return cron_data
168
+ end
171
169
end
172
-
173
170
end
0 commit comments