From f94c3e432ea37400bb61f1385a8884225aa0e6e4 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 28 Aug 2025 08:35:39 -0400 Subject: [PATCH] Swapped Liftoff out of loop --- AirlockTools.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/AirlockTools.py b/AirlockTools.py index 2d35e2d..2abcbb7 100644 --- a/AirlockTools.py +++ b/AirlockTools.py @@ -183,10 +183,12 @@ def menu_prepare_to_enforce(): else: print(ct.colorText(f" [✗] Hashes have not been cateogrized", "red")) - print(ct.colorText(f"3. Manually review the files '\\dataframe_csv\\hashes_needing_approval_{first_policy}_{second_policy}.csv' and 'dataframe_csv\\automatically_approved_hashes_{first_policy}_{second_policy}.csv'", "cyan")) + print(ct.colorText(f"3. Manually review the files:","cyan")) + print(ct.colorText(" '\\dataframe_csv\\hashes_needing_approval_{first_policy}_{second_policy}.csv' and 'dataframe_csv\\automatically_approved_hashes_{first_policy}_{second_policy}.csv'", "cyan")) print(ct.colorText(" Remove the rows containing hashes you do not approve of, and those you would not approve of without metarules.", "cyan")) print(ct.colorText(" If metarules need to be created, please make note of them, and remove the row from the csv.", "cyan")) - print(ct.colorText(" When complete, save both csv files to the directory 'manuallyapproved' and choose this option to combine these approved hashes with the automatically approved hashes and generate a list of paths to be reviewed", "cyan")) + print(ct.colorText(" When complete, save both csv files to the directory 'manuallyapproved' and choose this option.","cyan")) + print(ct.colorText(" This will combine these approved hashes with the automatically approved hashes and generate a list of paths to be reviewed", "cyan")) if os.path.exists(f"manuallyapproved\\hashes_needing_approval_{first_policy}_{second_policy}.csv") and os.path.exists(f"manuallyapproved\\automatically_approved_hashes_{first_policy}_{second_policy}.csv"): print(ct.colorText(" [✓] Reviewed hashes have been loaded","green")) @@ -203,7 +205,7 @@ def menu_prepare_to_enforce(): else: print(ct.colorText(" [✗] Longest common filepaths have not been generated","red")) - if os.path.exists(f"dataframe_csv\\lcf_{first_policy}_{second_policy}.csv"): + if os.path.exists(f"dataframe_html\\lcf_needs_appoved_{first_policy}_{second_policy}.html"): print(ct.colorText(" [✓] Path review list created","green")) else: print(ct.colorText(" [✗] Path review list has not been created","red")) @@ -389,15 +391,16 @@ def menu_prepare_to_enforce(): if confirmation.strip().upper() == "I AGREE": print(ct.colorText("Proceeding with the code...", "yellow")) - for _, row in pathexclusions.iterrows(): - utils.policyfunctions.addPath(childpolicy,row['Sha256']) - - for _, row in allowbyhash.iterrows(): - if row['reputation_status'] == 'KNOWN': - utils.policyfunctions.addHash(parentpolicy,row['Sha256']) - else: - utils.policyfunctions.addHash(childpolicy,row['Sha256']) + pathexcludelist = pathexclusions['longestcfp'].unique().tolist + utils.policyfunctions.addPath(childpolicy,pathexcludelist) + + parentpolicyhashlist = allowbyhash[allowbyhash['reputation_status'] == 'KNOWN']['target_column'].tolist() + utils.policyfunctions.addHash(parentpolicy,parentpolicyhashlist) + + childpolicyhashlist = allowbyhash[allowbyhash['reputation_status'] == 'UNKNOWN']['target_column'].tolist() + utils.policyfunctions.addHash(childpolicy,childpolicyhashlist) + else: print(ct.colorText("Operation aborted. You MUST EXPLICITLY AGREE to proceed.", "red")) break