From df04435d494f7de033f0d7a8f0ecb0cd49aa0505 Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Mon, 21 Mar 2022 16:19:37 -0400 Subject: [PATCH] Only recalculate sometimes Recalculations are time consuming, so only do it if necessary. --- lib/msf/core/module_set.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msf/core/module_set.rb b/lib/msf/core/module_set.rb index 284a8127b0..29fb6082d6 100644 --- a/lib/msf/core/module_set.rb +++ b/lib/msf/core/module_set.rb @@ -41,9 +41,9 @@ class Msf::ModuleSet < Hash # If there is no module associated with this class, then try to demand # load it. if klass.nil? or klass == Msf::SymbolicModule - framework.modules.load_cached_module(module_type, reference_name) - - recalculate + if framework.modules.load_cached_module(module_type, reference_name) || empty? + recalculate + end klass = fetch(reference_name, nil) end