From 4615bb4c569dfd9bc41a96b69d0f33162a43d4f7 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 26 Aug 2025 17:12:06 -0400 Subject: [PATCH] Added Preflights --- AirlockTools.py | 5 ++--- utils/pathfunctions.py | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/AirlockTools.py b/AirlockTools.py index fda1204..876f63b 100644 --- a/AirlockTools.py +++ b/AirlockTools.py @@ -212,8 +212,7 @@ def menu_prepare_to_enforce(): print(ct.colorText(f"4. Manually review the file 'paths_needing_review_{first_policy}_{second_policy}.csv'", "cyan")) print(ct.colorText(" Remove the rows containing path exclusions you do not approve of" , "cyan")) - print(ct.colorText(" When complete, save the csv file to the directory 'manuallyapproved'", "cyan")) - print(ct.colorText(" Preflight Lists will be generated", "cyan")) + print(ct.colorText(" When complete, save the csv file to the directory 'manuallyapproved' and choose this option to generate the preflight lists", "cyan")) if os.path.isfile(f"manuallyapproved\\df_paths_needing_review_{first_policy}_{second_policy}.csv") and os.path.isfile("dataframe_csv\\df_hashdestination_{first_policy}_{second_policy}.csv") and os.path.isfile(f"dataframe_csv\\df_addtochildpolicy_{first_policy}_{second_policy}.csv") and os.path.isfile(f"dataframe_csv\\f_addtobaseline_{first_policy}_{second_policy}.csv"): print(ct.colorText(" [✓] This step has been completed","green")) @@ -422,7 +421,7 @@ def menu_prepare_to_enforce(): parentallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'KNOWN']['target_column'].tolist() utils.policyfunctions.addHash(parentallowlist,parentallowlisthashlist) - childallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'UNKNOWN']['target_column'].tolist() + childallowlisthashlist = allowbyhash[allowbyshash['reputation_status'] == 'UNKNOWN']['target_column'].tolist() utils.policyfunctions.addHash(childallowlist,childallowlisthashlist) else: diff --git a/utils/pathfunctions.py b/utils/pathfunctions.py index 24ea7fa..e3b7ebd 100644 --- a/utils/pathfunctions.py +++ b/utils/pathfunctions.py @@ -113,6 +113,15 @@ def mask_from_csv(df, csv_path, filepath_col): return masked_df, remainder +def filter_and_drop(approved, eligiblepaths, min_hashes): + """ + Filters eligiblepaths to rows where all hashes are in approved, + then drops rows with fewer than min_hashes hashes. + """ + approved_hashes = set(approved['sha256']) + + return path_eligible, path_ineligible + def filter_and_drop(approved, eligiblepaths, min_hashes): """ Filters eligiblepaths to rows where all hashes are in approved,