cylance / python-cyapi

This Library provides python bindings to interact with the Cylance API.
20 stars 11 forks source link

Assertion error when running get_all_detection_detail.py #1

Closed jowj closed 4 years ago

jowj commented 4 years ago

Hello,

I receive an assertion error when I try to run the example get_all_detection_detail.py code. The function in which it errors is _generate_urls. Here's the traceback:

Traceback (most recent call last):
  File "verify.py", line 82, in <module>
    devices = API.get_detections()
  File "/Users/jledbetter/.local/share/virtualenvs/secops-cylance-EZOIbYP6/lib/python3.7/site-packages/cyapi/mixins/_Detections.py", line 120, in get_detections
    return self.get_list_items("detections", params=params, **kwargs)
  File "/Users/jledbetter/.local/share/virtualenvs/secops-cylance-EZOIbYP6/lib/python3.7/site-packages/cyapi/cyapi.py", line 360, in get_list_items
    urls = self._generate_urls(type_name, detail=detail, page_size=limit, params=params, total_pages=total_pages)
  File "/Users/jledbetter/.local/share/virtualenvs/secops-cylance-EZOIbYP6/lib/python3.7/site-packages/cyapi/cyapi.py", line 296, in _generate_urls
    assert response.is_success
AssertionError

The response.status_code is 403. Here's the json response:

{'is_success': False, 'data': None, 'errors': {'status': 'ACCESS_DENIED', 'message': 'insufficient privileges'}}

Here's my version of cyapi:

Name: cyapi
Version: 0.9.17
Summary: Python bindings for Cylance Console
Home-page: https://github.com/cylance/python-cyapi
Author: Shane Shellenbarger
Author-email: soggysec@gmail.com
License: MIT

Let me know if I can provide more info! (also, i'm glad this library exists, finally!)

soggysec commented 4 years ago

Thanks for using it! Does your tenant have Optics? If you don't have Optics enabled in your tenant, then that's the error (ACCESS_DENIED) I would expect. Please let me know.

jowj commented 4 years ago

Aaah ok, I misunderstood. I had thought that detection would pull down like a list of the latest threats detected, I guess. No, I don't believe we have Optics enabled.

Thanks for clarifying!