Working preflight

This commit is contained in:
brotoskyj
2025-08-28 12:27:15 -04:00
parent 710382ce61
commit 942efd38e8
3 changed files with 33 additions and 9 deletions
+10 -8
View File
@@ -371,17 +371,19 @@ def menu_prepare_to_enforce():
print(ct.colorText(f"Please choose Parent Allowlist","white"))
allowlist_parent_tuple = utils.allowlist.listAllowlists(url)
#print(allowlist_parent_tuple)
allowlist_parent = allowlist_parent_tuple[1][allowlist_parent_tuple[0]]
print(ct.colorText(f"Please choose Child Allowlist","white"))
allowlist_child_tuple = utils.allowlist.listAllowlists(url)
#print(allowlist_child_tuple)
allowlist_child = allowlist_child_tuple[1][allowlist_child_tuple[0]]
elif choice == "6":
if os.path.exists(f"preflight\\final_pathexclusions_{first_policy}_{second_policy}.csv") and os.path.exists(f"preflight\\final_hash_approvals_{first_policy}_{second_policy}.csv") and parentallowlist != " " and childallowlist != " ":
if os.path.exists(f"preflight\\final_path_exclusions_{first_policy}_{second_policy}.csv") and os.path.exists(f"preflight\\final_hash_approvals_{first_policy}_{second_policy}.csv") and allowlist_parent != " " and allowlist_child != " ":
pathexclusions = tryToReadCSV(f"preflight\\final_pathexclusions_{first_policy}_{second_policy}.csv")
pathexclusions = tryToReadCSV(f"preflight\\final_path_exclusions_{first_policy}_{second_policy}.csv")
allowbyhash = tryToReadCSV(f"preflight\\final_hash_approvals_{first_policy}_{second_policy}.csv")
print(ct.colorText(f"===========================================================================================================================================","red"))
@@ -395,14 +397,14 @@ def menu_prepare_to_enforce():
if confirmation.strip().upper() == "I AGREE":
print(ct.colorText("Proceeding with the code...", "yellow"))
pathexcludelist = pathexclusions['longestcfp'].unique().tolist
utils.policyfunctions.addPath(childallowlist,pathexcludelist)
pathexcludelist = pathexclusions['longestcfp'].unique().tolist()
utils.policyfunctions.addPath(allowlist_child,pathexcludelist)
parentallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'KNOWN']['target_column'].tolist()
utils.policyfunctions.addHash(parentallowlist,parentallowlisthashlist)
parentallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'KNOWN']['sha256'].tolist()
utils.policyfunctions.addHash(allowlist_parent,parentallowlisthashlist)
childallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'UNKNOWN']['target_column'].tolist()
utils.policyfunctions.addHash(childallowlist,childallowlisthashlist)
childallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'UNKNOWN']['sha256'].tolist()
utils.policyfunctions.addHash(allowlist_child, childallowlisthashlist)
else:
print(ct.colorText("Operation aborted. You MUST EXPLICITLY AGREE to proceed.", "red"))