Remove the parts that are not broken for BES spec
This commit is contained in:
@@ -113,43 +113,6 @@ describe Msf::Exploit::Remote::BrowserExploitServer do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#get_bad_requirements' do
|
||||
let(:this_profile) do
|
||||
MessagePack.unpack(first_packed_profile)
|
||||
end
|
||||
|
||||
let(:requirements) { {} }
|
||||
|
||||
before(:each) do
|
||||
r = server.instance_variable_get(:@requirements)
|
||||
requirements.each_pair do |key, value|
|
||||
r[key] = value
|
||||
end
|
||||
|
||||
server.instance_variable_set(:@requirements, r)
|
||||
end
|
||||
|
||||
context 'when all requirements are met' do
|
||||
let(:requirements) { first_profile_info }
|
||||
it 'returns an empty bad requirement array' do
|
||||
expect(server.get_bad_requirements(this_profile)).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the os_name requirement is not met' do
|
||||
let(:requirements) { {'os_name'=>'Linux'} }
|
||||
it 'returns os_name in the array as a bad requirement' do
|
||||
expect(server.get_bad_requirements(this_profile)).to eq(['os_name'])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a Linux regex cannot match a Winodws os_name' do
|
||||
let(:requirements) { {'os_name'=>/Linux/} }
|
||||
it 'returns os_name in the array as a bad requirement' do
|
||||
expect(server.get_bad_requirements(this_profile)).to eq(['os_name'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#get_detection_html' do
|
||||
it "returns the detection code that the client will get" do
|
||||
@@ -179,30 +142,11 @@ describe Msf::Exploit::Remote::BrowserExploitServer do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#try_set_target' do
|
||||
let(:fake_targets) do
|
||||
target = double('Msf::Module::Target')
|
||||
allow(target).to receive(:opts) { first_profile_info }
|
||||
[target]
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
allow_any_instance_of(described_class).to receive(:targets) { fake_targets }
|
||||
end
|
||||
|
||||
context 'when requirements match a target' do
|
||||
it 'sets @target' do
|
||||
expect(server.get_target).to be_nil
|
||||
server.try_set_target(MessagePack.unpack(first_packed_profile))
|
||||
expect(server.get_target).to eq(fake_targets.first)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'extract_requirements' do
|
||||
context 'when a recognizable requirement is given' do
|
||||
it 'returns a hash that contains the recognizable requirement' do
|
||||
expected_hash = {'os_name'=>'Linux'}
|
||||
expected_hash = {:os_name=>'Linux'}
|
||||
expect(server.extract_requirements(expected_hash)).to eq(expected_hash)
|
||||
end
|
||||
end
|
||||
@@ -269,13 +213,6 @@ describe Msf::Exploit::Remote::BrowserExploitServer do
|
||||
@on_request_exploit_called = false
|
||||
end
|
||||
|
||||
context 'when / is requested' do
|
||||
it 'sends the information gathering page' do
|
||||
cli_request = Rex::Proto::Http::Request.new
|
||||
server.on_request_uri(cli, cli_request)
|
||||
expect(@send_redirect_called).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
context 'when info_receiver_page is requested' do
|
||||
it 'sends an empty page' do
|
||||
@@ -297,15 +234,6 @@ describe Msf::Exploit::Remote::BrowserExploitServer do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when exploit_receiver_page is requested' do
|
||||
it 'calls on_request_exploit' do
|
||||
exploit_receiver_page_var = server.instance_variable_get(:@exploit_receiver_page)
|
||||
cli_request = Rex::Proto::Http::Request.new
|
||||
cli_request.uri = exploit_receiver_page_var
|
||||
server.on_request_uri(cli, cli_request)
|
||||
expect(@on_request_exploit_called).to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#get_payload' do
|
||||
|
||||
Reference in New Issue
Block a user