From 64ec9bf3380ce225071b274a38fa00906d00cfd0 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Sun, 22 May 2005 07:23:25 +0000 Subject: [PATCH] ninja chop git-svn-id: file:///home/svn/incoming/trunk@2503 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/constants.rb | 10 +++++++++- lib/msf/core/module_manager.rb | 22 ++++++++++++++++++---- user_interfaces/test.rb | 4 ++-- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lib/msf/core/constants.rb b/lib/msf/core/constants.rb index 07d64a3049..5d448db229 100644 --- a/lib/msf/core/constants.rb +++ b/lib/msf/core/constants.rb @@ -24,6 +24,14 @@ MODULE_ENCODER = 'encoder' MODULE_EXPLOIT = 'exploit' MODULE_NOP = 'nop' MODULE_RECON = 'recon' -MODULE_TYPES = [ MODULE_ENCODER, MODULE_EXPLOIT, MODULE_NOP, MODULE_RECON ] +MODULE_PAYLOAD = 'payload' +MODULE_TYPES = + [ + MODULE_ENCODER, + MODULE_PAYLOAD, + MODULE_EXPLOIT, + MODULE_NOP, + MODULE_RECON + ] end diff --git a/lib/msf/core/module_manager.rb b/lib/msf/core/module_manager.rb index 28f5f86ab7..2eb89443f0 100644 --- a/lib/msf/core/module_manager.rb +++ b/lib/msf/core/module_manager.rb @@ -72,6 +72,11 @@ end # takes care of the work of managing the interaction with # modules in terms of loading and instantiation. # +# TODO: +# +# - add reload support +# - add unload support +# ### class ModuleManager < Array @@ -87,22 +92,31 @@ class ModuleManager < Array } end - # Returns the array of loaded encoder module classes + # + # Accessors by module type + # + + # Returns the set of loaded encoder module classes def encoders return modules_by_type[MODULE_ENCODER] end - # Returns the array of loaded nop module classes + # Returns the set of loaded nop module classes def nops return modules_by_type[MODULE_NOPS] end - # Returns the array of loaded exploit module classes + # Returns the set of loaded exploit module classes def exploits return modules_by_type[MODULE_EXPLOIT] end - # Returns the array of loaded recon module classes + # Returns the set of loaded payload module classes + def payloads + return modules_by_type[MODULE_PAYLOAD] + end + + # Returns the set of loaded recon module classes def recon return modules_by_type[MODULE_RECON] end diff --git a/user_interfaces/test.rb b/user_interfaces/test.rb index 3ce155b817..cc544db0b7 100755 --- a/user_interfaces/test.rb +++ b/user_interfaces/test.rb @@ -13,8 +13,8 @@ framework = Msf::Framework.new framework.modules.add_module_path('/home/mmiller/msf/rubyhacks/prototype/Modules') -framework.encoders.each { |encoder| - puts "got encoder #{encoder}" +framework.encoders.each_module { |name| + puts "got encoder #{name}" } encoder = framework.encoders.create('JmpCallAdditive')