Added OTP Activity Review WIP
This commit is contained in:
@@ -29,44 +29,6 @@ from utils.utils import colorText, get_sanitized_input
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def otp_generate(api: AirlockAPIWrapper):
|
||||
otp_dict = {}
|
||||
agents = selectAgents(api)
|
||||
print(colorText("Would you like to continue with these devices?", "white"))
|
||||
for agent in agents:
|
||||
print(agent.hostname)
|
||||
confirm = Selector.confirm()
|
||||
if agents and confirm:
|
||||
requester = get_sanitized_input("Who is requesting the OTP: ")
|
||||
because = get_sanitized_input("Why/What work are they doing?: ")
|
||||
|
||||
purpose = f"Requester: {requester} - for : {because}"
|
||||
possible_durations = [15, 60, 360, 1440, 10080]
|
||||
|
||||
print(colorText("Please select a duration in minutes: ", "white"))
|
||||
print(
|
||||
colorText(
|
||||
"15 mins, 60 mins, 360 mins(6 Hours), 1440 mins (24 Hours), 10080 mins (7 Days):",
|
||||
"white",
|
||||
)
|
||||
)
|
||||
duration_selected = Selector.select_int(possible_durations)
|
||||
|
||||
if isinstance(duration_selected, list):
|
||||
duration_selected = duration_selected[0] if duration_selected else None
|
||||
|
||||
if duration_selected is not None:
|
||||
for agent in agents:
|
||||
logging.info(f"Querying API for {agent.hostname}")
|
||||
otp_code = api.otp_generate(agent.agentid, duration_selected, purpose)
|
||||
logger.debug(f"Generated OTP for {agent.hostname}: {otp_code}")
|
||||
otp_dict[agent.hostname] = otp_code
|
||||
|
||||
print(colorText("Requested Codes:", "green"))
|
||||
for key, value in otp_dict.items():
|
||||
print(colorText(f"{key} | {value}", "green"))
|
||||
|
||||
|
||||
def otp_activities_by_agent(api: AirlockAPIWrapper):
|
||||
activeagents = api.otp_find_active()
|
||||
awaitingagents = api.otp_find_awaiting()
|
||||
|
||||
Reference in New Issue
Block a user