Approval logic draft 1
This commit is contained in:
+22
-2
@@ -121,7 +121,7 @@ def menu_prepare_to_enforce():
|
||||
#If the directorys where we're going to store our output dont exist, make them.
|
||||
if not os.path.exists("dataframe_html"): os.makedirs("dataframe_html")
|
||||
if not os.path.exists("dataframe_csv"): os.makedirs("dataframe_csv")
|
||||
if not os.path.exists("approvals"): os.makedirs("approvals")
|
||||
if not os.path.exists("manuallyapproved"): os.makedirs("approvals")
|
||||
|
||||
df_aggregated_combo = pd.DataFrame()
|
||||
while True:
|
||||
@@ -178,13 +178,24 @@ def menu_prepare_to_enforce():
|
||||
else:
|
||||
print(ct.colorText(" [✗] This step has not been completed","red"))
|
||||
|
||||
print(ct.colorText(f"7. Manually review the files \\dataframe_csv\\df_hashes_needing_approval_{first_policy}_{second_policy}.csv and dataframe_csv\\df_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, move both csv files to the directory 'manuallyapproved' and choose this option to combine these approved hashes with the automatically approved hashes", "cyan"))
|
||||
|
||||
if os.path.isfile(f"dataframe_csv\\df_all_approved_hashes_{first_policy}_{second_policy}.csv"):
|
||||
print(ct.colorText(" [✓] This step has been completed","green"))
|
||||
else:
|
||||
print(ct.colorText(" [✗] This step has not been completed","red"))
|
||||
|
||||
"""
|
||||
print(ct.colorText("7. Compare potential path exclusions with allowed hashes", "cyan"))
|
||||
|
||||
if os.path.exists(f"dataframe_csv\\df_allowed_paths_{first_policy}_{second_policy}.csv") == True:
|
||||
print(ct.colorText(" [✓] This step has been completed","green"))
|
||||
else:
|
||||
print(ct.colorText(" [✗] This step has not been completed","red"))
|
||||
|
||||
"""
|
||||
|
||||
print(ct.colorText("Q. Quit", "cyan"))
|
||||
|
||||
@@ -268,6 +279,14 @@ def menu_prepare_to_enforce():
|
||||
else:
|
||||
print(ct.colorText(f"Please Augment your data with hash threat info using step 4 prior to attempting this step","red"))
|
||||
|
||||
elif choice == "7":
|
||||
if os.path.isfile(f"manuallyapproved\\df_hashes_needing_approval_{first_policy}_{second_policy}.csv"):
|
||||
df1 = tryToReadCSV(f"manuallyapproved\\df_hashes_needing_approval_{first_policy}_{second_policy}.csv")
|
||||
df2 = tryToReadCSV(f"manuallyapproved\\df_automatically_approved_hashes_{first_policy}_{second_policy}.csv")
|
||||
df_all_approved_hashes = pd.concat([df1 , df2], ignore_index=True)
|
||||
df_aggregated_combo.to_html(f"dataframe_html\\df_all_approved_hashes_{first_policy}_{second_policy}.html", index=False)
|
||||
df_aggregated_combo.to_csv(f"dataframe_csv\\df_all_approved_hashes_{first_policy}_{second_policy}.csv", index=False)
|
||||
"""
|
||||
elif choice == "7":
|
||||
if os.path.exists(f"dataframe_csv\\df_hashes_needing_approval_{first_policy}_{second_policy}.csv") and os.path.exists(f"dataframe_csv\\df_automatically_approved_hashes_{first_policy}_{second_policy}.csv") and os.path.exists(f"dataframe_csv\\df_unapproved_hashes__{first_policy}_{second_policy}.csv"):
|
||||
allowpaths = utils.allowfunctions.filter_and_drop(pd.read_csv(f"dataframe_csv\\df_automatically_approved_hashes_{first_policy}_{second_policy}.csv"),tryToReadCSV(f"dataframe_csv\\df_path_eligible_{first_policy}_{second_policy}.csv"), path_exclusion_constant)
|
||||
@@ -276,6 +295,7 @@ def menu_prepare_to_enforce():
|
||||
print(ct.colorText(f"Allowable paths determined","green"))
|
||||
else:
|
||||
print(ct.colorText(f"Please complete step 6 prior to attempting this step","red"))
|
||||
"""
|
||||
|
||||
elif choice == "Q":
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user