First Draft
This commit is contained in:
@@ -5,9 +5,9 @@ import pandas as pd
|
||||
import utils.pretty as ct
|
||||
|
||||
|
||||
def getDestAllowlistFromClientID(url, clientid="0dcddaf3-d017-4ced-9227-ceeca3117286"):
|
||||
def getDestAllowlistFromClientID(url, clientid):
|
||||
|
||||
#This is dependant on their being an allowlist in the policy with the same name as the policy
|
||||
#This is dependant on their being an allowlist in the policy containing the name "localapproval"
|
||||
|
||||
endpoint = url + '/v1/agent/find'
|
||||
payload = {
|
||||
@@ -22,13 +22,30 @@ def getDestAllowlistFromClientID(url, clientid="0dcddaf3-d017-4ced-9227-ceeca311
|
||||
result = json.loads(response.text)
|
||||
data = pd.DataFrame(result["response"]["agents"])
|
||||
|
||||
policyname = getPolicyName(url,data.loc[0, "groupid"])
|
||||
allowlists = getPolicyAllowlists(url,data.loc[0, "groupid"])
|
||||
|
||||
app_id = allowlists.loc[allowlists['name'] == f'{policyname}', 'applicationid'].values[0]
|
||||
app_id = allowlists.loc[allowlists['name'].str.contains('localapproval', case=False, na=False), 'applicationid'].values[0]
|
||||
|
||||
return app_id
|
||||
|
||||
def getPolicyFromClientID(url, clientid):
|
||||
|
||||
endpoint = url + '/v1/agent/find'
|
||||
payload = {
|
||||
"agentid" : f"{clientid}"
|
||||
}
|
||||
|
||||
headers = {"X-APIKey": os.getenv('APIKEY')}
|
||||
payload = json.dumps(payload)
|
||||
|
||||
|
||||
response = requests.post(endpoint, headers=headers, data=payload, verify=False)
|
||||
result = json.loads(response.text)
|
||||
data = pd.DataFrame(result["response"]["agents"])
|
||||
|
||||
policy = getPolicyName(url,data.loc[0, "groupid"])
|
||||
|
||||
return policy
|
||||
|
||||
def getPolicyAllowlists(url, groupid):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user