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
restsdk Usage
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>",
Const.NSKP_EVENT_TYPE : "<EVENT-TYPE>",
Const.NSKP_ITERATOR_NAME : "<ITERATOR-NAME>"
}
# Create an Iterator
iterator = NetskopeIterator(params)
# To consume the data form the beginning , start the iterator with head()
response = iterator.head()
# To consume the data form the latest timestamp , start the iterator with tail()
response = iterator.tail()
# To consume the data form a specific timestamp , start the iterator with timestmap()
response = iterator.download(<epoc-timestamp>)
# To stream the data use the next() iterator
# 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:
# Ingest the response data to SIEM .
# if( ingestion-fail ):
# User resend
#response = iterator.resend()
else:
print("No response received from the iterator")
# Sleep for desired time and recommended 5 sec
# time.sleep(5)
except Exception as e:
raise RequestException(e)
webtxnsdk Usage
from netskope.api.webtxn.netskope_subscriber import NetskopeSubscriber
from netskope.api.webtxn.const import Const
# Construct the params dict to pass the authentication details
# 1. With complete subscription path example : projects/111111111/locations/us-west1-a/subscriptions/web_txn_sdk_subscription
params = {
Const.NSKP_SUBSCRIPTION_PATH : "<SUBSCRIPTION PATH>",
Const.NSKP_SUBSCRIPTION_KEY : "<PUB-SUB AUTH KEY>"
}
# 2. Without complete subscription path
# (a). Regional subscription
params = {
Const.NSKP_PROJECT_NUMBER : "<PROJECT_NUMBER>",
Const.NSKP_CLOUD_REGION : "<CLOUD_REGION>",
Const.NSKP_SUBSCRIPTION_ID : "<SUBSCRIPTION_ID>",
Const.NSKP_REGIONAL : True,
Const.NSKP_SUBSCRIPTION_KEY : "<PUB-SUB AUTH KEY>"
}
# (b). Zonal subscription
params = {
Const.NSKP_PROJECT_NUMBER : "<PROJECT_NUMBER>",
Const.NSKP_CLOUD_REGION : "<CLOUD_REGION>",
Const.NSKP_SUBSCRIPTION_ID : "<SUBSCRIPTION_ID>",
Const.NSKP_ZONE_ID : "<ZONE_ID>",
Const.NSKP_SUBSCRIPTION_KEY : "<PUB-SUB AUTH KEY>"
}
# Create a Subscriber and collect transaction events
subscriber= NetskopeSubscriber(params)
subscriber.collect_events()
Project details
Release history Release notifications | RSS feed
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.12.tar.gz
(6.7 kB
view details)
Built Distribution
File details
Details for the file netskopesdk-0.0.12.tar.gz
.
File metadata
- Download URL: netskopesdk-0.0.12.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d03317789cb0486613f3954a26536d1028c4c74f58a909a95a33746e47177ecf |
|
MD5 | 54767d21de00aea50c3e70a8d067ccb5 |
|
BLAKE2b-256 | 3d4a00d98528e2d0f1b2903e81973bbfb3d4c866f5b00a380cdd7ea0cf0cd277 |
Provenance
File details
Details for the file netskopesdk-0.0.12-py3-none-any.whl
.
File metadata
- Download URL: netskopesdk-0.0.12-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc7fe81269db6e3a9840a2178ba31efee0bb50b59a4eb753d034dffdc274cd98 |
|
MD5 | 96b62eba4b45ce55168c374f3f45b402 |
|
BLAKE2b-256 | 6dc0dc20d30f4dbb85b2138cc84c33127415a33105ee3c09fff6fcd916456e48 |