Add back enum_protections with some new changes

This commit is contained in:
sinn3r 2012-03-17 16:00:20 -05:00
parent d79f89b190
commit acac3fa38d
1 changed files with 9 additions and 10 deletions

View File

@ -32,9 +32,8 @@ class Metasploit3 < Msf::Post
'License' => MSF_LICENSE, 'License' => MSF_LICENSE,
'Author' => 'Author' =>
[ [
'ohdae <bindshell[at]live.com>', 'ohdae <bindshell[at]live.com>'
], ],
'Version' => '$Revision$',
'Platform' => [ 'linux' ], 'Platform' => [ 'linux' ],
'SessionTypes' => [ 'shell' ] 'SessionTypes' => [ 'shell' ]
)) ))
@ -64,11 +63,10 @@ class Metasploit3 < Msf::Post
return host return host
end end
def which(cmd) def which(env_paths, cmd)
paths = cmd_exec("echo $PATH").split(':') for path in env_paths
for path in paths
if "#{cmd}" == cmd_exec("/bin/ls #{path} | /bin/grep '#{cmd}'") if "#{cmd}" == cmd_exec("/bin/ls #{path} | /bin/grep '#{cmd}'")
return "#{path}/#{cmd}" return "#{path}/#{cmd}"
end end
end end
return nil return nil
@ -82,14 +80,16 @@ class Metasploit3 < Msf::Post
"psad", "wireshark", "nagios", "nagios", "apparmor", "honeyd", "thpot" "psad", "wireshark", "nagios", "nagios", "apparmor", "honeyd", "thpot"
] ]
env_paths = cmd_exec("echo $PATH").split(":")
apps.each do |a| apps.each do |a|
output = which("#{a}") output = which(env_paths, a)
if output if output
print_good("#{a} found: #{output}") print_good("#{a} found: #{output}")
report_note( report_note(
:host_name => get_host, :host_name => get_host,
:type => "protection", :type => "linux.protection",
:data => output, :data => output,
:update => :unique_data :update => :unique_data
) )
@ -98,5 +98,4 @@ class Metasploit3 < Msf::Post
print_status("Installed applications saved to notes.") print_status("Installed applications saved to notes.")
end end
end end