Grammer fixed, redundant code removed

This commit is contained in:
=
2025-09-02 08:20:31 -04:00
parent b91a61fb77
commit d415ad2eba
4 changed files with 8 additions and 21 deletions
+2 -1
View File
@@ -2,4 +2,5 @@
*.html *.html
*.csv *.csv
*__pycache__* *__pycache__*
*.parquet *.parquet
chunkinator.json
+5 -19
View File
@@ -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"))
@@ -303,14 +303,6 @@ def menu_prepare_to_enforce():
del data del data
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()
@@ -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"):
-1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -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