Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix removing initialize warnings #18783

Merged
merged 1 commit into from Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions spec/lib/metasploit/framework/login_scanner/mssql_spec.rb
Expand Up @@ -83,8 +83,8 @@
let(:client) { instance_double(Rex::Proto::MSSQL::Client) }
it 'returns a result with the connection_error status' do
my_scanner = login_scanner
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:initialize).and_return(client)
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:mssql_login).and_raise ::Rex::ConnectionError
allow(Rex::Proto::MSSQL::Client).to receive(:new).and_return(client)
allow(client).to receive(:mssql_login).and_raise ::Rex::ConnectionError
allow(client).to receive(:disconnect)
expect(my_scanner.attempt_login(pub_blank).status).to eq Metasploit::Model::Login::Status::UNABLE_TO_CONNECT
end
Expand All @@ -94,8 +94,8 @@
let(:client) { instance_double(Rex::Proto::MSSQL::Client) }
it 'returns a result object with a status of Metasploit::Model::Login::Status::INCORRECT' do
my_scanner = login_scanner
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:initialize).and_return(client)
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:mssql_login).and_return(false)
allow(Rex::Proto::MSSQL::Client).to receive(:new).and_return(client)
allow(client).to receive(:mssql_login).and_return(false)
allow(client).to receive(:disconnect)
expect(my_scanner.attempt_login(pub_blank).status).to eq Metasploit::Model::Login::Status::INCORRECT
end
Expand All @@ -105,12 +105,11 @@
let(:client) { instance_double(Rex::Proto::MSSQL::Client) }
it 'returns a result object with a status of Metasploit::Model::Login::Status::SUCCESSFUL' do
my_scanner = login_scanner
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:initialize).and_return(client)
allow_any_instance_of(Rex::Proto::MSSQL::Client).to receive(:mssql_login).and_return(true)
allow(Rex::Proto::MSSQL::Client).to receive(:new).and_return(client)
allow(client).to receive(:mssql_login).and_return(true)
allow(client).to receive(:disconnect)
expect(my_scanner.attempt_login(pub_blank).status).to eq Metasploit::Model::Login::Status::SUCCESSFUL
end
end
end

end