Fixed several logic issues / generation of secondary paths. Cleaned up Policy Prep text to be accurate to current functionality. Fixed issue with going back from policy prep menu. Switched to logging.dict from standard logging config.
This commit is contained in:
+18
-27
@@ -184,20 +184,18 @@ def displayIntro():
|
||||
)
|
||||
)
|
||||
|
||||
def section_header(title):
|
||||
print(colorText("\n --------------------------------------------------------------------", "cyan"))
|
||||
print(colorText(f" ------------- {title} -------------", "cyan"))
|
||||
print(colorText(" --------------------------------------------------------------------", "cyan"))
|
||||
|
||||
def printEnforceChecklist(selected_policies, destination_policy, destination_allowlist):
|
||||
working_dir = load_env("WORKING_DIR")
|
||||
|
||||
def section_header(title):
|
||||
print(colorText("\n --------------------------------------------------------------------", "cyan"))
|
||||
print(colorText(f" ------------- {title} -------------", "cyan"))
|
||||
print(colorText(" --------------------------------------------------------------------", "cyan"))
|
||||
|
||||
section_header("🛠️ 🔒 Prepare to Enforce Policy 🛠️ 🔒")
|
||||
print(colorText("\nSequentially follow these steps to prepare a policy for enforcement:", "white"))
|
||||
|
||||
# Step 1: Originating Policies
|
||||
print(colorText("\n1. Choose which originating policy or policies to move to enforcement", "cyan"))
|
||||
print(colorText("\n1. Choose which policy or policies to gather execution info from", "cyan"))
|
||||
if not selected_policies:
|
||||
print(colorText(" [✗] No policies have been chosen", "red"))
|
||||
else:
|
||||
@@ -206,7 +204,7 @@ def printEnforceChecklist(selected_policies, destination_policy, destination_all
|
||||
print(colorText(f" [✓] {policy.name}", "green"))
|
||||
|
||||
# Step 2: Destination Policy and Allowlist
|
||||
print(colorText("2. Choose the destination policy and allowlist", "cyan"))
|
||||
print(colorText("2. Choose the destination policy and associated allowlist", "cyan"))
|
||||
if destination_policy:
|
||||
print(colorText(f" [✓] {destination_policy[0].name} has been selected as the destination policy", "green"))
|
||||
else:
|
||||
@@ -218,7 +216,7 @@ def printEnforceChecklist(selected_policies, destination_policy, destination_all
|
||||
print(colorText(" [✗] No allowlist has been chosen", "red"))
|
||||
|
||||
# Step 3: Data Preparation
|
||||
print(colorText("3. Pull and stage event history, combine the histories, add hash info, then categorize the hashes", "cyan"))
|
||||
print(colorText(f"3. Select to begin pulling execution history. The executions will be sorted and placed in {working_dir}\\data\\Needs_Review", "cyan"))
|
||||
if selected_policies:
|
||||
policy_id = selected_policies[0].name
|
||||
review_path = f"{working_dir}\\Needs_Review\\Review_First\\{policy_id}_approved_executions.csv"
|
||||
@@ -228,15 +226,9 @@ def printEnforceChecklist(selected_policies, destination_policy, destination_all
|
||||
|
||||
# Step 4: Manual Review
|
||||
print(colorText("4. Manually review the files:", "cyan"))
|
||||
if selected_policies:
|
||||
policy_id = selected_policies[0].name
|
||||
print(colorText(f" 'prepare_policy\\needs_approved\\good_hashes.csv' and 'prepare_policy\\needs_approved\\{policy_id}_unknown_hashes.csv'\n", "cyan"))
|
||||
else:
|
||||
print(colorText(" 'prepare_policy\\needs_approved\\good_hashes.csv' and 'prepare_policy\\needs_approved\\<policy>_unknown_hashes.csv'\n", "cyan"))
|
||||
|
||||
print(colorText(" Remove the rows containing hashes you do not approve of...", "cyan"))
|
||||
print(colorText(" When complete, save both csv files to the directory 'approved' and choose this option.", "cyan"))
|
||||
print(colorText(" This will combine these approved hashes with the automatically approved hashes and generate a list of paths to be reviewed", "cyan"))
|
||||
print(colorText(" Remove the rows containing hashes you do not approve of", "cyan"))
|
||||
print(colorText(f" When complete, save both csv files to {working_dir}\\data\\Approved and choose this option.", "cyan"))
|
||||
print(colorText(" This will start the process to generate possible filepath approvals", "cyan"))
|
||||
|
||||
if selected_policies:
|
||||
policy_id = selected_policies[0].name
|
||||
@@ -248,11 +240,10 @@ def printEnforceChecklist(selected_policies, destination_policy, destination_all
|
||||
print(colorText(" [✗] No policies selected, cannot check reviewed hashes or path list", "red"))
|
||||
|
||||
# Step 5: Path Review
|
||||
print(colorText("5. Manually review the files \n 'prepare_policy\\needs_approved\\primary_Paths.csv'\n 'prepare_policy\\needs_approved\\secondary_Paths.csv'", "cyan"))
|
||||
print(colorText(" Remove the rows containing path exclusions you do not approve of...", "cyan"))
|
||||
print(colorText(" When complete, save the csv file to the directory 'approved'", "cyan"))
|
||||
print(colorText(" Do the same process with the list of publishers for the same directories", "cyan"))
|
||||
print(colorText(" Preflight Lists will be generated", "cyan"))
|
||||
print(colorText(f"5. Manually review the files in {working_dir}\\Needs_Review\\Review_Second\\", "cyan"))
|
||||
print(colorText(" Remove the rows containing path exclusions or publishers you do not approve of.", "cyan"))
|
||||
print(colorText(f" When complete, save the files to {working_dir}\\data\\Approved", "cyan"))
|
||||
print(colorText(" Choose this option when done to build your preflights", "cyan"))
|
||||
|
||||
if selected_policies:
|
||||
policy_id = selected_policies[0].name
|
||||
@@ -267,12 +258,12 @@ def printEnforceChecklist(selected_policies, destination_policy, destination_all
|
||||
|
||||
# Final Steps
|
||||
print(colorText("6. Test ------------------------------------------------------", "cyan"))
|
||||
print(colorText(" Print rather than apply selected data.", "cyan"))
|
||||
print(colorText(" Prints to console the changes that would be made, must be done to proceed. ", "cyan"))
|
||||
|
||||
print(colorText("7. Liftoff ------------------------------------------------------", "cyan"))
|
||||
print(colorText(" Apply path exclusions according to allowed and approved paths", "cyan"))
|
||||
print(colorText(" Apply signed or attested hashes to Parent Allow List", "cyan"))
|
||||
print(colorText(" Apply approved, but unsigned hashes to the Child Allow List", "cyan"))
|
||||
print(colorText(" Apply path exclusions and approved publishers to selected policy", "cyan"))
|
||||
print(colorText(" Apply approved hashes to allowlist", "cyan"))
|
||||
|
||||
|
||||
# Utility Options
|
||||
print(colorText("R. Remove/Reset Generated data - will prompt to allow keeping execution history", "cyan"))
|
||||
|
||||
Reference in New Issue
Block a user