Skip to main content

SDK to download the Netskope Events

Project description

Netskope SDK

Neskope SDK is Python library for dealing with API's to download the Netskope events.

Installation

Use the package manager pip to install NetskopeSDK.

pip install netskopesdk

Rest sdk Usage to pull the Alert & Events

from netskope_api.iterator.netskope_iterator import NetskopeIterator
from netskope_api.iterator.const import Const
from requests.exceptions import RequestException
import time

# Construct the params dict to pass the authentication details 
params = {
        Const.NSKP_TOKEN : "<REST-API-TOKEN>",
        Const.NSKP_TENANT_HOSTNAME : "<HOSTNAME>",
        # Optional param to pass the proxy hosts.
        Const.NSKP_PROXIES : {"<PROXY-HOSTS>"},
        Const.NSKP_EVENT_TYPE : "<EVENT-TYPE>",
        Const.NSKP_ITERATOR_NAME : "<ITERATOR-NAME>",
        Const.NSKP_USER_AGENT : "<SPLUNK-TENANT-HOSTNAME>"
    
        # To query specific alert pass the NSKP_EVENT_TYPE as "alert" and the alert type.
        # Const.NSKP_EVENT_TYPE : Const.EVENT_TYPE_ALERT,
        # Const.NSKP_ALERT_TYPE : Const.ALERT_TYPE_DLP
    }

DEFAULT_WAIT_TIME = 30
RESULT = "result"
WAIT_TIME = "wait_time"

# Create an Iterator
iterator = NetskopeIterator(params)

# Use the next() iterator to download the logs. 
# Consume the message indefinitely in a loop and ingest the data to SIEM
while True:
    response = (iterator.next())
    try:
        if response:
            data = response.json()
            if RESULT in data and len(data[RESULT]) != 0:
                # processData() 
                # sleep() the thread to avoid constant polling
                if WAIT_TIME in data:
                    time.sleep(data[WAIT_TIME])
                else:
                    time.sleep(DEFAULT_WAIT_TIME)
            else:
                print("No response received from the iterator")
                time.sleep(DEFAULT_WAIT_TIME)
    except Exception as e:
        time.sleep(DEFAULT_WAIT_TIME)
        raise RequestException(e)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netskopesdk-0.0.24.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

netskopesdk-0.0.24-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file netskopesdk-0.0.24.tar.gz.

File metadata

  • Download URL: netskopesdk-0.0.24.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for netskopesdk-0.0.24.tar.gz
Algorithm Hash digest
SHA256 0a97329814b42246b99700b5f353675482b060a6a816b8a6a45e590fb4cd6e1f
MD5 b23900f2dd0f66b444e461053f26c6ff
BLAKE2b-256 4dd94411d957e526865a27c404b43499e199c06677f84ce18745a148e235eb55

See more details on using hashes here.

Provenance

File details

Details for the file netskopesdk-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: netskopesdk-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for netskopesdk-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 8e48f5f3df175af1aaf494ef711472defdd897e9f291989cb11d58d1b205fdad
MD5 7979d23887b7648b137516243a0a1dce
BLAKE2b-256 a0cd2fd3efb9b824cdb8ffbe14e14ea6a68875048d182b0eebf037dfcc011572

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page