Class: Metasploit::Framework::LoginScanner::DB2

Inherits:
Object
  • Object
show all
Includes:
Base, RexSocket, Tcp::Client
Defined in:
lib/metasploit/framework/login_scanner/db2.rb

Overview

This is the LoginScanner class for dealing with DB2 Database servers. It is responsible for taking a single target, and a list of credentials and attempting them. It then saves the results.

Constant Summary collapse

DEFAULT_PORT =
50000
DEFAULT_REALM =
'toolsdb'
LIKELY_PORTS =
[ DEFAULT_PORT ]
LIKELY_SERVICE_NAMES =
TODO:

XXX

[ ]
PRIVATE_TYPES =
[ :password ]
REALM_KEY =
Metasploit::Model::Realm::Key::DB2_DATABASE

Instance Attribute Summary

Attributes included from Tcp::Client

#max_send_size, #send_delay, #sock

Instance Method Summary collapse

Methods included from Tcp::Client

#chost, #connect, #cport, #disconnect, #proxies, #rhost, #rport, #set_tcp_evasions, #ssl, #ssl_version

Instance Method Details

#attempt_login(credential) ⇒ Object

See Also:

  • Base#attempt_login


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/metasploit/framework/login_scanner/db2.rb', line 25

def (credential)
  result_options = {
      credential: credential
  }

  begin
    probe_data = send_probe(credential.realm)

    if probe_data.empty?
      result_options[:status] = Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
    else
      if authenticate?(credential)
        result_options[:status] = Metasploit::Model::Login::Status::SUCCESSFUL
      else
        result_options[:status] = Metasploit::Model::Login::Status::INCORRECT
      end
    end
  rescue ::Rex::ConnectionError, ::Rex::Proto::DRDA::RespError, ::Timeout::Error => e
    result_options.merge!({
      status:  Metasploit::Model::Login::Status::UNABLE_TO_CONNECT,
      proof: e,
    })
  end

  result = ::Metasploit::Framework::LoginScanner::Result.new(result_options)
  result.host         = host
  result.port         = port
  result.protocol     = 'tcp'
  result.service_name = 'db2'
  result
end