Skip to content

Commit b476505

Browse files
committed
Fix bugs
1 parent a364172 commit b476505

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

modules/post/linux/gather/enum_protections.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ def get_host
5858
end
5959

6060
def which(env_paths, cmd)
61-
print_status("#{env_paths}")
62-
print_status("#{cmd}")
6361
for path in env_paths
64-
output = cmd_exec("/bin/ls #{path} | /bin/grep '#{cmd}'")
65-
print_status(output)
6662
if "#{cmd}" == cmd_exec("/bin/ls #{path} | /bin/grep '#{cmd}'")
6763
return "#{path}/#{cmd}"
6864
end
@@ -78,12 +74,6 @@ def find_apps
7874
"psad", "wireshark", "nagios", "nagios", "apparmor", "honeyd", "thpot"
7975
]
8076

81-
#output = cmd_exec("echo $PATH")
82-
#print_status("#{Rex::Text.to_hex_dump(output)}")
83-
#print_status("#{Rex::Text.to_hex_dump(output.chomp)}")
84-
85-
#return
86-
8777
env_paths = cmd_exec("echo $PATH").split(":")
8878

8979
apps.each do |a|

modules/post/linux/gather/enum_users_history.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def run
4949
last = execute("/usr/bin/last && /usr/bin/lastlog")
5050
sudoers = cat_file("/etc/sudoers")
5151

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/
5454
end
5555

5656
def save(msg, data, ctype="text/plain")
@@ -96,13 +96,13 @@ def get_bash_history(users, user)
9696
hist = cat_file("/home/#{u}/.bash_history")
9797
end
9898

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/
100100
end
101101
else
102102
vprint_status("Extracting history for #{user}")
103103
hist = cat_file("/home/#{user}/.bash_history")
104104
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/
106106
end
107107
end
108108

@@ -118,13 +118,13 @@ def get_sql_history(users, user)
118118
sql_hist = cat_file("/home/#{u}/.mysql_history")
119119
end
120120

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/
122122
end
123123
else
124124
vprint_status("Extracting SQL history for #{user}")
125125
sql_hist = cat_file("/home/#{user}/.mysql_history")
126126
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/
128128
end
129129
end
130130

@@ -140,13 +140,13 @@ def get_vim_history(users, user)
140140
vim_hist = cat_file("/home/#{u}/.viminfo")
141141
end
142142

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/
144144
end
145145
else
146146
vprint_status("Extracting history for #{user}")
147147
vim_hist = cat_file("/home/#{user}/.viminfo")
148148
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/
150150
end
151151
end
152152
end

0 commit comments

Comments
 (0)