Add specs for connection error conditions
parent
59050d9bf1
commit
8a9abb90c0
|
@ -52,8 +52,8 @@ module Metasploit
|
|||
http_client.set_config('domain' => credential.realm)
|
||||
end
|
||||
|
||||
http_client.connect
|
||||
begin
|
||||
http_client.connect
|
||||
request = http_client.request_cgi(
|
||||
'uri' => uri,
|
||||
'method' => method
|
||||
|
|
|
@ -54,4 +54,34 @@ describe Metasploit::Framework::LoginScanner::HTTP do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
context "#attempt_login" do
|
||||
let(:pub_blank) {
|
||||
Metasploit::Framework::LoginScanner::Credential.new(
|
||||
paired: true,
|
||||
public: "public",
|
||||
private: ''
|
||||
)
|
||||
}
|
||||
|
||||
it "Rex::ConnectionError should result in status :connection_error" do
|
||||
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:connect).and_raise(Rex::ConnectionError)
|
||||
|
||||
expect(http_scanner.attempt_login(pub_blank).status).to eq(:connection_error)
|
||||
end
|
||||
|
||||
it "Timeout::Error should result in status :connection_error" do
|
||||
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:connect).and_raise(Timeout::Error)
|
||||
|
||||
expect(http_scanner.attempt_login(pub_blank).status).to eq(:connection_error)
|
||||
end
|
||||
|
||||
it "EOFError should result in status :connection_error" do
|
||||
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:connect).and_raise(EOFError)
|
||||
|
||||
expect(http_scanner.attempt_login(pub_blank).status).to eq(:connection_error)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue