diff --git a/src/fosslight_binary/_simple_mode.py b/src/fosslight_binary/_simple_mode.py index 5426ef3..2d055fd 100644 --- a/src/fosslight_binary/_simple_mode.py +++ b/src/fosslight_binary/_simple_mode.py @@ -12,7 +12,6 @@ from fosslight_util.write_txt import write_txt_file from fosslight_util.set_log import init_log -REMOVE_FILE_EXTENSION_SIMPLE = ['ttf', 'otf', 'png', 'gif', 'jpg', 'bmp', 'jpeg'] logger = logging.getLogger(constant.LOGGER_NAME) @@ -27,16 +26,10 @@ def exclude_bin_for_simple_mode(binary_list): compressed_list = [] for bin in binary_list: - file_lower_case = bin.bin_name_with_path.lower() - extension = os.path.splitext(file_lower_case)[1][1:].strip() - if is_compressed_file(bin.bin_name_with_path): compressed_list.append(bin.bin_name_with_path) continue - remove_file_ext_list = REMOVE_FILE_EXTENSION_SIMPLE - if any(extension == remove_ext for remove_ext in remove_file_ext_list): - continue if re.search(r".*sources\.jar", bin.bin_name_with_path.lower()) or bin.exclude: continue diff --git a/src/fosslight_binary/binary_analysis.py b/src/fosslight_binary/binary_analysis.py index 6f2f303..bf09bbb 100755 --- a/src/fosslight_binary/binary_analysis.py +++ b/src/fosslight_binary/binary_analysis.py @@ -47,6 +47,7 @@ 'Homepage', 'Copyright Text', 'Exclude', 'Comment', 'Vulnerability Link', 'TLSH', 'SHA1']} HIDE_HEADER = {'TLSH', "SHA1"} +REMOVE_FILE_EXTENSION_SIMPLE_MODE = ['ttf', 'otf', 'png', 'gif', 'jpg', 'bmp', 'jpeg'] def get_checksum_and_tlsh(bin_with_path): @@ -194,10 +195,13 @@ def find_binaries(path_to_find_bin, output_dir, formats, dburl="", simple_mode=F if all_exclude_mode and len(all_exclude_mode) == 4: excluded_path_with_default_exclusion, excluded_path_without_dot, excluded_files, cnt_file_except_skipped = all_exclude_mode + elif simple_mode: + excluded_path_with_default_exclusion, excluded_path_without_dot, excluded_files, cnt_file_except_skipped \ + = get_excluded_paths(path_to_find_bin, path_to_exclude, REMOVE_FILE_EXTENSION_SIMPLE_MODE) else: excluded_path_with_default_exclusion, excluded_path_without_dot, excluded_files, cnt_file_except_skipped \ = get_excluded_paths(path_to_find_bin, path_to_exclude) - logger.debug(f"Skipped paths: {excluded_path_with_default_exclusion}") + logger.debug(f"Skipped paths: {excluded_path_with_default_exclusion}") if not os.path.isdir(path_to_find_bin): error_occured(error_msg=f"(-p option) Can't find the directory: {path_to_find_bin}",