From af326a4f88ad07164f113b5d3635e2f540476293 Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Fri, 29 May 2015 16:55:19 -0500 Subject: [PATCH] Use compatible_payloads instead of copy and paste --- lib/msf/core/exploit.rb | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/lib/msf/core/exploit.rb b/lib/msf/core/exploit.rb index 8d4f02fdc3..2e16e5a978 100644 --- a/lib/msf/core/exploit.rb +++ b/lib/msf/core/exploit.rb @@ -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 #