@@ -43,7 +43,10 @@ def run
43
43
user = execute ( "/usr/bin/whoami" )
44
44
45
45
mount = execute ( "/bin/mount -l" )
46
- get_bash_history ( users , user )
46
+ shells = [ 'ash' , 'bash' , 'csh' , 'ksh' , 'sh' , 'tcsh' , 'zsh' ]
47
+ shells . each do |shell |
48
+ get_shell_history ( users , user , shell )
49
+ end
47
50
get_sql_history ( users , user )
48
51
get_vim_history ( users , user )
49
52
last = execute ( "/usr/bin/last && /usr/bin/lastlog" )
@@ -84,25 +87,25 @@ def cat_file(filename)
84
87
return output
85
88
end
86
89
87
- def get_bash_history ( users , user )
90
+ def get_shell_history ( users , user , shell )
91
+ return if shell . nil?
88
92
if user == "root" and users != nil
89
93
users = users . chomp . split ( )
90
94
users . each do |u |
91
95
if u == "root"
92
- vprint_status ( "Extracting history for #{ u } " )
93
- hist = cat_file ( "/root/.bash_history " )
96
+ vprint_status ( "Extracting #{ shell } history for #{ u } " )
97
+ hist = cat_file ( "/root/.#{ shell } _history " )
94
98
else
95
- vprint_status ( "Extracting history for #{ u } " )
96
- hist = cat_file ( "/home/#{ u } /.bash_history " )
99
+ vprint_status ( "Extracting #{ shell } history for #{ u } " )
100
+ hist = cat_file ( "/home/#{ u } /.#{ shell } _history " )
97
101
end
98
-
99
- save ( "History for #{ u } " , hist ) unless hist . nil? || hist =~ /No such file or directory/
102
+ save ( "#{ shell } History for #{ u } " , hist ) unless hist . blank? || hist =~ /No such file or directory/
100
103
end
101
104
else
102
- vprint_status ( "Extracting history for #{ user } " )
103
- hist = cat_file ( "/home/#{ user } /.bash_history " )
105
+ vprint_status ( "Extracting #{ shell } history for #{ user } " )
106
+ hist = cat_file ( "/home/#{ user } /.#{ shell } _history " )
104
107
vprint_status ( hist )
105
- save ( "History for #{ user } " , hist ) unless hist . nil ? || hist =~ /No such file or directory/
108
+ save ( "#{ shell } History for #{ user } " , hist ) unless hist . blank ? || hist =~ /No such file or directory/
106
109
end
107
110
end
108
111
0 commit comments