Land #10215, add support for payload estimation for IPv6-specific modules
commit
e17744df8d
|
@ -36,6 +36,28 @@ class PayloadCachedSize
|
|||
'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
|
||||
}
|
||||
|
||||
# Insert a new CachedSize value into the text of a payload module
|
||||
#
|
||||
# @param data [String] The source code of a payload module
|
||||
|
@ -82,6 +104,7 @@ class PayloadCachedSize
|
|||
# @return [Integer]
|
||||
def self.compute_cached_size(mod)
|
||||
return ":dynamic" if is_dynamic?(mod)
|
||||
return mod.generate_simple(OPTS6).size if mod.shortname =~ /6/
|
||||
return mod.generate_simple(OPTS).size
|
||||
end
|
||||
|
||||
|
@ -92,8 +115,13 @@ class PayloadCachedSize
|
|||
# verify that the size is static.
|
||||
# @return [Integer]
|
||||
def self.is_dynamic?(mod, generation_count=5)
|
||||
[*(1..generation_count)].map{|x|
|
||||
mod.generate_simple(OPTS).size}.uniq.length != 1
|
||||
[*(1..generation_count)].map do |x|
|
||||
if mod.shortname =~ /6/
|
||||
mod.generate_simple(OPTS6).size
|
||||
else
|
||||
mod.generate_simple(OPTS).size
|
||||
end
|
||||
end.uniq.length != 1
|
||||
end
|
||||
|
||||
# Determines whether a payload's CachedSize is up to date
|
||||
|
@ -103,8 +131,12 @@ class PayloadCachedSize
|
|||
def self.is_cached_size_accurate?(mod)
|
||||
return true if mod.dynamic_size? && is_dynamic?(mod)
|
||||
return false if mod.cached_size.nil?
|
||||
if mod.shortname =~ /6/
|
||||
mod.cached_size == mod.generate_simple(OPTS6).size
|
||||
else
|
||||
mod.cached_size == mod.generate_simple(OPTS).size
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ require 'msf/base/sessions/command_shell_options'
|
|||
|
||||
module MetasploitModule
|
||||
|
||||
CachedSize = 167
|
||||
CachedSize = 158
|
||||
|
||||
include Msf::Payload::Single
|
||||
include Msf::Payload::Linux
|
||||
|
|
Loading…
Reference in New Issue