Working on Policy List Grab #1
+7
-2
@@ -1,6 +1,10 @@
|
||||
import dotenv
|
||||
import os
|
||||
import utils.getdeviceevents
|
||||
import utils.allowlist
|
||||
import urllib3
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
|
||||
dotenv.load_dotenv()
|
||||
@@ -18,12 +22,13 @@ def apivalidation():
|
||||
def menu():
|
||||
print("\n--- Main Menu ---")
|
||||
print("1. Get All Events for Single Device")
|
||||
print("2. Policy Enforcement Readiness")
|
||||
print("3. Get Device with Highest Blocks in 7 Days")
|
||||
print("2. Get Execution Histories for Allow List")
|
||||
while True:
|
||||
choice = input("Enter Menu Item: ")
|
||||
if choice == '1':
|
||||
utils.getdeviceevents.devicehistory(url)
|
||||
if choice == '2':
|
||||
utils.allowlist.allowlistexechistories(url)
|
||||
|
||||
if __name__ == "__main__":
|
||||
apivalidation()
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
import datetime
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
|
||||
def allowlistexechistories(url):
|
||||
endpoint = url + '/v1/group'
|
||||
print("[+] Grabbing All Policies")
|
||||
payload = {}
|
||||
headers = {
|
||||
"X-APIKey": os.getenv('APIKEY')
|
||||
}
|
||||
response = requests.request("POST", endpoint, headers=headers, data=payload, verify=False)
|
||||
parse_text = json.loads(response.text)
|
||||
policiesnames = []
|
||||
policyids = []
|
||||
for index, list in enumerate(parse_text['response']['groups'], start=1):
|
||||
print(f"{index}. {list['name']}")
|
||||
policiesnames.append(list['name'])
|
||||
policyids.append(list['groupid'])
|
||||
choice = input("Select Policy Group: ")
|
||||
choice = int(choice) - 1
|
||||
endpoint = url + '/v1/logging/exechistories'
|
||||
payload_dict = {
|
||||
"type":[1,2,6,7],
|
||||
"policy": [policiesnames[choice]]
|
||||
}
|
||||
payload = json.dumps(payload_dict)
|
||||
print(payload)
|
||||
response = requests.request("POST", endpoint, headers=headers, data=payload, verify=False)
|
||||
parse_text = json.loads(response.text)
|
||||
for item in parse_text['response']['exechistories']:
|
||||
print(item['checkpoint'])
|
||||
Reference in New Issue
Block a user