Added Preflights

This commit is contained in:
=
2025-08-26 17:12:06 -04:00
committed by brotoskyj
parent 337ff99915
commit 4615bb4c56
2 changed files with 11 additions and 3 deletions
+2 -3
View File
@@ -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(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(" 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(" When complete, save the csv file to the directory 'manuallyapproved' and choose this option to generate the preflight lists", "cyan"))
print(ct.colorText(" Preflight Lists will be generated", "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"): 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")) 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() parentallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'KNOWN']['target_column'].tolist()
utils.policyfunctions.addHash(parentallowlist,parentallowlisthashlist) 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) utils.policyfunctions.addHash(childallowlist,childallowlisthashlist)
else: else:
+9
View File
@@ -113,6 +113,15 @@ def mask_from_csv(df, csv_path, filepath_col):
return masked_df, remainder 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): def filter_and_drop(approved, eligiblepaths, min_hashes):
""" """
Filters eligiblepaths to rows where all hashes are in approved, Filters eligiblepaths to rows where all hashes are in approved,