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 =
'WORKSTATION'
- 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.
-
#windows_authentication ⇒ Boolean
Whether to use Windows Authentication instead of SQL Server Auth.
Instance Method Summary collapse
Instance Attribute Details
permalink #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 |
permalink #domain_controller_rhost ⇒ String
Returns Auth The mssql hostname, required for Kerberos Authentication.
40 41 42 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 40 def domain_controller_rhost @domain_controller_rhost end |
permalink #hostname ⇒ Object
Returns the value of attribute hostname.
44 45 46 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 44 def hostname @hostname end |
permalink #max_send_size ⇒ Integer
Returns The max size of the data to encapsulate in a single packet.
56 57 58 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 56 def max_send_size @max_send_size end |
permalink #send_delay ⇒ Integer
Returns The delay between sending packets.
60 61 62 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 60 def send_delay @send_delay end |
permalink #tdsencryption ⇒ Object
Returns the value of attribute tdsencryption.
65 66 67 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 65 def tdsencryption @tdsencryption end |
permalink #use_client_as_proof ⇒ Boolean
Returns If a login is successful and this attribute is true - an MSSQL::Client instance is used as proof.
52 53 54 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 52 def use_client_as_proof @use_client_as_proof end |
permalink #windows_authentication ⇒ Boolean
Returns Whether to use Windows Authentication instead of SQL Server Auth.
48 49 50 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 48 def windows_authentication @windows_authentication end |
Instance Method Details
permalink #attempt_login(credential) ⇒ Object
[View source] [View on GitHub]
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/metasploit/framework/login_scanner/mssql.rb', line 70 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) 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) [:status] = Metasploit::Model::Login::Status::UNABLE_TO_CONNECT [:proof] = e end ::Metasploit::Framework::LoginScanner::Result.new() end |