Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = [
"pytz",
"XlsxWriter",
"PyYAML",
"fosslight_util>=2.2.8",
"fosslight_util>=2.2.12",
"truststore",
"python-magic-bin; sys_platform == 'win32'",
"python-magic; 'darwin' in sys_platform",
Expand Down
15 changes: 15 additions & 0 deletions src/fosslight_binary/_exclude.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2026 LG Electronics Inc.
# SPDX-License-Identifier: Apache-2.0

"""Binary-scanner filename excludes."""

from fosslight_util.exclude import is_excluded_filename

# Scanner output binaries that should not be re-analyzed.
EXCLUDE_FILENAME_BINARY = frozenset({
"fosslight_bin", "fosslight_bin.exe",
})


def is_excluded_binary_filename(file_path: str) -> bool:
return is_excluded_filename(file_path, EXCLUDE_FILENAME_BINARY)
11 changes: 8 additions & 3 deletions src/fosslight_binary/binary_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from fosslight_util.correct import correct_with_yaml
from fosslight_util.oss_item import ScannerItem
from fosslight_util.exclude import get_excluded_paths
from ._exclude import EXCLUDE_FILENAME_BINARY, is_excluded_binary_filename
import hashlib
import tlsh
from io import open
Expand Down Expand Up @@ -147,7 +148,7 @@ def get_file_list(path_to_find, excluded_files):
for file in files:
bin_with_path = os.path.join(root, file)
rel_path_file = os.path.relpath(bin_with_path, path_to_find).replace('\\', '/')
if rel_path_file in excluded_files:
if rel_path_file in excluded_files or is_excluded_binary_filename(rel_path_file):
continue
file_lower_case = file.lower()
extension = os.path.splitext(file_lower_case)[1][1:].strip()
Expand Down Expand Up @@ -200,10 +201,14 @@ def find_binaries(path_to_find_bin, output_dir, formats, kb_url="", kb_token="",
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)
= get_excluded_paths(
path_to_find_bin, path_to_exclude, REMOVE_FILE_EXTENSION_SIMPLE,
exclude_filenames=EXCLUDE_FILENAME_BINARY)
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)
= get_excluded_paths(
path_to_find_bin, path_to_exclude,
exclude_filenames=EXCLUDE_FILENAME_BINARY)
logger.debug(f"Skipped paths: {excluded_path_with_default_exclusion}")

if not os.path.isdir(path_to_find_bin):
Expand Down
Loading