From 8abed15c77d19690b0554c77b82dae97385204a1 Mon Sep 17 00:00:00 2001 From: James Lee Date: Tue, 3 Jun 2014 11:48:08 -0500 Subject: [PATCH] Switch to Credential::* things --- .../post/windows/gather/credentials/winscp.rb | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/modules/post/windows/gather/credentials/winscp.rb b/modules/post/windows/gather/credentials/winscp.rb index 94212e4b38..249e7c56e5 100644 --- a/modules/post/windows/gather/credentials/winscp.rb +++ b/modules/post/windows/gather/credentials/winscp.rb @@ -191,7 +191,6 @@ class Metasploit3 < Msf::Post end - def winscp_store_config(config) host = config['HostName'] pass = config['Password'] @@ -208,16 +207,31 @@ class Metasploit3 < Msf::Post plaintext = decrypt_password(pass, user+host) print_status("Host: #{host} Port: #{portnum} Protocol: #{sname} Username: #{user} Password: #{plaintext}") - report_auth_info( - :host => host, - :port => portnum, - :sname => sname, - :source_id => session_db_id, - :source_type => "exploit", - :user => user, - :pass => plaintext - ) + service_data = { + address: host, + port: portnum, + service_name: sname, + 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: plaintext, + username: user + }.merge(service_data) + + credential_core = create_credential(credential_data) + + login_data = { + core: credential_core, + status: Metasploit::Credential::Login::Status::UNTRIED + }.merge(service_data) + + create_credential_login(login_data) end end