Land #3598 to electro-release - Refactor sso to use Credential::Creation

bug/bundler_fix
sinn3r 2014-08-04 16:31:49 -05:00
commit 1691795901
No known key found for this signature in database
GPG Key ID: 2384DB4EF06F730B
1 changed files with 29 additions and 14 deletions

View File

@ -101,24 +101,39 @@ class Metasploit3 < Msf::Post
return if (user.empty? or pass.empty?) return if (user.empty? or pass.empty?)
return if pass.include?("n.a.") return if pass.include?("n.a.")
if session.db_record # Assemble data about the credential objects we will be creating
source_id = session.db_record.id credential_data = {
else origin_type: :session,
source_id = nil post_reference_name: self.refname,
private_data: pass,
private_type: :password,
session_id: session_db_id,
username: user,
workspace_id: myworkspace_id
}
unless domain.blank?
credential_data[:realm_key] = Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN
credential_data[:realm_value] = domain
end end
report_auth_info( credential_core = create_credential(credential_data)
:host => session.session_host,
:port => 445, # Assemble the options hash for creating the Metasploit::Credential::Login object
:sname => 'smb', login_data = {
:proto => 'tcp', core: credential_core,
:source_id => source_id, status: Metasploit::Model::Login::Status::UNTRIED,
:source_type => "exploit", address: ::Rex::Socket.getaddress(session.sock.peerhost, true),
:user => "#{domain}\\#{user}", port: 445,
:pass => pass service_name: 'smb',
) protocol: 'tcp',
workspace_id: myworkspace_id
}
create_credential_login(login_data)
end end
def is_system_user?(user) def is_system_user?(user)
system_users = [ system_users = [
/^$/, /^$/,