Skip to content

Commit f6958a1

Browse files
authored
Merge pull request #29 from fosslight/bug
Fixe a bug that checks if it's binary or not
2 parents ed854a6 + 9846c5e commit f6958a1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/fosslight_android/_common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
class AndroidBinary:
1919
bin_name = ""
2020
bin_name_with_installed_path = ""
21+
bin_name_with_path = ""
2122
binary_name_without_path = ""
2223
source_code_path = ""
2324
module_name = ""
@@ -38,6 +39,7 @@ class AndroidBinary:
3839

3940
def __init__(self, value):
4041
self.bin_name = value
42+
self.bin_name_with_path = value # Needed for FL Binary Scanner
4143
self.binary_name_without_path = ""
4244
self.bin_name_with_installed_path = ""
4345
self.source_code_path = CONST_NULL

src/fosslight_android/android_binary_analysis.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def find_binaries_from_out_dir():
270270
tmp_files = []
271271
for file_rel_path in return_list:
272272
if any(re.search(re_except_path, file_rel_path) for re_except_path in EXCEPTIONAL_PATH):
273-
logger.debug(f"REMOVE (Exceptional Path):{file_rel_path}")
273+
#logger.debug(f"REMOVE (Exceptional Path):{file_rel_path}")
274274
continue
275275
else:
276276
bin_item = AndroidBinary(os.path.abspath(file_rel_path))
@@ -437,8 +437,7 @@ def search_binaries_by_bin_name_and_checksum(bin_name_to_search, bin_checksum_to
437437
result = False
438438
bin_name_without_path = os.path.basename(bin_name_to_search)
439439
for item in final_bin_info:
440-
bin_name_with_path = item.bin_name
441-
bin_name = os.path.basename(bin_name_with_path)
440+
bin_name = os.path.basename(item.bin_name)
442441
checksum = item.checksum
443442
if bin_name == bin_name_without_path and checksum == bin_checksum_to_search:
444443
bin_list_same_names.append(item)
@@ -623,8 +622,7 @@ def remove_duplicated_binaries_by_checking_checksum(remove_list_file):
623622
remove_list, remove_tlsh_list = remove_from_the_list(remove_list_file)
624623

625624
for item in final_bin_info[:]:
626-
bin_name_with_path = item.bin_name
627-
bin_name_to_search = os.path.basename(bin_name_with_path)
625+
bin_name_to_search = os.path.basename(item.bin_name)
628626
bin_checksum = item.checksum
629627
search_key = bin_checksum + bin_name_to_search
630628

@@ -645,7 +643,7 @@ def remove_duplicated_binaries_by_checking_checksum(remove_list_file):
645643
str_bin_removed += f"{row_removed}\n"
646644
continue
647645
elif search_key not in checked_file_name:
648-
find_result, same_name_binaries = search_binaries_by_bin_name_and_checksum(bin_name_with_path,
646+
find_result, same_name_binaries = search_binaries_by_bin_name_and_checksum(item.bin_name,
649647
bin_checksum)
650648
checked_file_name[search_key] = find_result
651649

0 commit comments

Comments
 (0)