Skip to content

Commit 8e2df73

Browse files
committed
Add spec for case-insensitive options
See rapid7#2027
1 parent 6c6ad28 commit 8e2df73

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

msfvenom

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ class MsfVenom
318318
# If it's not stdin, we'll already have a PlatformList
319319
@opts[:platform] ||= payload.platform
320320
payload.datastore.merge! @datastore
321+
321322
if @opts[:list_options]
322323
print_status("Options for #{payload.fullname}\n\n" +
323324
::Msf::Serializer::ReadableText.dump_module(payload,' '))

spec/msfvenom_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,23 @@
143143
output.should include("LHOST")
144144
output.should include("LPORT")
145145
end
146+
context "and some datastore options" do
147+
it "should print options" do
148+
venom.parse_args %w! -o -p windows/meterpreter/reverse_tcp LPORT=1234!
149+
expect { venom.generate_raw_payload }.to_not raise_error
150+
output = stderr.string
151+
output.should include("LHOST")
152+
output.should match(/LPORT\s+1234/)
153+
end
154+
155+
it "should print options case-insensitively" do
156+
venom.parse_args %w! -o -p windows/meterpreter/reverse_tcp lPoRt=1234!
157+
expect { venom.generate_raw_payload }.to_not raise_error
158+
output = stderr.string
159+
output.should include("LHOST")
160+
output.should match(/LPORT\s+1234/)
161+
end
162+
end
146163
end
147164

148165
context "and an invalid payload" do

0 commit comments

Comments
 (0)