Skip to content

Commit de2efc6

Browse files
committed
Merge branch 'master' of github.com:rapid7/metasploit-framework into rapid7
2 parents d36f2df + da438cd commit de2efc6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

lib/msf/core/module_manager.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class ModuleManager
3636
include Msf::ModuleManager::ModuleSets
3737
include Msf::ModuleManager::Reloading
3838

39+
include Enumerable
40+
3941
#
4042
# CONSTANTS
4143
#
@@ -96,10 +98,21 @@ def create(name)
9698
end
9799

98100

99-
# @param framework [Msf::Framework] The framework for which this
100-
# instance is managing the modules.
101-
# @param types [Array<String>] List of module types to load.
102-
# Defaults to all module types in {Msf::MODULE_TYPES}.
101+
# Iterate over all modules in all sets
102+
#
103+
# @yieldparam name [String] The module's reference name
104+
# @yieldparam mod_class [Msf::Module] A module class
105+
def each
106+
module_set_by_type.each do |type, set|
107+
set.each do |name, mod_class|
108+
yield name, mod_class
109+
end
110+
end
111+
end
112+
113+
114+
# @param [Msf::Framework] framework The framework for which this instance is managing the modules.
115+
# @param [Array<String>] types List of module types to load. Defaults to all module types in {Msf::MODULE_TYPES}.
103116
def initialize(framework, types=Msf::MODULE_TYPES)
104117
#
105118
# defaults
@@ -158,5 +171,6 @@ def auto_subscribe_module(mod)
158171
framework.events.add_session_subscriber((inst) ? inst : (inst = mod.new))
159172
end
160173
end
174+
161175
end
162176
end

0 commit comments

Comments
 (0)