A collection of scripts to easily use the API of OCD Datalake
Project description
____ _ _ _ ____ _ _
| _ \ __ _| |_ __ _| | __ _| | _____ / ___| ___ _ __(_)_ __ | |_ ___
| | | |/ _` | __/ _` | |/ _` | |/ / _ \ \___ \ / __| '__| | '_ \| __/ __|
| |_| | (_| | || (_| | | (_| | < __/ ___) | (__| | | | |_) | |_\__ \
|____/ \__,_|\__\__,_|_|\__,_|_|\_\___| |____/ \___|_| |_| .__/ \__|___/
|_|
datalake
Datalake scripts
How to use
Installation
With Python 3.6+:
$ pip install datalake-scripts
$ pip3 install datalake-scripts
Using as a library
from datalake import Datalake, AtomType, Output
dtl = Datalake(username='username', password='password')
dtl.Threats.lookup(
atom_value='mayoclinic.org',
atom_type=AtomType.DOMAIN,
hashkey_only=False,
output=Output.JSON
)
Using as a CLI
The cli can be used with:
$ ocd-dtl <command> <parameter>
Check ocd-dtl -h for help, including the list of commands available.
You can also use a script directly by using the following command: <script_name> <script_options>.
/!\ Make sure to use utf-8 without BOM when providing a file (-i option)
Environment variables
Authentication
There are two methods of authentication:
- The first one is the use of the username and password. Every request to the API, will then use fresh tokens periodically created with these credentials.
- The second one is the use of a long term token. You can create long term token through the GUI, it can have more restricted permissions than your account. You can create several long term tokens for one account.
In case you don't want to enter credentials for each commands and you are on a secured terminal, set those variables:
OCD_DTL_LONGTERM_TOKENa long term token associated to your Datalake account. Please note that if this variable is set, then the long term token will be used for every request to the Datalake API, even if you set the username and passsword environment variables below. This is important because some endpoints / requests do not accept long term tokens but need fresh tokens (ie a Datalake instance with username and password). Check for the need of fresh tokens in each endpoint description here
or
OCD_DTL_USERNAMEemail address used to login on Datalake API/GUI.OCD_DTL_PASSWORDpassword used to login on Datalake API/GUI.
These last two are independent and one can be used without the other if you wish.
Using a Proxy
You can set up following environment variables :
HTTP_PROXYHTTPS_PROXY
We use the format accepted by the requests python library. See its documenation for other possible kinds of proxy to set up.
Throttling
For throttling the request, those two environment variable can be used:
OCD_DTL_QUOTA_TIMEdefine, in seconds, the time before resetting the requests limit, default is 1 second.OCD_DTL_REQUESTS_PER_QUOTA_TIMEdefine the number of request to do at maximum for the given time, default is 5 queries.
Please don't exceed the quota marked here for each endpoint
Cli parameters
Parameters common and optional for all commands:
--debug display more information for debugging purposes
-e to change the environment {preprod, prod}, default is prod
-o will set the output file as the API gives it.
-q will quiet the verbosity of the program (but still show errors / warnings)
For information about each command and more, please check the documentation directory
Contributing
To develop on this repository, please refer to this file
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datalake-scripts-2.7.4.tar.gz.
File metadata
- Download URL: datalake-scripts-2.7.4.tar.gz
- Upload date:
- Size: 66.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d30c7d3d2764e5328b3a6b946136862b38d79d5b463bdee6782e268034e9066
|
|
| MD5 |
5c670c16d328b0e57d50f6f2daa5080f
|
|
| BLAKE2b-256 |
27ad8dfb7a66c4b3d93c010894b9df235e8d18ee2319a905cd66fd9c8c58adce
|
File details
Details for the file datalake_scripts-2.7.4-py3-none-any.whl.
File metadata
- Download URL: datalake_scripts-2.7.4-py3-none-any.whl
- Upload date:
- Size: 91.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e680f0a1f058b8d85435d2272559c6118cc9ad6ec2bb76738df133a4f2a268d2
|
|
| MD5 |
a36c5b9cdd8aa2054fb261ca7bcf4d49
|
|
| BLAKE2b-256 |
baa8236ba6569af51f3e0ac9931a29db6733e8124344170db6663c0e88f39628
|