Swapped Liftoff out of loop

This commit is contained in:
=
2025-08-28 08:35:39 -04:00
parent 51d56bae4b
commit f94c3e432e
+13 -10
View File
@@ -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,14 +391,15 @@ 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"))