Module: LoginDataProxy

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

Instance Method Summary collapse

Instance Method Details

#create_credential_login(opts) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/metasploit/framework/data_service/proxy/login_data_proxy.rb', line 12

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

#invalidate_login(opts) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/metasploit/framework/data_service/proxy/login_data_proxy.rb', line 32

def (opts)
  begin
    add_opts_workspace(opts)
    # Search for an existing Metasploit::Credential::Core object. It requires specific attributes.
    core_opts = {}
    core_opts[:workspace] = opts[:workspace]
    core_opts[:user] = opts.fetch(:username) if opts[:username]
    core_opts[:pass] = opts.fetch(:private_data) if opts[:private_data]
    core_opts[:ports] = [ opts.fetch(:port) ] if opts[:port]
    core_opts[:host_ranges] = [ opts.fetch(:address) ] if opts[:address]
    core_opts[:svcs] = [ opts.fetch(:service_name) ] if opts[:service_name]

    # searching for cores and loading the array is a mitigation for
    # an issue seen with Rails 5 when calling first using a local database
    cores = creds(core_opts)
    cores = cores.to_a unless cores.kind_of?(Array)
    core = cores.first
    if core
      core.logins.each do ||
         = opts.slice(:access_level, :status, :last_attempted_at)
        [:id] = .id
        ()
      end
    end
  rescue => e
    self.log_error(e, "Problem invalidating login")
  end
end

#logins(opts = {}) ⇒ Object



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

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

#update_login(opts) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/metasploit/framework/data_service/proxy/login_data_proxy.rb', line 22

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