diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb index 7e8f5a280..867faa596 100644 --- a/extensions/admin_ui/controllers/modules/modules.rb +++ b/extensions/admin_ui/controllers/modules/modules.rb @@ -326,29 +326,11 @@ class Modules < BeEF::Extension::AdminUI::HttpController if(dynamic_modules != nil) all_modules = BeEF::Core::Models::CommandModule.all(:order => [:id.asc]) all_modules.each{|dyn_mod| - next if !dyn_mod.path.split('/').first.match(/^Dynamic/) - - hook_session_id = @params['zombie_session'] || nil - (print_error "hook_session_id is nil";return) if hook_session_id.nil? - - dyn_mod_name = dyn_mod.path.split('/').last - dyn_mod_category = nil - if(dyn_mod_name == "Msf") - dyn_mod_category = "Metasploit" - else - # future dynamic modules... - end - - print_debug ("Loading Dynamic command module: category [#{dyn_mod_category}] - name [#{dyn_mod.name.to_s}]") - command_mod = BeEF::Modules::Commands.const_get(dyn_mod_name.capitalize).new - command_mod.session_id = hook_session_id - command_mod.update_info(dyn_mod.id) - command_mod_name = command_mod.info['Name'].downcase - - # create url path and file for the command module icon - #command_module_status = set_command_module_status(command_mod) - command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN - command_module_icon_path = set_command_module_icon(command_mod) + next if !dyn_mod.path.split('/')[1].match(/^metasploit/) + command_mod_name = dyn_mod["name"] + dyn_mod_category = "Metasploit" + command_module_status = set_command_module_status(command_mod_name) + command_module_icon_path = set_command_module_icon(command_module_status) update_command_module_tree(tree, dyn_mod_category, command_module_icon_path, command_module_status, command_mod_name,dyn_mod.id) } diff --git a/extensions/metasploit/api.rb b/extensions/metasploit/api.rb index 644adf6af..861f67e98 100644 --- a/extensions/metasploit/api.rb +++ b/extensions/metasploit/api.rb @@ -48,6 +48,27 @@ module BeEF #m.split('/')[0...-1].each{|c| # categories.push(c.capitalize) #} + + if m_details['description'] =~ /Java|JVM|flash|Adobe/i + target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY => ["ALL"]} + elsif m_details['description'] =~ /IE|Internet\s+Explorer/i + target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["IE"]} + elsif m_details['description'] =~ /Firefox/i + target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["FF"]} + elsif m_details['description'] =~ /Chrome/i + target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["C"]} + elsif m_details['description'] =~ /Safari/i + target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["S"]} + elsif m_details['description'] =~ /Opera/i + target_browser = {BeEF::Core::Constants::CommandModule::VERIFIED_WORKING => ["O"]} + end + #TODO: + # - Add support for detection of target OS + # - Add support for detection of target services (e.g. java, flash, silverlight, ...etc) + # - Add support for multiple target browsers as currently only 1 browser will match or all + + + msf_module_config[key] = { 'enable'=> true, 'msf'=> true, @@ -57,7 +78,8 @@ module BeEF 'description'=> m_details['description'], 'authors'=> m_details['references'], 'path'=> path, - 'class'=> 'Msf_module' + 'class'=> 'Msf_module', + 'target'=> target_browser } BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_options', [key]) BeEF::API::Registrar.instance.register(BeEF::Extension::Metasploit::API::MetasploitHooks, BeEF::API::Module, 'get_payload_options', [key, nil])