Skip to content

Commit 424d1ec

Browse files
committed
Add example to describe how send_request handles a JSESSIONID cookie
1 parent 419b213 commit 424d1ec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
describe Metasploit::Framework::LoginScanner::Glassfish do
66

7+
subject(:http_scanner) { described_class.new }
8+
79
it_behaves_like 'Metasploit::Framework::LoginScanner::Base', has_realm_key: true, has_default_realm: false
810
it_behaves_like 'Metasploit::Framework::LoginScanner::RexSocket'
911

10-
subject(:http_scanner) { described_class.new }
1112

1213
let(:good_version) do
1314
'4.0'
@@ -50,6 +51,13 @@
5051
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv).and_return(Rex::Proto::Http::Response.new(res_code))
5152
expect(http_scanner.send_request(req_opts)).to be_kind_of(Rex::Proto::Http::Response)
5253
end
54+
55+
it 'parses JSESSIONID session cookies' do
56+
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv).and_return(Rex::Proto::Http::Response.new(res_code))
57+
allow_any_instance_of(Rex::Proto::Http::Response).to receive(:get_cookies).and_return("JSESSIONID=JSESSIONID_MAGIC_VALUE;")
58+
http_scanner.send_request(req_opts)
59+
expect(http_scanner.jsession).to eq("JSESSIONID_MAGIC_VALUE")
60+
end
5361
end
5462

5563
context '#is_secure_admin_disabled?' do

0 commit comments

Comments
 (0)