Add the first few specs
Coverage for meterpreter and client core, just the bits I'm changing. I intend to make liberal use of doubles, since they're easier than mocks and all I care about is the changed behavior. I refuse to fall into a trap where I need to first spec out aaaaaalllll of Metepreter just to make this one change.bug/bundler_fix
parent
99d60b7d6c
commit
f90e8f00e5
|
@ -0,0 +1,53 @@
|
|||
require 'spec_helper'
|
||||
require 'rex/post/meterpreter/client_core'
|
||||
|
||||
describe Rex::Post::Meterpreter::ClientCore do
|
||||
|
||||
it "should be available" do
|
||||
expect(described_class).to eq(Rex::Post::Meterpreter::ClientCore)
|
||||
end
|
||||
|
||||
describe "#use" do
|
||||
|
||||
before(:each) do
|
||||
@response = double("response")
|
||||
allow(@response).to receive(:result) { 0 }
|
||||
allow(@response).to receive(:each) { [:help] }
|
||||
@client = double("client")
|
||||
allow(@client).to receive(:binary_suffix) { "x64.dll" }
|
||||
allow(@client).to receive(:capabilities) { {:ssl => false, :zlib => false } }
|
||||
allow(@client).to receive(:response_timeout) { 1 }
|
||||
allow(@client).to receive(:send_packet_wait_response) { @response }
|
||||
allow(@client).to receive(:add_extension) { true }
|
||||
end
|
||||
|
||||
let(:client_core) {described_class.new(@client)}
|
||||
it 'should respond to #use' do
|
||||
expect(client_core).to respond_to(:use)
|
||||
end
|
||||
|
||||
context 'with a gemified module' do
|
||||
let(:mod) {"kiwi"}
|
||||
it 'should be available' do
|
||||
expect(client_core.use(mod)).to be_true
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a local module' do
|
||||
let(:mod) {"sniffer"}
|
||||
it 'should be available' do
|
||||
expect(client_core.use(mod)).to be_true
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a missing a module' do
|
||||
let(:mod) {"eaten_by_av"}
|
||||
it 'should be available' do
|
||||
expect { client_core.use(mod) }.to raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
require 'spec_helper'
|
||||
require 'rex/post/meterpreter'
|
||||
|
||||
describe MeterpreterBinaries do
|
||||
it 'is available' do
|
||||
expect(described_class).to eq(MeterpreterBinaries)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue