Class: Metasploit::Framework::LoginScanner::MSSQL
- Inherits:
-
Object
- Object
- Metasploit::Framework::LoginScanner::MSSQL
- Defined in:
- lib/metasploit/framework/login_scanner/mssql.rb
Overview
This is the LoginScanner class for dealing with Microsoft SQL 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 =
1433- DEFAULT_REALM =
nil- LIKELY_PORTS =
Lifted from lib/msf/core/exploit/mssql.rb
[ 1433, 1434, 1435, 14330, 2533, 9152, 2638 ]
- LIKELY_SERVICE_NAMES =
Lifted from lib/msf/core/exploit/mssql.rb
[ 'ms-sql-s', 'ms-sql2000', 'sybase', 'mssql' ]
- PRIVATE_TYPES =
[ :password, :ntlm_hash ]
- REALM_KEY =
Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN
Instance Attribute Summary collapse
-
#auth ⇒ Array<String>
Auth The Authentication mechanism to use.
-
#domain_controller_rhost ⇒ String
Auth The mssql hostname, required for Kerberos Authentication.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#max_send_size ⇒ Integer
The max size of the data to encapsulate in a single packet.
-
#send_delay ⇒ Integer
The delay between sending packets.
-
#tdsencryption ⇒ Object
Returns the value of attribute tdsencryption.
-
#use_client_as_proof ⇒ Boolean
If a login is successful and this attribute is true - an MSSQL::Client instance is used as proof.
Instance Method Summary collapse
Instance Attribute Details
#auth ⇒ Array<String>
Returns Auth The Authentication mechanism to use.
30 31 32 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 30 def auth @auth end |
#domain_controller_rhost ⇒ String
Returns Auth The mssql hostname, required for Kerberos Authentication.
37 38 39 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 37 def domain_controller_rhost @domain_controller_rhost end |
#hostname ⇒ Object
Returns the value of attribute hostname.
41 42 43 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 41 def hostname @hostname end |
#max_send_size ⇒ Integer
Returns The max size of the data to encapsulate in a single packet.
49 50 51 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 49 def max_send_size @max_send_size end |
#send_delay ⇒ Integer
Returns The delay between sending packets.
53 54 55 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 53 def send_delay @send_delay end |
#tdsencryption ⇒ Object
Returns the value of attribute tdsencryption.
55 56 57 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 55 def tdsencryption @tdsencryption end |
#use_client_as_proof ⇒ Boolean
Returns If a login is successful and this attribute is true - an MSSQL::Client instance is used as proof.
45 46 47 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 45 def use_client_as_proof @use_client_as_proof end |
Instance Method Details
#attempt_login(credential) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 60 def attempt_login(credential) = { credential: credential, host: host, port: port, protocol: 'tcp', service_name: 'mssql' } begin client = Rex::Proto::MSSQL::Client.new(framework_module, framework, host, port, proxies, sslkeylogfile: sslkeylogfile) if client.mssql_login(credential.public, credential.private, '', credential.realm) [:status] = Metasploit::Model::Login::Status::SUCCESSFUL if use_client_as_proof [:proof] = client [:connection] = client.sock else client.disconnect end else [:status] = Metasploit::Model::Login::Status::INCORRECT end rescue ::Rex::ConnectionError => e [:status] = Metasploit::Model::Login::Status::UNABLE_TO_CONNECT [:proof] = e rescue => e elog(e, error: e) [:status] = Metasploit::Model::Login::Status::UNABLE_TO_CONNECT [:proof] = e end ::Metasploit::Framework::LoginScanner::Result.new() end |