final generation and specs

generation wrapped method complete with specs
bug/bundler_fix
David Maloney 2014-02-04 17:52:20 -06:00
parent 4dcae920f8
commit fc9105d862
2 changed files with 24 additions and 1 deletions

View File

@ -74,7 +74,7 @@ module Msf
# @return [String] A string containing the bytes of the payload in the format selected
def generate_payload
if platform == "java" or arch == "java"
if platform == "java" or arch == "java" or payload.start_with? "java/"
generate_java_payload
else
raw_payload = generate_raw_payload

View File

@ -494,4 +494,27 @@ describe Msf::PayloadGenerator do
end
end
context '#generate_payload' do
it 'calls each step of the process' do
my_generator = payload_generator
my_generator.should_receive(:generate_raw_payload).and_call_original
my_generator.should_receive(:add_shellcode).and_call_original
my_generator.should_receive(:encode_payload).and_call_original
my_generator.should_receive(:prepend_nops).and_call_original
my_generator.should_receive(:format_payload).and_call_original
my_generator.generate_payload
end
context 'when the payload is java' do
let(:payload) { "java/meterpreter/reverse_tcp" }
it 'calls generate_java_payload' do
my_generator = payload_generator
my_generator.should_receive(:generate_java_payload)
my_generator.generate_payload
end
end
end
end