Module: CredentialDataProxy

Included in:
DataProxyAutoLoader
Defined in:
lib/metasploit/framework/data_service/proxy/credential_data_proxy.rb

Instance Method Summary collapse

Instance Method Details

#create_cracked_credential(opts) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/metasploit/framework/data_service/proxy/credential_data_proxy.rb', line 13

def create_cracked_credential(opts)
  begin
    self.data_service_operation do |data_service|
      opts = opts.clone
      opts[:workspace_id] = workspace.id
      opts[:private_data] = opts.delete(:password)
      opts[:private_type] = :password
      old_core = data_service.creds(id: opts.delete(:core_id)).first
      if old_core
        opts[:originating_core_id] = old_core.id
        opts[:origin_type] = :cracked_password
      end
      new_core = data_service.create_credential(opts)
      old_core.logins.each do ||
        service = data_service.services(id: .service_id).first
        data_service.(core: new_core, service_id: service.id, status: Metasploit::Model::Login::Status::UNTRIED)
      end
      new_core
    end
  rescue => e
    self.log_error(e, "Problem creating cracked credential")
  end
end

#create_credential(opts) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/metasploit/framework/data_service/proxy/credential_data_proxy.rb', line 3

def create_credential(opts)
  begin
    self.data_service_operation do |data_service|
      data_service.create_credential(opts)
    end
  rescue => e
    self.log_error(e, "Problem creating credential")
  end
end

#create_credential_and_login(opts) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/metasploit/framework/data_service/proxy/credential_data_proxy.rb', line 37

def (opts)
  begin
    self.data_service_operation do |data_service|
      opts = opts.clone
      core = data_service.create_credential(opts)
      opts[:core] = core
      data_service.(opts)
    end
  rescue => e
    self.log_error(e, "Problem creating credential and login")
  end
end

#creds(opts = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/metasploit/framework/data_service/proxy/credential_data_proxy.rb', line 50

def creds(opts = {})
  begin
    self.data_service_operation do |data_service|
      add_opts_workspace(opts)
      data_service.creds(opts)
    end
  rescue => e
    self.log_error(e, "Problem retrieving credentials")
  end
end

#delete_credentials(opts) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/metasploit/framework/data_service/proxy/credential_data_proxy.rb', line 72

def delete_credentials(opts)
  begin
    self.data_service_operation do |data_service|
      data_service.delete_credentials(opts)
    end
  rescue => e
    self.log_error(e, "Problem deleting credentials")
  end
end

#update_credential(opts) ⇒ Object



61
62
63
64
65
66
67
68
69
70
# File 'lib/metasploit/framework/data_service/proxy/credential_data_proxy.rb', line 61

def update_credential(opts)
  begin
    self.data_service_operation do |data_service|
      add_opts_workspace(opts)
      data_service.update_credential(opts)
    end
  rescue => e
    self.log_error(e, "Problem updating credential")
  end
end