From a590caaf77f161ad5bcef07211052ef7a59f8478 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Tue, 3 Jan 2006 04:43:40 +0000 Subject: [PATCH] fix for merging compat options and for mirroring Payload->Compat with Compat->Payload git-svn-id: file:///home/svn/incoming/trunk@3304 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/exploit.rb | 18 +++++++++++++++++- lib/msf/core/module.rb | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/msf/core/exploit.rb b/lib/msf/core/exploit.rb index c98569a5ee..250ffd9873 100644 --- a/lib/msf/core/exploit.rb +++ b/lib/msf/core/exploit.rb @@ -234,6 +234,22 @@ class Exploit < Msf::Module # Creates an instance of the exploit module. Mad skillz. # def initialize(info = {}) + + # Ghetto compat mirroring for payload compatibilities. This mirrors + # + # Payload => Compat => xyz + # + # to + # + # Compat => Payload => xyz + if (info['Payload'] and info['Payload']['Compat']) + info['Compat'] = Hash.new if (info['Compat'] == nil) + info['Compat']['Payload'] = Hash.new if (info['Compat']['Payload'] == nil) + info['Compat']['Payload'].update(info['Payload']['Compat']) + end + + # Call the parent constructor after making any necessary modifications + # to the information hash. super(info) self.targets = Rex::Transformer.transform(info['Targets'], Array, @@ -786,7 +802,7 @@ protected p = module_info['Compat']['Payload'] CompatDefaults::Payload.each_pair { |k,v| - (p[k]) ? p[k] << v : p[k] = v + (p[k]) ? p[k] << " #{v}" : p[k] = v } # diff --git a/lib/msf/core/module.rb b/lib/msf/core/module.rb index 2cab9db548..24446f0f4c 100644 --- a/lib/msf/core/module.rb +++ b/lib/msf/core/module.rb @@ -246,6 +246,8 @@ class Module sv.each do |x| + dlog("Checking compat [#{mod.refname} with #{self.refname}]: #{x} to #{mv.join(", ")}", 'core', LEV_3) + # Verify that any negate values are not matched if (x[0].chr == '-' and mv.include?(x[1, x.length-1])) dlog("Module #{mod.refname} is incompatible with #{self.refname} for #{k}: limiter was #{x}, value was #{mval}", 'core', LEV_1)