Skip to main content

Netlas.IO API package

Project description

Netlas.io API Package

This is a Netlas.io API package with CLI tool.

Installation

Before using Python library for Netlas.io, get API key.

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

Simple Netlas API example. Send query port:7001 to retrieve all responses available in Netlas.io with port=7001.

import netlas

out_format = "yaml"
apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
datatype = "response"

netlas_connection = netlas.Netlas(api_key=apikey)
query_res = netlas_connection.query(query="port:7001", datatype=datatype)
print(netlas.helpers.dump_object(data=query_res, format=format))

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
  profile   Get user profile data.
  query     Search query.
  stat      Get statistics for query.

Show specific command help:

user@pc:~$ netlas query --help
Usage: netlas query [OPTIONS] QUERYSTRING

  Search query.

Options:
  -d, --datatype [uri|cert|domain]
                                  Query data type  [default: uri]
  -a, --apikey TEXT               User API key  [required]
  -f, --format [json|yaml]        Output format  [default: yaml]
  -s, --server TEXT               Netlas API server  [default:
                                  https://app.netlas.io]

  -h, --help                      Show this message and exit.

netlas package

class netlas.client.Netlas(api_key: str = '', apibase: str = 'https://app.netlas.io', debug: bool = False)

Bases: object

count(query: str, datatype: str = 'response', indices: str = '')

Calculate total count of query string results

  • Parameters

    • query (str) – Search query string

    • datatype (str*, *optional) – Data type (choises: response, cert, domain), defaults to “response”

    • indices (str*, *optional) – Comma-separated IDs of selected data indices (can be retrieved by indices method), defaults to “”

  • Returns

    JSON object with total count of query string results

  • Return type

    dict

download(query: str, datatype: str = 'response', size: int = 10, indices: str = '')

Download data from Netlas

  • Parameters

    • query (str) – Search query string

    • datatype (str*, *optional) – Data type (choises: response, cert, domain), defaults to “response”

    • size (int*, *optional) – Download documents count, defaults to 10

    • indices (str*, *optional) – Comma-separated IDs of selected data indices (can be retrieved by indices method), defaults to “”

  • Returns

    Iterator of raw data

  • Return type

    Iterator[bytes]

host(host: str, hosttype: str = 'ip', index: str = '')

Get full information about host (ip or domain)

  • Parameters

    • host (str) – IP or domain string

    • hosttype (str*, *optional) – “ip” or “domain”, defaults to “ip”

    • index (str*, *optional) – ID of selected data indices (can be retrieved by indices method), defaults to “”

  • Returns

    JSON object with full information about host

  • Return type

    dict

indices()

Get available data indices

  • Returns

    List of available indices

  • Return type

    list

profile()

Get user profile data

  • Returns

    JSON object with user profile data

  • Return type

    dict

query(query: str, datatype: str = 'response', indices: str = '')

Send search query to Netlas API

  • Parameters

    • query (str) – Search query string

    • datatype (str*, *optional) – Data type (choises: response, cert, domain), defaults to “response”

    • indices (str*, *optional) – Comma-separated IDs of selected data indices (can be retrieved by indices method), defaults to “”

  • Returns

    search query result

  • Return type

    dict

stat(query: str, indices: str = '')

Get statistics of responses query string results

  • Parameters

    • query (str) – Search query string

    • indices (str*, *optional) – Comma-separated IDs of selected data indices (can be retrieved by indices method), defaults to “”

  • Returns

    JSON object with statistics of responses query string results

  • Return type

    dict

Exception

exception netlas.exception.APIError(value)

Bases: Exception

Basic Netlas.io Exception class

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

netlas-0.1.0.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netlas-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file netlas-0.1.0.tar.gz.

File metadata

  • Download URL: netlas-0.1.0.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for netlas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed3771ed4b3a2a3592f2421718e6c57882f2889072d4358c17f8590283b3e283
MD5 b3dccfaae7766e8783a5c04bd0b83bfd
BLAKE2b-256 ac8b63c7fd2ed9e53af9f4a857cdc4cf703d42738f51285da15151da933757d8

See more details on using hashes here.

File details

Details for the file netlas-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: netlas-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for netlas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 505d91593abf2707d8299ce7a79c5e77c22e03a57abb32e7e04818a9d87fe634
MD5 331e6a6223226aec7a13aed0e5786bf0
BLAKE2b-256 b821111f75a205e4790423553af0ab29941a899fb2abd8786e1db9c59884fb6e

See more details on using hashes here.

Supported by

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