diff --git a/core/main/configuration.rb b/core/main/configuration.rb index bb53f05b7..be77d4a4b 100644 --- a/core/main/configuration.rb +++ b/core/main/configuration.rb @@ -78,6 +78,20 @@ module Core return true end + # + # Clears the given key hash + # + def clear(key) + subkeys = key.split('.') + return false if subkeys.length == 0 + lastkey = subkeys.pop + hash = @config + subkeys.each{|v| + hash = hash[v] + } + return (hash.delete(lastkey) == nil) ? false : true + end + # # load extensions configurations # diff --git a/core/module.rb b/core/module.rb index 629be2c23..aa00bcdad 100644 --- a/core/module.rb +++ b/core/module.rb @@ -90,7 +90,7 @@ module Module # 4+ = As above but with extra parameters. # Please note this rating system has no correlation to the return constant value BeEF::Core::Constants::CommandModule::* def self.support(mod, opts) - target_config = BeEF::Core::Configuration.instance.get('beef.module.'+mod+'.target_new') + target_config = BeEF::Core::Configuration.instance.get('beef.module.'+mod+'.target') if target_config and opts.kind_of? Hash if opts.key?('browser') results = [] @@ -217,7 +217,8 @@ module Module print_error "Module \"#{mod}\" configuration has invalid target status defined \"#{k}\"" end } - BeEF::Core::Configuration.instance.set("beef.module.#{mod}.target_new", targets) + BeEF::Core::Configuration.instance.clear("beef.module.#{mod}.target") + BeEF::Core::Configuration.instance.set("beef.module.#{mod}.target", targets) end end