MemOpt #18
@@ -3,3 +3,4 @@
|
|||||||
*.csv
|
*.csv
|
||||||
*__pycache__*
|
*__pycache__*
|
||||||
*.parquet
|
*.parquet
|
||||||
|
chunkinator.json
|
||||||
+5
-19
@@ -166,7 +166,7 @@ def menu_prepare_to_enforce():
|
|||||||
print(ct.colorText(f" [✓] {second_policy} has been selected as Policy 2","green"))
|
print(ct.colorText(f" [✓] {second_policy} has been selected as Policy 2","green"))
|
||||||
|
|
||||||
|
|
||||||
print(ct.colorText("2. Pulls and stages event history, combines the histories, adds hash info, then categorizes the hashes", "cyan"))
|
print(ct.colorText("2. Pull and stage event history, combine the histories, add hash info, then categorize the hashes", "cyan"))
|
||||||
|
|
||||||
if os.path.exists(f"parquet\\execution_history_{first_policy}.parquet"):
|
if os.path.exists(f"parquet\\execution_history_{first_policy}.parquet"):
|
||||||
print(ct.colorText(f" [✓] Execution history has been compiled for {first_policy}","green"))
|
print(ct.colorText(f" [✓] Execution history has been compiled for {first_policy}","green"))
|
||||||
@@ -222,7 +222,7 @@ def menu_prepare_to_enforce():
|
|||||||
print(ct.colorText(" [✗] Path review list has not been created","red"))
|
print(ct.colorText(" [✗] Path review list has not been created","red"))
|
||||||
|
|
||||||
|
|
||||||
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 'needs_approved\\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 'approved'", "cyan"))
|
print(ct.colorText(" When complete, save the csv file to the directory 'approved'", "cyan"))
|
||||||
print(ct.colorText(" Preflight Lists will be generated", "cyan"))
|
print(ct.colorText(" Preflight Lists will be generated", "cyan"))
|
||||||
@@ -243,7 +243,7 @@ def menu_prepare_to_enforce():
|
|||||||
print(ct.colorText(" [✗] Preflight hash approval list has not been generated","red"))
|
print(ct.colorText(" [✗] Preflight hash approval list has not been generated","red"))
|
||||||
|
|
||||||
|
|
||||||
print(ct.colorText(f"5. Choose the destination_name policy and parent and child allow list", "cyan"))
|
print(ct.colorText(f"5. Choose the destination policy and parent and child allow list", "cyan"))
|
||||||
if allowlist_child_name == " " and allowlist_parent_name== " ":
|
if allowlist_child_name == " " and allowlist_parent_name== " ":
|
||||||
print(ct.colorText(f" [✗] No allowlists have been chosen","red"))
|
print(ct.colorText(f" [✗] No allowlists have been chosen","red"))
|
||||||
elif allowlist_parent_name != " " and allowlist_child_name != " " and allowlist_parent_name is allowlist_child_name:
|
elif allowlist_parent_name != " " and allowlist_child_name != " " and allowlist_parent_name is allowlist_child_name:
|
||||||
@@ -252,9 +252,9 @@ def menu_prepare_to_enforce():
|
|||||||
print(ct.colorText(f" [✓] {allowlist_parent_name} has been selected as Parent Policy","green"))
|
print(ct.colorText(f" [✓] {allowlist_parent_name} has been selected as Parent Policy","green"))
|
||||||
print(ct.colorText(f" [✓] {allowlist_child_name} has been selected as Child Policy","green"))
|
print(ct.colorText(f" [✓] {allowlist_child_name} has been selected as Child Policy","green"))
|
||||||
if destination_name == " ":
|
if destination_name == " ":
|
||||||
print(ct.colorText(f" [✗] No destination_name policy has been chosen","red"))
|
print(ct.colorText(f" [✗] No destination policy has been chosen","red"))
|
||||||
else:
|
else:
|
||||||
print(ct.colorText(f" [✓] destination_name policy is {destination_name}","green"))
|
print(ct.colorText(f" [✓] destination policy is {destination_name}","green"))
|
||||||
|
|
||||||
print(ct.colorText(f"6. Liftoff ------------------------------------------------------", "cyan"))
|
print(ct.colorText(f"6. Liftoff ------------------------------------------------------", "cyan"))
|
||||||
print(ct.colorText(f" Apply path exclusions according to allowed and approved paths", "cyan"))
|
print(ct.colorText(f" Apply path exclusions according to allowed and approved paths", "cyan"))
|
||||||
@@ -304,14 +304,6 @@ def menu_prepare_to_enforce():
|
|||||||
del exe1
|
del exe1
|
||||||
del executionhist_policy1
|
del executionhist_policy1
|
||||||
|
|
||||||
|
|
||||||
if os.path.exists("chunkinator.json"):
|
|
||||||
os.remove("chunkinator.json")
|
|
||||||
print(f"File 'chunkinator.json' has been deleted.")
|
|
||||||
else:
|
|
||||||
print(f"File 'chunkinator.json' does not exist.")
|
|
||||||
|
|
||||||
|
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
if not os.path.exists(f"parquet\\execution_history_{second_policy}.parquet"):
|
if not os.path.exists(f"parquet\\execution_history_{second_policy}.parquet"):
|
||||||
@@ -331,12 +323,6 @@ def menu_prepare_to_enforce():
|
|||||||
del data2
|
del data2
|
||||||
del exe2
|
del exe2
|
||||||
|
|
||||||
if os.path.exists("chunkinator.json"):
|
|
||||||
os.remove("chunkinator.json")
|
|
||||||
print(f"File 'chunkinator.json' has been deleted.")
|
|
||||||
else:
|
|
||||||
print(f"File 'chunkinator.json' does not exist.")
|
|
||||||
|
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
if not os.path.exists(f"parquet\\combined_hashlist_{first_policy}_{second_policy}.parquet"):
|
if not os.path.exists(f"parquet\\combined_hashlist_{first_policy}_{second_policy}.parquet"):
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -25,6 +25,7 @@ from bson import ObjectId
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
def pullPolicyExechistories(url, policiesnames, days, outputjson: bool):
|
def pullPolicyExechistories(url, policiesnames, days, outputjson: bool):
|
||||||
|
|
||||||
file_path = 'chunkinator.json'
|
file_path = 'chunkinator.json'
|
||||||
|
|
||||||
# Initialize file if it doesn't exist
|
# Initialize file if it doesn't exist
|
||||||
|
|||||||
Reference in New Issue
Block a user