Continued Colorization, pushed it to utils and colorized other helper scripts
This commit is contained in:
+5
-4
@@ -17,6 +17,7 @@ import requests
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import utils.colortext as ct
|
||||
|
||||
def pullPolicyExechistories(url, choice, policiesnames, outputjson: bool):
|
||||
|
||||
@@ -32,7 +33,7 @@ def pullPolicyExechistories(url, choice, policiesnames, outputjson: bool):
|
||||
for index, item in enumerate(json_response_data['response']['exechistories']):
|
||||
if index == len(json_response_data['response']['exechistories']) -1:
|
||||
checkpoint = item['checkpoint']
|
||||
print(f"Date Greater than 30 Days, Stepping to new Checkpoint. {item['checkpoint']}")
|
||||
print(ct.colorText(f"Date Greater than 30 Days, Stepping to new Checkpoint. {item['checkpoint']}", "blue"))
|
||||
else:
|
||||
if (datetime.date.today() - datetime.timedelta(days=10) > datetime.datetime.strptime(item['datetime'].replace(' +0000 UTC', ''), '%Y-%m-%dT%H:%M:%SZ').date()):
|
||||
pass
|
||||
@@ -57,7 +58,7 @@ def checkpoint_stomper(checkpoint, url, policy, headers):
|
||||
|
||||
def listPolicies(url):
|
||||
endpoint = url + '/v1/group'
|
||||
print("[+] Grabbing All Policies")
|
||||
print(ct.colorText("[+] Grabbing All Policies", "magenta"))
|
||||
payload = {}
|
||||
headers = {
|
||||
"X-APIKey": os.getenv('APIKEY')
|
||||
@@ -67,9 +68,9 @@ def listPolicies(url):
|
||||
policiesnames = []
|
||||
policyids = []
|
||||
for index, list in enumerate(parse_text['response']['groups'], start=1):
|
||||
print(f"{index}. {list['name']}")
|
||||
print(ct.colorText(f"{index}. {list['name']}", "yellow"))
|
||||
policiesnames.append(list['name'])
|
||||
policyids.append(list['groupid'])
|
||||
choice = input("Select Policy Group: ")
|
||||
choice = input(ct.colorText("Select Policy Group: ", "yellow"))
|
||||
choice = int(choice) - 1
|
||||
return choice, policiesnames
|
||||
Reference in New Issue
Block a user