Files
metasploit-gs/lib/msf/core/module/auth.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
953 B
Ruby
Raw Normal View History

2017-05-01 15:52:53 -05:00
module Msf::Module::Auth
def store_valid_credential(user:, private:, private_type: :password, proof: nil, service_data: {})
if service_data.empty? && self.respond_to?("service_details")
2017-05-01 15:52:53 -05:00
service_data = service_details
end
2017-05-08 11:50:54 -05:00
creation_data = {
2017-05-01 15:52:53 -05:00
module_fullname: self.fullname,
username: user,
private_data: private,
private_type: private_type,
workspace_id: myworkspace_id
}.merge(service_data)
if service_data.empty?
2017-05-08 11:50:54 -05:00
cred_data = {
origin_type: :import,
filename: 'msfconsole' # default as values provided on the console
}.merge(creation_data)
framework.db.create_credential(cred_data)
2017-05-08 11:50:54 -05:00
else
2017-05-01 15:52:53 -05:00
login_data = {
2017-05-01 18:39:25 -05:00
proof: proof,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
2017-05-08 11:50:54 -05:00
}.merge(creation_data)
framework.db.create_credential_and_login(login_data)
2017-05-01 15:52:53 -05:00
end
nil
end
end