def get_profile_list(self, directory=HOME_DIR): """ :param directory: The directory from which profiles are loaded :return: Two different lists: - One that contains the instances of the valid profiles that were loaded - One with the file names of the profiles that are invalid >>> HOME_DIR = '.' >>> p = CoreProfiles(None) >>> valid, invalid = p.get_profile_list(HOME_DIR) >>> valid_lower = [prof.get_name().lower() for prof in valid] >>> 'owasp_top10' in valid_lower True """ profile_home = os.path.join(directory, 'profiles') str_profile_list = get_file_list(profile_home, extension=profile.EXTENSION) instance_list = [] invalid_profiles = [] for profile_name in str_profile_list: profile_filename = os.path.join(profile_home, profile_name + profile.EXTENSION) try: profile_instance = profile(profile_filename) except BaseFrameworkException: invalid_profiles.append(profile_filename) else: instance_list.append(profile_instance) return instance_list, invalid_profiles
def get_plugin_list(self, plugin_type): """ :return: A string list of the names of all available plugins by type. """ str_plugin_list = get_file_list( os.path.join(ROOT_PATH, 'plugins', plugin_type)) return str_plugin_list
def get_plugin_list(self, plugin_type): """ :return: A string list of the names of all available plugins by type. """ str_plugin_list = get_file_list(os.path.join(ROOT_PATH, 'plugins', plugin_type)) return str_plugin_list
def get_profile_list(self, directory=HOME_DIR): """ :param directory: The directory from which profiles are loaded :return: Two different lists: - One that contains the instances of the valid profiles that were loaded - One with the file names of the profiles that are invalid >>> HOME_DIR = '.' >>> p = w3af_core_profiles(None) >>> valid, invalid = p.get_profile_list(HOME_DIR) >>> valid_lower = [prof.get_name().lower() for prof in valid] >>> 'owasp_top10' in valid_lower True """ profile_home = os.path.join(directory, 'profiles') str_profile_list = get_file_list(profile_home, extension=profile.EXTENSION) instance_list = [] invalid_profiles = [] for profile_name in str_profile_list: profile_filename = os.path.join(profile_home, profile_name + profile.EXTENSION) try: profile_instance = profile(profile_filename) except BaseFrameworkException: invalid_profiles.append(profile_filename) else: instance_list.append(profile_instance) return instance_list, invalid_profiles