made merging of info better
git-svn-id: file:///home/svn/incoming/trunk@2699 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
558b6300b1
commit
bbcc7d3abf
|
@ -189,11 +189,13 @@ protected
|
||||||
# two
|
# two
|
||||||
if (info[name].kind_of?(Array) == false)
|
if (info[name].kind_of?(Array) == false)
|
||||||
curr = info[name]
|
curr = info[name]
|
||||||
info[name] = [ curr, val ]
|
info[name] = [ curr, val ] if (val != curr)
|
||||||
# Otherwise, just append this item to the array entry
|
# Otherwise, just append this item to the array entry
|
||||||
else
|
else
|
||||||
|
if (!info[name].find(val))
|
||||||
info[name] << val
|
info[name] << val
|
||||||
end
|
end
|
||||||
|
end
|
||||||
# Otherwise, just set the value equal if no current value
|
# Otherwise, just set the value equal if no current value
|
||||||
# exists
|
# exists
|
||||||
else
|
else
|
||||||
|
@ -226,6 +228,13 @@ protected
|
||||||
merge_info_string(info, 'Description', val)
|
merge_info_string(info, 'Description', val)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Merge the module version
|
||||||
|
#
|
||||||
|
def merge_info_version(info, val)
|
||||||
|
merge_info_string(info, 'Version', val)
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Merges a given key in the info hash with a delimiter
|
# Merges a given key in the info hash with a delimiter
|
||||||
#
|
#
|
||||||
|
|
|
@ -37,6 +37,13 @@ class Msf::Module::Author
|
||||||
self.email = email
|
self.email = email
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Compares authors
|
||||||
|
#
|
||||||
|
def ==(tgt)
|
||||||
|
return (tgt.to_s == to_s)
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Serialize the author object to a string in form:
|
# Serialize the author object to a string in form:
|
||||||
#
|
#
|
||||||
|
|
|
@ -18,6 +18,13 @@ class Msf::Module::Reference
|
||||||
self.str = in_str
|
self.str = in_str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Compares references
|
||||||
|
#
|
||||||
|
def ==(tgt)
|
||||||
|
return (tgt.to_s == to_s)
|
||||||
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
return self.str
|
return self.str
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,10 +62,9 @@ class ModuleSet < Hash
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Adds a module with a supplied short name, full name, and associated
|
# Adds a module with a the supplied name
|
||||||
# module class
|
def add_module(module_class, name)
|
||||||
def add_module(module_class, alias_name = nil)
|
self[name] = module_class
|
||||||
self[alias_name || module_class.new.alias] = module_class
|
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_writer :module_type
|
attr_writer :module_type
|
||||||
|
@ -189,6 +188,7 @@ protected
|
||||||
# Extract the module's namespace from its path
|
# Extract the module's namespace from its path
|
||||||
mod = mod_from_name(path_base)
|
mod = mod_from_name(path_base)
|
||||||
type = path_base.match(/^(.+?)#{File::SEPARATOR}+?/)[1].sub(/s$/, '')
|
type = path_base.match(/^(.+?)#{File::SEPARATOR}+?/)[1].sub(/s$/, '')
|
||||||
|
name = path_base.match(/^(.+?)#{File::SEPARATOR}(.*)$/)[2]
|
||||||
|
|
||||||
# Let's rock the house now...
|
# Let's rock the house now...
|
||||||
dlog("Loading module from #{path_base}...", 'core', LEV_1)
|
dlog("Loading module from #{path_base}...", 'core', LEV_1)
|
||||||
|
@ -231,7 +231,7 @@ protected
|
||||||
|
|
||||||
# Do some processing on the loaded module to get it into the
|
# Do some processing on the loaded module to get it into the
|
||||||
# right associations
|
# right associations
|
||||||
on_module_load(type, added)
|
on_module_load(added, type, name)
|
||||||
|
|
||||||
# Set this module type as needing recalculation
|
# Set this module type as needing recalculation
|
||||||
recalc[type] = true
|
recalc[type] = true
|
||||||
|
@ -285,17 +285,7 @@ protected
|
||||||
|
|
||||||
# Called when a module is initially loaded such that it can be
|
# Called when a module is initially loaded such that it can be
|
||||||
# categorized accordingly
|
# categorized accordingly
|
||||||
def on_module_load(type, mod)
|
def on_module_load(mod, type, name)
|
||||||
# Extract the module name information
|
|
||||||
mod_full_name = mod.to_s.gsub('::', '/')
|
|
||||||
mod_full_name.sub!(/^Msf_/, '')
|
|
||||||
|
|
||||||
mod_short_name = mod_full_name
|
|
||||||
|
|
||||||
if ((md = mod_full_name.match(/^(.*)_(.*)$/)))
|
|
||||||
mod_short_name = md[2]
|
|
||||||
end
|
|
||||||
|
|
||||||
# Payload modules require custom loading as the individual files
|
# Payload modules require custom loading as the individual files
|
||||||
# may not directly contain a logical payload that a user would
|
# may not directly contain a logical payload that a user would
|
||||||
# reference, such as would be the case with a payload stager or
|
# reference, such as would be the case with a payload stager or
|
||||||
|
@ -306,10 +296,10 @@ protected
|
||||||
if (type != MODULE_PAYLOAD)
|
if (type != MODULE_PAYLOAD)
|
||||||
# Add the module class to the list of modules and add it to the
|
# Add the module class to the list of modules and add it to the
|
||||||
# type separated set of module classes
|
# type separated set of module classes
|
||||||
add_module(mod)
|
add_module(mod, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
module_sets[type].add_module(mod)
|
module_sets[type].add_module(mod, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :modules, :module_sets
|
attr_accessor :modules, :module_sets
|
||||||
|
|
|
@ -123,7 +123,7 @@ class PayloadSet < ModuleSet
|
||||||
# set we simply create an instance of the class and do some magic to figure
|
# set we simply create an instance of the class and do some magic to figure
|
||||||
# out if it's a single, stager, or stage. Depending on which it is, we
|
# out if it's a single, stager, or stage. Depending on which it is, we
|
||||||
# add it to the appropriate list
|
# add it to the appropriate list
|
||||||
def add_module(pmodule)
|
def add_module(pmodule, name)
|
||||||
|
|
||||||
# Duplicate the Payload base class and extend it with the module
|
# Duplicate the Payload base class and extend it with the module
|
||||||
# class that is passed in. This allows us to inspect the actual
|
# class that is passed in. This allows us to inspect the actual
|
||||||
|
|
Loading…
Reference in New Issue