Use compatible_payloads instead of copy and paste

bug/bundler_fix
jvazquez-r7 2015-05-29 16:55:19 -05:00
parent defda01d87
commit af326a4f88
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
1 changed files with 2 additions and 29 deletions

View File

@ -707,36 +707,9 @@ class Exploit < Msf::Module
# @return [FalseClass] Payload is not compatible.
#
def is_payload_compatible?(payload_name)
c_platform = (target and target.platform) ? target.platform : platform
c_arch = (target and target.arch) ? target.arch : (arch == []) ? nil : arch
c_arch ||= [ ARCH_X86 ]
payload_names = compatible_payloads.collect { |entry| entry[0] }
framework.payloads.each_module(
'Platform' => c_platform,
'Arch' => c_arch ) { |name, mod|
# Skip over payloads that are too big
if ((payload_space) and
(framework.payloads.sizes[name]) and
(framework.payloads.sizes[name] > payload_space))
dlog("#{refname}: Skipping payload #{name} for being too large", 'core',
LEV_1)
next
end
# Are we compatible in terms of conventions and connections and
# what not?
next if (compatible?(framework.payloads.instance(name)) == false)
# If the payload is privileged but the exploit does not give
# privileged access, then fail it.
next if (self.privileged == false and framework.payloads.instance(name).privileged == true)
# This one be compatible!
return true if payload_name == name
}
false
payload_names.include?(payload_name)
end
#