Module: Msf::DBManager::Login

Included in:
Msf::DBManager
Defined in:
lib/msf/core/db_manager/login.rb

Instance Method Summary collapse

Instance Method Details

#delete_logins(opts) ⇒ Object

Raises:

  • (ArgumentError)

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/msf/core/db_manager/login.rb', line 20

def delete_logins(opts)
  raise ArgumentError.new("The following options are required: :ids") if opts[:ids].nil?

  ::ApplicationRecord.connection_pool.with_connection {
    deleted = []
    opts[:ids].each do ||
       = Metasploit::Credential::Login.find()
      begin
        deleted << .destroy
      rescue # refs suck
        elog("Forcibly deleting #{}")
        deleted << .delete
      end
    end

    return deleted
  }
end

#logins(opts) ⇒ Object


2
3
4
5
6
# File 'lib/msf/core/db_manager/login.rb', line 2

def logins(opts)
  ::ApplicationRecord.connection_pool.with_connection {
    Metasploit::Credential::Login.where(opts)
  }
end

#update_login(opts) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/msf/core/db_manager/login.rb', line 8

def (opts)
  ::ApplicationRecord.connection_pool.with_connection {
    wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework, false)
    opts = opts.clone()
    opts[:workspace] = wspace if wspace
    id = opts.delete(:id)
     = Metasploit::Credential::Login.find(id)
    .update!(opts)
    return 
  }
end