Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/fosslight_binary/_simple_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/fosslight_binary/binary_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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}",
Expand Down