CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/core/module/auth.rb
Views: 1904
1
module Msf::Module::Auth
2
def store_valid_credential(user:, private:, private_type: :password, proof: nil, service_data: {})
3
if service_data.empty? && self.respond_to?("service_details")
4
service_data = service_details
5
end
6
7
creation_data = {
8
module_fullname: self.fullname,
9
username: user,
10
private_data: private,
11
private_type: private_type,
12
workspace_id: myworkspace_id
13
}.merge(service_data)
14
15
if service_data.empty?
16
cred_data = {
17
origin_type: :import,
18
filename: 'msfconsole' # default as values provided on the console
19
}.merge(creation_data)
20
framework.db.create_credential(cred_data)
21
else
22
login_data = {
23
proof: proof,
24
last_attempted_at: DateTime.now,
25
status: Metasploit::Model::Login::Status::SUCCESSFUL
26
}.merge(creation_data)
27
framework.db.create_credential_and_login(login_data)
28
end
29
30
nil
31
end
32
end
33
34