From d7fd7b8d1e41dc1ff316d145087898d5ec96a12e Mon Sep 17 00:00:00 2001 From: William Vu Date: Tue, 10 Jun 2014 11:43:59 -0500 Subject: [PATCH] Refactor wsftp_client creds --- .../gather/credentials/wsftp_client.rb | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/modules/post/windows/gather/credentials/wsftp_client.rb b/modules/post/windows/gather/credentials/wsftp_client.rb index ae8cbef726..56f57c2157 100644 --- a/modules/post/windows/gather/credentials/wsftp_client.rb +++ b/modules/post/windows/gather/credentials/wsftp_client.rb @@ -66,19 +66,32 @@ class Metasploit3 < Msf::Post next if passwd == nil or passwd == "" port = 21 if port == nil print_good("Host: #{host} Port: #{port} User: #{username} Password: #{passwd}") - if session.db_record - source_id = session.db_record.id - else - source_id = nil - end - report_auth_info( - :host => host, + service_data = { + :address => Rex::Socket.getaddress(host), :port => port, - :sname => 'ftp', - :source_id => source_id, - :source_type => "exploit", - :user => username, - :pass => passwd) + :protocol => "tcp", + :service_name => "ftp", + :workspace_id => myworkspace_id + } + + credential_data = { + :origin_type => :session, + :session_id => session_db_id, + :post_reference_name => self.refname, + :username => username, + :private_data => passwd, + :private_type => :password + } + + credential_core = create_credential(credential_data.merge(service_data)) + + login_data = { + :core => credential_core, + :access_level => "User", + :status => Metasploit::Credential::Login::Status::UNTRIED + } + + create_credential_login(login_data.merge(service_data)) end end