fixed the module loader a bit, still needs more work
git-svn-id: file:///home/svn/incoming/trunk@2698 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
ffbfe73260
commit
558b6300b1
|
@ -183,30 +183,18 @@ protected
|
||||||
# Substitute the base path
|
# Substitute the base path
|
||||||
path_base = file.sub(path + File::SEPARATOR, '')
|
path_base = file.sub(path + File::SEPARATOR, '')
|
||||||
|
|
||||||
# Extract the type of module
|
# Chop off the file name
|
||||||
md = path_base.match(/^(.*?)#{File::SEPARATOR}/)
|
path_base.sub!(/(.+)(#{File::SEPARATOR}.+\.rb)$/, '\1')
|
||||||
|
|
||||||
next if (!md)
|
# Extract the module's namespace from its path
|
||||||
|
mod = mod_from_name(path_base)
|
||||||
|
type = path_base.match(/^(.+?)#{File::SEPARATOR}+?/)[1].sub(/s$/, '')
|
||||||
|
|
||||||
# Use the de-pluralized version of the type as necessary
|
# Let's rock the house now...
|
||||||
type = md[1].sub(/s$/, '').downcase
|
dlog("Loading module from #{path_base}...", 'core', LEV_1)
|
||||||
|
|
||||||
md = path_base.match(/^(.*)#{File::SEPARATOR}(.*?)$/)
|
|
||||||
|
|
||||||
next if (!md)
|
|
||||||
|
|
||||||
# Prefix Msf to the namespace
|
|
||||||
namespace = 'Msf::' + md[1].gsub(File::SEPARATOR, "::")
|
|
||||||
|
|
||||||
dlog("Loading #{type} module from #{path_base}...", 'core', LEV_1)
|
|
||||||
|
|
||||||
# Get the module and grab the current number of constants
|
# Get the module and grab the current number of constants
|
||||||
old_constants = []
|
old_constants = mod.constants
|
||||||
mod = mod_from_name(namespace)
|
|
||||||
|
|
||||||
if (mod)
|
|
||||||
old_constants = mod.constants
|
|
||||||
end
|
|
||||||
|
|
||||||
# Load the file
|
# Load the file
|
||||||
begin
|
begin
|
||||||
|
@ -219,14 +207,6 @@ protected
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
# Incase we hadn't gotten the module yet...
|
|
||||||
mod = mod_from_name(namespace)
|
|
||||||
|
|
||||||
if (!mod)
|
|
||||||
elog("Load did not create expected namespace #{namespace}.")
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
added = mod.constants - old_constants
|
added = mod.constants - old_constants
|
||||||
|
|
||||||
if (added.length > 1)
|
if (added.length > 1)
|
||||||
|
@ -286,14 +266,17 @@ protected
|
||||||
# Returns the module object that is associated with the supplied module
|
# Returns the module object that is associated with the supplied module
|
||||||
# name
|
# name
|
||||||
def mod_from_name(name)
|
def mod_from_name(name)
|
||||||
obj = Object
|
obj = Msf
|
||||||
|
|
||||||
|
name.split(File::SEPARATOR).each { |m|
|
||||||
|
# Up-case the first letter and any prefixed by _
|
||||||
|
m.gsub!(/^[a-z]/) { |s| s.upcase }
|
||||||
|
m.gsub!(/(_[a-z])/) { |s| s[1..1].upcase }
|
||||||
|
|
||||||
name.split('::').each { |m|
|
|
||||||
begin
|
begin
|
||||||
obj = obj.const_get(m)
|
obj = obj.const_get(m)
|
||||||
rescue NameError
|
rescue NameError
|
||||||
obj = nil
|
obj = obj.const_set(m, ::Module.new)
|
||||||
break
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +287,7 @@ protected
|
||||||
# categorized accordingly
|
# categorized accordingly
|
||||||
def on_module_load(type, mod)
|
def on_module_load(type, mod)
|
||||||
# Extract the module name information
|
# Extract the module name information
|
||||||
mod_full_name = mod.to_s.gsub('::', '_')
|
mod_full_name = mod.to_s.gsub('::', '/')
|
||||||
mod_full_name.sub!(/^Msf_/, '')
|
mod_full_name.sub!(/^Msf_/, '')
|
||||||
|
|
||||||
mod_short_name = mod_full_name
|
mod_short_name = mod_full_name
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'msf/core'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
module Encoders
|
module Encoders
|
||||||
module IA32
|
module Ia32
|
||||||
|
|
||||||
class JmpCallAdditive < Msf::Encoder::XorAdditiveFeedback
|
class JmpCallAdditive < Msf::Encoder::XorAdditiveFeedback
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'msf/core'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
module Nops
|
module Nops
|
||||||
module IA32
|
module Ia32
|
||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
|
|
|
@ -2,9 +2,8 @@ require 'msf/core'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
module Payloads
|
module Payloads
|
||||||
|
module Stagers
|
||||||
module Windows
|
module Windows
|
||||||
module IA32
|
|
||||||
module Stager
|
|
||||||
|
|
||||||
module ReverseTcp
|
module ReverseTcp
|
||||||
|
|
||||||
|
@ -52,4 +51,4 @@ module ReverseTcp
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end end end end end
|
end end end end
|
||||||
|
|
|
@ -2,9 +2,8 @@ require 'msf/core'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
module Payloads
|
module Payloads
|
||||||
|
module Stages
|
||||||
module Windows
|
module Windows
|
||||||
module IA32
|
|
||||||
module Stage
|
|
||||||
|
|
||||||
module Shell
|
module Shell
|
||||||
|
|
||||||
|
@ -42,4 +41,4 @@ module Shell
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end end end end end
|
end end end end
|
||||||
|
|
Loading…
Reference in New Issue