Add spec for case-insensitive options

See #2027
bug/bundler_fix
James Lee 2013-07-05 16:06:00 -05:00
parent 6c6ad28da2
commit 8e2df73f2c
2 changed files with 18 additions and 0 deletions

View File

@ -318,6 +318,7 @@ class MsfVenom
# If it's not stdin, we'll already have a PlatformList # If it's not stdin, we'll already have a PlatformList
@opts[:platform] ||= payload.platform @opts[:platform] ||= payload.platform
payload.datastore.merge! @datastore payload.datastore.merge! @datastore
if @opts[:list_options] if @opts[:list_options]
print_status("Options for #{payload.fullname}\n\n" + print_status("Options for #{payload.fullname}\n\n" +
::Msf::Serializer::ReadableText.dump_module(payload,' ')) ::Msf::Serializer::ReadableText.dump_module(payload,' '))

View File

@ -143,6 +143,23 @@ describe MsfVenom do
output.should include("LHOST") output.should include("LHOST")
output.should include("LPORT") output.should include("LPORT")
end end
context "and some datastore options" do
it "should print options" do
venom.parse_args %w! -o -p windows/meterpreter/reverse_tcp LPORT=1234!
expect { venom.generate_raw_payload }.to_not raise_error
output = stderr.string
output.should include("LHOST")
output.should match(/LPORT\s+1234/)
end
it "should print options case-insensitively" do
venom.parse_args %w! -o -p windows/meterpreter/reverse_tcp lPoRt=1234!
expect { venom.generate_raw_payload }.to_not raise_error
output = stderr.string
output.should include("LHOST")
output.should match(/LPORT\s+1234/)
end
end
end end
context "and an invalid payload" do context "and an invalid payload" do