Skip to content

Commit 6e3e696

Browse files
committed
Use symantec_web_gateway as an example of using send_request
1 parent 60f1d9c commit 6e3e696

File tree

2 files changed

+0
-43
lines changed

2 files changed

+0
-43
lines changed

lib/metasploit/framework/login_scanner/symantec_web_gateway.rb

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,6 @@ def check_setup
2727
end
2828

2929

30-
# Sends a HTTP request with Rex
31-
#
32-
# @param (see Rex::Proto::Http::Request#request_raw)
33-
# @raise [Rex::ConnectionError] Something has gone wrong while sending the HTTP request
34-
# @return [Rex::Proto::Http::Response] The HTTP response
35-
def send_request(opts)
36-
res = nil
37-
cli = Rex::Proto::Http::Client.new(host, port,
38-
{
39-
'Msf' => framework,
40-
'MsfExploit' => framework_module
41-
},
42-
ssl,
43-
ssl_version,
44-
proxies
45-
)
46-
configure_http_client(cli)
47-
begin
48-
cli.connect
49-
req = cli.request_cgi(opts)
50-
res = cli.send_recv(req)
51-
rescue ::Errno::EPIPE, ::Timeout::Error => e
52-
# We are trying to mimic the same type of exception rescuing in
53-
# Msf::Exploit::Remote::HttpClient. But instead of returning nil, we'll consistently
54-
# raise Rex::ConnectionError so the #attempt_login can return the error message back
55-
# to the login module.
56-
raise Rex::ConnectionError, e.message
57-
ensure
58-
cli.close
59-
end
60-
61-
res
62-
end
63-
64-
6530
# Returns the latest sid from Symantec Web Gateway.
6631
#
6732
# @returns [String] The PHP Session ID for Symantec Web Gateway login

spec/lib/metasploit/framework/login_scanner/symantec_web_gateway_spec.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@
7272
end
7373
end
7474

75-
describe '#send_request' do
76-
context 'when a valid request is sent' do
77-
it 'returns a response object' do
78-
expect(subject.send_request({'uri'=>'/'})).to be_kind_of(Rex::Proto::Http::Response)
79-
end
80-
end
81-
end
82-
8375
describe '#get_last_sid' do
8476
let(:response) do
8577
res = Rex::Proto::Http::Response.new(200, 'OK')

0 commit comments

Comments
 (0)