MemOpt #18

Merged
mysticmomba merged 30 commits from MemOpt into master 2025-09-02 17:53:43 -04:00
Showing only changes of commit 6a06bba3fb - Show all commits
+20 -19
View File
@@ -132,8 +132,8 @@ def menu_prepare_to_enforce():
first_policy = " "
second_policy = " "
parentallowlist = " "
childallowlist = " "
allowlist_parent = " "
allowlist_child = " "
df_aggregated_combo = pd.DataFrame()
#If the directorys where we're going to store our output dont exist, make them.
@@ -231,13 +231,13 @@ def menu_prepare_to_enforce():
print(ct.colorText(" [✗] Preflight hash approval list has not been generated","red"))
print(ct.colorText(f"5. Choose the destination parent and child policy allow list", "cyan"))
if childallowlist == " " and parentallowlist == " ":
if allowlist_child == " " and allowlist_parent== " ":
print(ct.colorText(f" [✗] No policies have been chosen","red"))
elif parentallowlist != " " and childallowlist != " " and parentallowlist is childallowlist:
print(ct.colorText(f" [✓] [✗] Only {parentallowlist} has been selected this is unusual, but potentially valid case, double check before proceeding,", "yellow"))
elif parentallowlist != " " and childallowlist != " " and parentallowlist is not childallowlist:
print(ct.colorText(f" [✓] {parentallowlist} has been selected as Parent Policy","green"))
print(ct.colorText(f" [✓] {childallowlist} has been selected as Child Policy","green"))
elif allowlist_parent != " " and allowlist_child != " " and allowlist_parent is allowlist_child:
print(ct.colorText(f" [✓] [✗] Only {allowlist_parent} has been selected this is unusual, but potentially valid case, double check before proceeding,", "yellow"))
elif allowlist_parent != " " and allowlist_child != " " and allowlist_parent is not allowlist_child:
print(ct.colorText(f" [✓] {allowlist_parent} has been selected as Parent Policy","green"))
print(ct.colorText(f" [✓] {allowlist_child} has been selected as Child Policy","green"))
print(ct.colorText(f"6. Liftoff ------------------------------------------------------", "cyan"))
print(ct.colorText(f" Apply path exclusions according to allowed and approved paths", "cyan"))
@@ -386,13 +386,14 @@ def menu_prepare_to_enforce():
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"))
print(ct.colorText(f"===========================================================================================================================================","yellow"))
print(ct.colorText(f"===========================================================================================================================================","red"))
confirmation = input("This program will now begin to make changes to the Airlock Console. Do you understand and agree to proceed? Type 'I AGREE' to continue: ")
print(ct.colorText(f"===========================================================================================================================================","red"))
print(ct.colorText(f"===========================================================================================================================================","yellow"))
print(ct.colorText(f"===========================================================================================================================================","red"))
print(ct.colorText(f"*******************************************************************************************************************************************","red"))
print(ct.colorText(f"*=========================================================================================================================================*","yellow"))
print(ct.colorText(f"*=========================================================================================================================================*","red"))
print(ct.colorText(f"*-------------This program will now begin to make changes to the Airlock Console. Do you understand and agree to proceed? ----------------*", "yellow"))
print(ct.colorText(f"*=========================================================================================================================================*","red"))
print(ct.colorText(f"*=========================================================================================================================================*","yellow"))
print(ct.colorText(f"*******************************************************************************************************************************************","red"))
confirmation = input(ct.colorText("Type 'I AGREE' to continue: ","white"))
if confirmation.strip().upper() == "I AGREE":
print(ct.colorText("Proceeding with the code...", "yellow"))
@@ -400,11 +401,11 @@ def menu_prepare_to_enforce():
pathexcludelist = pathexclusions['longestcfp'].unique().tolist()
utils.policyfunctions.addPath(allowlist_child,pathexcludelist)
parentallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'KNOWN']['sha256'].tolist()
utils.policyfunctions.addHash(allowlist_parent,parentallowlisthashlist)
allowlist_parenthashlist = allowbyhash[allowbyhash['reputation_status'] == 'KNOWN']['sha256'].tolist()
utils.policyfunctions.addHash(allowlist_parent,allowlist_parenthashlist)
childallowlisthashlist = allowbyhash[allowbyhash['reputation_status'] == 'UNKNOWN']['sha256'].tolist()
utils.policyfunctions.addHash(allowlist_child, childallowlisthashlist)
allowlist_childhashlist = allowbyhash[allowbyhash['reputation_status'] == 'UNKNOWN']['sha256'].tolist()
utils.policyfunctions.addHash(allowlist_child, allowlist_childhashlist)
else:
print(ct.colorText("Operation aborted. You MUST EXPLICITLY AGREE to proceed.", "red"))