Netlas.io API package
Project description
Netlas.io Python SDK
This is a Netlas.io Python package with CLI tool.
Please, refer to the documentation to learn where to get an API key and what technical limits exist.
Installation
Installation:
$ pip install netlas
Or if you already have it installed and want to upgrade to the latest version:
$ pip install --upgrade netlas
API usage
The following code sample routes the request port:7001
to the Netlas response search and prints search results to stdout.
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `port:7001`
netlas_query = netlas_connection.query(query="port:7001")
# iterate over data and print: IP address, port, path and protocol
for response in netlas_query['items']:
print(f"{response['data']['ip']}:{response['data']['port']}{response['data']['path']} [{response['data']['protocol']}]")
pass
CLI usage
Show global help:
user@pc:~$ netlas --help
Usage: netlas [OPTIONS] COMMAND [ARGS]...
Options:
-h, --help Show this message and exit.
Commands:
count Calculate count of query results.
download Download data.
host Host (ip or domain) information.
indices Get available data indices.
profile Get user profile data.
query Search query.
savekey Save API key to the local system.
stat Get statistics for query.
Show specific command help:
user@pc:~$ netlas query --help
Usage: python -m netlas query [OPTIONS] QUERYSTRING
Search query.
Options:
-d, --datatype [response|cert|domain|whois-ip|whois-domain]
Query data type [default: response]
-a, --apikey TEXT User API key (can be saved to system using
command `netlas savekey`)
-f, --format [json|yaml] Output format [default: yaml]
--server TEXT Netlas API server [default:
https://app.netlas.io]
--indices TEXT Specify comma-separated data index
collections
-i, --include TEXT Specify comma-separated fields that will be
in the output NOTE: This argument is
mutually exclusive with arguments: [-e,
exclude].
-e, --exclude TEXT Specify comma-separated fields that will be
excluded from the output NOTE: This argument
is mutually exclusive with arguments:
[include, -i].
-p, --page INTEGER Specify data page [default: 0]
-h, --help Show this message and exit.
Bootstraping
You may want to registry your API key.
netlas query savekey YOUR_API_KEY
netlas as now saved your key, you can now use the CLI as such:
netlas query 'THE_QUERY'
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
netlas-0.5.1.tar.gz
(17.8 kB
view details)
Built Distribution
netlas-0.5.1-py3-none-any.whl
(14.8 kB
view details)
File details
Details for the file netlas-0.5.1.tar.gz
.
File metadata
- Download URL: netlas-0.5.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e44f2fdeac5c895ae85408b513251a906663d9bb798949ee1683b02d6b1d10c2 |
|
MD5 | cdf89231d268e6ff1883901c098c32f7 |
|
BLAKE2b-256 | 8ce733ecf5cf63762e180cbed7cf7cbd5e9266289a213bec95695bb231ae3a39 |
File details
Details for the file netlas-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: netlas-0.5.1-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51a2caff718edbfa88e8bee73e0cedabefd8934c0dc039f1c1b64264ee8f7595 |
|
MD5 | 452ac2ce3e4deff7356ff968a4cec9d7 |
|
BLAKE2b-256 | cbafe885ff1a584ab9471bfea5edf51ab7bfe0cdf37d9cb4e98064469e1cf316 |