Land #10446, Add missing payload tests

Also adds consideration for IPv6 values needed for some payloads.
GSoC/Meterpreter_Web_Console
Adam Cammack 2018-08-15 14:46:33 -05:00
commit 77bbb517c6
No known key found for this signature in database
GPG Key ID: C9378BA088092D66
2 changed files with 48 additions and 1 deletions

View File

@ -718,6 +718,16 @@ RSpec.describe 'modules/payloads', :content do
reference_name: 'cmd/unix/reverse_bash_telnet_ssl'
end
context 'cmd/unix/reverse_ksh' do
it_should_behave_like 'payload cached size is consistent',
ancestor_reference_names: [
'singles/cmd/unix/reverse_ksh'
],
dynamic_size: false,
modules_pathname: modules_pathname,
reference_name: 'cmd/unix/reverse_ksh'
end
context 'cmd/unix/reverse_lua' do
it_should_behave_like 'payload cached size is consistent',
ancestor_reference_names: [
@ -1739,6 +1749,16 @@ RSpec.describe 'modules/payloads', :content do
reference_name: 'linux/x86/shell_reverse_tcp'
end
context 'linux/x86/shell_reverse_tcp_ipv6' do
it_should_behave_like 'payload cached size is consistent',
ancestor_reference_names: [
'singles/linux/x86/shell_reverse_tcp_ipv6'
],
dynamic_size: false,
modules_pathname: modules_pathname,
reference_name: 'linux/x86/shell_reverse_tcp_ipv6'
end
context 'mainframe/shell_reverse_tcp' do
it_should_behave_like 'payload cached size is consistent',
ancestor_reference_names: [

View File

@ -108,6 +108,29 @@ RSpec.shared_examples_for 'payload cached size is consistent' do |options|
'DisableNops' => true
}
opts6 = {
'Format' => 'raw',
'Options' => {
'CPORT' => 4444,
'LPORT' => 4444,
'LHOST' => 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
'KHOST' => 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
'AHOST' => 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
'CMD' => '/bin/sh',
'URL' => 'http://a.com',
'PATH' => '/',
'BUNDLE' => 'data/isight.bundle',
'DLL' => 'external/source/byakugan/bin/XPSP2/detoured.dll',
'RC4PASSWORD' => 'Metasploit',
'DNSZONE' => 'corelan.eu',
'PEXEC' => '/bin/sh',
'StagerURILength' => 5
},
'Encoder' => nil,
'DisableNops' => true
}
#
# lets
#
@ -157,7 +180,11 @@ RSpec.shared_examples_for 'payload cached size is consistent' do |options|
)
expect(pinst.cached_size).to_not(be_nil)
expect(pinst.dynamic_size?).to be(false)
expect(pinst.cached_size).to eq(pinst.generate_simple(opts).size)
if pinst.shortname =~ /6/
expect(pinst.cached_size).to eq(pinst.generate_simple(opts6).size)
else
expect(pinst.cached_size).to eq(pinst.generate_simple(opts).size)
end
end
end
end