cancel
Showing results for 
Search instead for 
Did you mean: 

SIEM API 10.2 search based on External_EventID

Hi,

Using a case number I can use the SIEM API (caseGetCaseDetail) to retrieve the esmID.

Once I have the esmID I use it as input for ipsGetAlertData which returns the alert data.

I was wondering If it is possible to do a reverse search based on the alert data? Below is a snippet of the data retutned. Would it be possible or is there a call that I could make to retreive the alert data if I used External_EventID=12071295131225806731 ?

"customTypes": [
{ {
"fieldName": "External_EventID",
"formatedValue": "12071295131225806731",
},
}

 

 

1 Reply

Re: SIEM API 10.2 search based on External_EventID

Python Solution, assuming you have made a succesffuly connection and obtained the cookie and xref token which is parsed in the header:

base_url = 'https://{}/rs/esm/v2/'.format(host)
externalID = "12071295104996899169"

method = 'qryExecuteDetail?type=EVENT&reverse=false'
url = base_url+method
params = {"config":{
            "timeRange": "CURRENT_DAY",
            "includeTotal": "false",
            "fields": [{
            "name": "srcIP",            
            },
            ],
             "filters": [{
            "type": "EsmFieldFilter",
            "field": {
                "name": "External_EventID"},
            "operator": "EQUALS",
            "values": [{
                "type": "EsmBasicValue",
                "value": externalID
            }]
            }
            ],
             "limit": 0
            }}
    
data = json.dumps(params)

resp = requests.post(url, data=data,headers=headers,verify=False)
parsed = json.loads(resp.text)
res =  parsed ['resultID']
    
method = "qryGetStatus"
url = base_url+method
params = {"resultID": res}
data = json.dumps(params)
resp = requests.post(url, data=data,headers=headers,verify=False)
parsed = json.loads(resp.text)

while parsed ['complete'] is False:
      resp =requests.post(url,data=data,headers=headers,verify=False)
      parsed = json.loads(resp.text)

method = "qryGetResults?startPos=0&numRows=10&reverse=false"
url = base_url+method
params = {"resultID": res}
data = json.dumps(params)
resp = requests.post(url, data=data,headers=headers,verify=False) 
parsed = json.loads(resp.text)
print (parsed)

How could I go about optimising the code? Especially the while loop that checks if the query has completed. Is there a better way of doing that?

Thanks

More McAfee Tools to Help You
  • Subscription Service Notification (SNS)
  • How-to: Endpoint Removal Tool
  • Support: Endpoint Security
  • eSupport: Policy Orchestrator
  • Community Help Hub

      New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

    • Find Forum FAQs
    • Learn How to Earn Badges
    • Ask for Help
    Go to Community Help

    Join the Community

      Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

    • Get helpful solutions from McAfee experts.
    • Stay connected to product conversations that matter to you.
    • Participate in product groups led by McAfee employees.
    Join the Community
    Join the Community