Cleaning up menu, added Move to Audit/Enforcement
This commit is contained in:
+47
-23
@@ -36,14 +36,14 @@ from flows.otp import (
|
||||
otp_activities_by_agent,
|
||||
revoke
|
||||
)
|
||||
|
||||
from services.agenthandler import findAgents
|
||||
from utils.selector import Selector
|
||||
from services.agenthandler import findAgents, selectAgents, moveAgentToRelatedPolicy
|
||||
from services.API import AirlockAPIWrapper
|
||||
from utils.configmanager import load_env
|
||||
from utils.utils import (
|
||||
areYouSure,
|
||||
colorText,
|
||||
displayIntro,
|
||||
load_env,
|
||||
open_directory,
|
||||
printEnforceChecklist,
|
||||
)
|
||||
@@ -59,34 +59,30 @@ def menu_main(api: AirlockAPIWrapper):
|
||||
while True:
|
||||
displayIntro()
|
||||
# Add Settings, and give option to change working dir
|
||||
print(colorText("1. ➡️ - Move Device(s) to local approval", "yellow"))
|
||||
print(colorText("1. ✅ - Move Device(s) to local approval", "yellow"))
|
||||
print(colorText("2. 🎫 - OTP", "yellow"))
|
||||
print(colorText("3. 🔍 - Device Search", "yellow"))
|
||||
print(colorText("4. 🔇 - Find Quiet Hosts", "yellow"))
|
||||
print(colorText("5. 🔒 - Prepare Policy For Enforcement", "yellow"))
|
||||
print(colorText("6. 🔄 - Update Audit Policies from Enforcement Policies", "yellow"))
|
||||
print(colorText("F. 📂 - Open Working Directory", "yellow"))
|
||||
print(colorText("S. 🛠️ - Settings", "yellow"))
|
||||
print(colorText("Q. 🔚 - Quit", "yellow"))
|
||||
print(colorText("3. 🔄 - Move to Audit/Enforcement", "yellow"))
|
||||
print(colorText("4. 🔍 - Device Search", "yellow"))
|
||||
print(colorText("5. 🛡️ - Policy Enforcement Tools", "yellow"))
|
||||
|
||||
|
||||
choice = input(colorText("\nEnter Menu Item: ", "white"))
|
||||
if choice == "1":
|
||||
la.moveToLocalApproval(api)
|
||||
print("This Feature is still in development")
|
||||
input("Press enter to continue")
|
||||
elif choice == "2":
|
||||
menu_otp(api)
|
||||
elif choice == "3":
|
||||
|
||||
findAgents(api,False)
|
||||
choices = ["audit", "enforcement"]
|
||||
direction = Selector.select_string(choices, False, False)
|
||||
devices = selectAgents(api)
|
||||
if direction and devices:
|
||||
for device in devices:
|
||||
moveAgentToRelatedPolicy(api,device, direction[0])
|
||||
elif choice == "4":
|
||||
findQuietAgents(api)
|
||||
findAgents(api,False)
|
||||
elif choice == "5":
|
||||
menu_policy_enforce(api)
|
||||
elif choice == "6":
|
||||
areYouSure()
|
||||
confirmation = input(colorText("Type 'I AGREE' to continue: ", "white"))
|
||||
if confirmation.strip().upper() == "I AGREE":
|
||||
policyh.updateAuditPoliciesFromEnforcementPolices(api)
|
||||
|
||||
menu_policymanagment(api)
|
||||
elif choice == "F":
|
||||
open_directory(working_dir)
|
||||
elif choice == "S":
|
||||
@@ -97,6 +93,7 @@ def menu_main(api: AirlockAPIWrapper):
|
||||
print(colorText("Invalid choice. Please try again.", "red"))
|
||||
|
||||
|
||||
|
||||
def menu_policy_enforce(api: AirlockAPIWrapper):
|
||||
selected_policies = []
|
||||
destination_policy = []
|
||||
@@ -273,8 +270,35 @@ def menu_otp(api: AirlockAPIWrapper):
|
||||
elif choice == "Q":
|
||||
break
|
||||
|
||||
def menu_policymanagment(api: AirlockAPIWrapper):
|
||||
working_dir = load_env("WORKING_DIR")
|
||||
while True:
|
||||
print(colorText("1. 🔇 - Find Quiet Hosts", "yellow"))
|
||||
print(colorText("2. 🔒 - Prepare Policy For Enforcement", "yellow"))
|
||||
print(colorText("3. 🔄 - Update Audit Policies from Enforcement Policies", "yellow"))
|
||||
print(colorText("F. 📂 - Open Working Directory", "yellow"))
|
||||
print(colorText("S. 🛠️ - Settings", "yellow"))
|
||||
print(colorText("Q. 🔚 - Quit", "yellow"))
|
||||
|
||||
choice = input(colorText("\nEnter Menu Item: ", "white"))
|
||||
if choice == "1":
|
||||
findQuietAgents(api)
|
||||
elif choice == "2":
|
||||
menu_policy_enforce(api)
|
||||
elif choice == "3":
|
||||
areYouSure()
|
||||
confirmation = input(colorText("Type 'I AGREE' to continue: ", "white"))
|
||||
if confirmation.strip().upper() == "I AGREE":
|
||||
policyh.updateAuditPoliciesFromEnforcementPolices(api)
|
||||
|
||||
|
||||
elif choice == "F":
|
||||
open_directory(working_dir)
|
||||
elif choice == "S":
|
||||
menu_settings()
|
||||
elif choice == "Q":
|
||||
break
|
||||
else:
|
||||
print(colorText("Invalid choice. Please try again.", "red"))
|
||||
def menu_settings():
|
||||
while True:
|
||||
print(colorText("\n--- 🛠️ Settings Submenu 🛠️ ---", "cyan"))
|
||||
|
||||
Reference in New Issue
Block a user