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
unstable
Matt Miller 2006-01-03 04:43:40 +00:00
parent e63ba080a8
commit a590caaf77
2 changed files with 19 additions and 1 deletions

View File

@ -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
}
#

View File

@ -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)