diff --git a/extensions/admin_ui/api/command.rb b/extensions/admin_ui/api/command.rb index a20d8c425..e045722f3 100644 --- a/extensions/admin_ui/api/command.rb +++ b/extensions/admin_ui/api/command.rb @@ -25,81 +25,6 @@ module API include BeEF::Core::Constants::Browsers include BeEF::Core::Constants::CommandModule - # - # verify whether this command module has been checked against the target browser - # this function is used when determining the code of the node icon - # - def verify_target - - return VERIFIED_UNKNOWN if not @target # no target specified in the module - - # loop through each definition and check it - @target.each {|definition| - return definition['verified_status'] if test_target(definition) - } - - return VERIFIED_UNKNOWN - - end - - # - # test if the target definition matches the hooked browser - # this function is used when determining the code of the node icon - # - def test_target_attribute(hb_attr_name, hb_attr_ver, target_attr_name, target_attr_max_ver, target_attr_min_ver) - - # check if wild cards are set - return true if not target_attr_name - return true if target_attr_name.nil? - return true if target_attr_name.eql? ALL - - # can't answer based on hb_attr_name - return false if not hb_attr_name - return false if hb_attr_name.nil? - return false if hb_attr_name.eql? UNKNOWN - - # check if the attribute is targeted - return false if not target_attr_name.eql? hb_attr_name - - # assume that the max version and min version were purposefully excluded - return true if target_attr_max_ver.nil? && target_attr_min_ver.nil? - - # check if the framework can detect hb version - return false if hb_attr_ver.eql? 'UNKNOWN' - - # check the version number is within range - return false if hb_attr_ver.to_f > target_attr_max_ver.to_f - return false if hb_attr_ver.to_f < target_attr_min_ver.to_f - - # all the checks passed - true - end - - # - # test if the target definition matches the hooked browser - # this function is used when determining the code of the node icon - # - def test_target(target_definition) - - # if the definition is nill we don't know - return false if target_definition.nil? - - # check if the browser is a target - hb_browser_name = get_browser_detail('BrowserName') - hb_browser_version = get_browser_detail('BrowserVersion') - target_browser_name = target_definition['browser_name'] - target_browser_max_ver = target_definition['browser_max_ver'] - target_browser_min_ver = target_definition['browser_min_ver'] - browser_match = test_target_attribute(hb_browser_name, hb_browser_version, target_browser_name, target_browser_max_ver, target_browser_min_ver) - - # check if the operating system is a target - hb_os_name = get_browser_detail('OsName') - target_os_name = target_definition['os_name'] - os_match = test_target_attribute(hb_os_name, nil, target_os_name, nil, nil) - return browser_match && os_match - - end - # # Get the browser detail from the database. # @@ -113,4 +38,4 @@ module API end end end -end \ No newline at end of file +end diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb index 520b9ea04..837c44f4e 100644 --- a/extensions/admin_ui/controllers/modules/modules.rb +++ b/extensions/admin_ui/controllers/modules/modules.rb @@ -307,40 +307,31 @@ class Modules < BeEF::Extension::AdminUI::HttpController end # Set the correct icon for the command module - def set_command_module_icon(command_mod) - command_module_icon_path = BeEF::Extension::AdminUI::Constants::Icons::MODULE_TARGET_IMG_PATH # add icon path - case command_mod.verify_target() + def set_command_module_icon(status) + path = BeEF::Extension::AdminUI::Constants::Icons::MODULE_TARGET_IMG_PATH # add icon path + case status when BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING - command_module_icon_path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_NOT_WORKING_IMG + path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_NOT_WORKING_IMG when BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY - command_module_icon_path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_USER_NOTIFY_IMG + path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_USER_NOTIFY_IMG when BeEF::Core::Constants::CommandModule::VERIFIED_WORKING - command_module_icon_path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_WORKING_IMG + path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_WORKING_IMG when BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN - command_module_icon_path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG + path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG else - command_module_icon_path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG + path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG end - #return command_module_icon_path - command_module_icon_path + #return path + path end # Set the correct working status for the command module - def set_command_module_status(command_mod) - case command_mod.verify_target() - when BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING - command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING - when BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY - command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY - when BeEF::Core::Constants::CommandModule::VERIFIED_WORKING - command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_WORKING - when BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN - command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN - else - command_module_status = BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN + def set_command_module_status(mod) + hook_session_id = @params['zombie_session'] || nil + if hook_session_id == nil + return BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN end -# return command_module_status - command_module_status + return BeEF::Module.support(mod, {'browser' => BD.get(hook_session_id, 'BrowserName'), 'ver' => BD.get(hook_session_id, 'BrowserVersion'), 'os' => [BD.get(hook_session_id, 'OsName')]}) end def update_command_module_tree(tree, cmd_category, cmd_icon_path, cmd_status, cmd_name, cmd_id) @@ -383,8 +374,8 @@ class Modules < BeEF::Extension::AdminUI::HttpController command_mod.session_id = hook_session_id # create url path and file for the command module icon - command_module_icon_path = set_command_module_icon(command_mod) - command_module_status = set_command_module_status(command_mod) + command_module_status = set_command_module_status(k) + command_module_icon_path = set_command_module_icon(command_module_status) update_command_module_tree(tree, mod['category'], command_module_icon_path, command_module_status, mod['name'],mod['db']['id']) } @@ -416,8 +407,9 @@ class Modules < BeEF::Extension::AdminUI::HttpController 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) - command_module_status = set_command_module_status(command_mod) update_command_module_tree(tree, dyn_mod_category, command_module_icon_path, command_module_status, command_mod_name,dyn_mod.id) } diff --git a/modules/misc/alert_dialog/config.yaml b/modules/misc/alert_dialog/config.yaml index 7c79f7706..8f370bfe4 100644 --- a/modules/misc/alert_dialog/config.yaml +++ b/modules/misc/alert_dialog/config.yaml @@ -29,9 +29,9 @@ beef: max_ver: 8 os: ["Mac", "Linux"] C: false - FF: true not_working: IE: max_ver: 8 os: "All" S: true + FF: true