-
I'm trying to get detections from CrowdStrike but I get an error. Probably for not defining PARAMS.q (query). What should I do? from falconpy import detects as FalconDetects
falcon = FalconDetects.Detects(creds={
'client_id': CrowdStrike.get('cid'),
'client_secret': CrowdStrike.get('secret')
})
PARAMS = {
'offset': 0,
'limit': 9999,
'sort': 'desc',
'filter': '*',
'q': "*"
}
response = falcon.QueryDetects(parameters=PARAMS)
print(response) response {'status_code': 400, 'headers': {'Content-Encoding': 'gzip', 'Content-Length': '172', 'Content-Type': 'application/json', 'Date': 'Sun, 27 Jun 2021 12:31:28 GMT', 'X-Cs-Region': 'us-1', 'X-Cs-Traceid': 'ae0c3720-914e-4394-be95-dc87bab1f783', 'X-Ratelimit-Limit': '6000', 'X-Ratelimit-Remaining': '5999'}, 'body': {'meta': {'query_time': 0.051385664, 'powered_by': 'msa-api', 'trace_id': 'ae0c3720-914e-4394-be95-dc87bab1f783'}, 'resources': [], 'errors': [{'code': 400, 'message': 'Invalid argument'}]}} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Two issues in your payload.
Try this instead and let us know if you have any problems: from falconpy import detects as FalconDetects
falcon = FalconDetects.Detects(creds={
'client_id': CrowdStrike.get('cid'),
'client_secret': CrowdStrike.get('secret')
})
PARAMS = {
'sort': 'devices.hostname|desc',
}
response = falcon.QueryDetects(parameters=PARAMS)
print(response) |
Beta Was this translation helpful? Give feedback.
-
There appears to be an issue with using 'devices.hostname' for a sort parameter when using this operation. Using the updated code below should work. (We are looking into the issue with the device hostname sort.) Let us know if you are still encountering problems. import json
from falconpy import detects as FalconDetects
with open("config.json", "r") as cred_file:
config = json.loads(cred_file.read())
creds = {
"client_id": config["falcon_client_id"],
"client_secret": config["falcon_client_secret"]
}
falcon = FalconDetects.Detects(creds=creds)
PARAMS = {
'sort': 'first_behavior|asc'
}
response = falcon.QueryDetects(parameters=PARAMS)
print(response) |
Beta Was this translation helpful? Give feedback.
There appears to be an issue with using 'devices.hostname' for a sort parameter when using this operation. Using the updated code below should work. (We are looking into the issue with the device hostname sort.)
Let us know if you are still encountering problems.