Skip to content

Commit

Permalink
Land #18696, Convert MSSQL mixin to class
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 authored Feb 2, 2024
2 parents 41b517d + 35778e9 commit 7ac4387
Show file tree
Hide file tree
Showing 15 changed files with 325 additions and 640 deletions.
11 changes: 8 additions & 3 deletions lib/metasploit/framework/login_scanner/mssql.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'metasploit/framework/mssql/client'
require 'rex/proto/mssql/client'
require 'metasploit/framework/login_scanner/base'
require 'metasploit/framework/login_scanner/rex_socket'
require 'metasploit/framework/login_scanner/ntlm'
Expand All @@ -14,7 +14,6 @@ class MSSQL
include Metasploit::Framework::LoginScanner::Base
include Metasploit::Framework::LoginScanner::RexSocket
include Metasploit::Framework::LoginScanner::NTLM
include Metasploit::Framework::MSSQL::Client

DEFAULT_PORT = 1433
DEFAULT_REALM = 'WORKSTATION'
Expand Down Expand Up @@ -48,6 +47,9 @@ class MSSQL
# @return [Boolean] Whether to use Windows Authentication instead of SQL Server Auth.
attr_accessor :windows_authentication

attr_accessor :max_send_size
attr_accessor :send_delay

validates :windows_authentication,
inclusion: { in: [true, false] }

Expand All @@ -66,7 +68,8 @@ def attempt_login(credential)
}

begin
if mssql_login(credential.public, credential.private, '', credential.realm)
client = Rex::Proto::MSSQL::Client.new(framework_module, framework, host, port)
if client.mssql_login(credential.public, credential.private, '', credential.realm)
result_options[:status] = Metasploit::Model::Login::Status::SUCCESSFUL
else
result_options[:status] = Metasploit::Model::Login::Status::INCORRECT
Expand All @@ -78,6 +81,8 @@ def attempt_login(credential)
elog(e)
result_options[:status] = Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
result_options[:proof] = e
ensure
client.disconnect
end

::Metasploit::Framework::LoginScanner::Result.new(result_options)
Expand Down
1 change: 0 additions & 1 deletion lib/metasploit/framework/tcp/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ module Client
# @see Rex::Socket::Tcp
# @see Rex::Socket::Tcp.create
def connect(global = true, opts={})

dossl = false
if(opts.has_key?('SSL'))
dossl = opts['SSL']
Expand Down
Loading

0 comments on commit 7ac4387

Please sign in to comment.