@@ -49,8 +49,8 @@ def run
49
49
last = execute ( "/usr/bin/last && /usr/bin/lastlog" )
50
50
sudoers = cat_file ( "/etc/sudoers" )
51
51
52
- save ( "Last logs" , last )
53
- save ( "Sudoers" , sudoers ) unless sudoers =~ /Permission denied/
52
+ save ( "Last logs" , last ) unless last . nil?
53
+ save ( "Sudoers" , sudoers ) unless sudoers . nil? || sudoers =~ /Permission denied/
54
54
end
55
55
56
56
def save ( msg , data , ctype = "text/plain" )
@@ -96,13 +96,13 @@ def get_bash_history(users, user)
96
96
hist = cat_file ( "/home/#{ u } /.bash_history" )
97
97
end
98
98
99
- save ( "History for #{ u } " , hist ) unless hist =~ /No such file or directory/
99
+ save ( "History for #{ u } " , hist ) unless hist . nil? || hist =~ /No such file or directory/
100
100
end
101
101
else
102
102
vprint_status ( "Extracting history for #{ user } " )
103
103
hist = cat_file ( "/home/#{ user } /.bash_history" )
104
104
vprint_status ( hist )
105
- save ( "History for #{ user } " , hist ) unless hist =~ /No such file or directory/
105
+ save ( "History for #{ user } " , hist ) unless hist . nil? || hist =~ /No such file or directory/
106
106
end
107
107
end
108
108
@@ -118,13 +118,13 @@ def get_sql_history(users, user)
118
118
sql_hist = cat_file ( "/home/#{ u } /.mysql_history" )
119
119
end
120
120
121
- save ( "History for #{ u } " , sql_hist ) unless sql_hist =~ /No such file or directory/
121
+ save ( "History for #{ u } " , sql_hist ) unless sql_hist . nil? || sql_hist =~ /No such file or directory/
122
122
end
123
123
else
124
124
vprint_status ( "Extracting SQL history for #{ user } " )
125
125
sql_hist = cat_file ( "/home/#{ user } /.mysql_history" )
126
126
vprint_status ( sql_hist ) if sql_hist
127
- save ( "SQL History for #{ user } " , sql_hist ) unless sql_hist && sql_hist =~ /No such file or directory/
127
+ save ( "SQL History for #{ user } " , sql_hist ) unless sql_hist . nil? || sql_hist =~ /No such file or directory/
128
128
end
129
129
end
130
130
@@ -140,13 +140,13 @@ def get_vim_history(users, user)
140
140
vim_hist = cat_file ( "/home/#{ u } /.viminfo" )
141
141
end
142
142
143
- save ( "VIM History for #{ u } " , vim_hist ) unless vim_hist =~ /No such file or directory/
143
+ save ( "VIM History for #{ u } " , vim_hist ) unless vim_hist . nil? || vim_hist =~ /No such file or directory/
144
144
end
145
145
else
146
146
vprint_status ( "Extracting history for #{ user } " )
147
147
vim_hist = cat_file ( "/home/#{ user } /.viminfo" )
148
148
vprint_status ( vim_hist )
149
- save ( "VIM History for #{ user } " , vim_hist ) unless vim_hist =~ /No such file or directory/
149
+ save ( "VIM History for #{ user } " , vim_hist ) unless vim_hist . nil? || vim_hist =~ /No such file or directory/
150
150
end
151
151
end
152
152
end
0 commit comments