Skip to main content

netlascli

netlascli

CLI and Python client library for the Netlas.io API — internet host, domain, WHOIS, and certificate intelligence

Python Version Zero Runtime Dependencies License CI Status

GitHub Stars GitHub Issues Buy Me a Coffee


Overview

netlascli is a Python toolkit for the Netlas API — internet-wide host, domain, WHOIS, certificate, and Discovery data. It provides a typed client library, a full-coverage CLI, and table/JSON/TOON output, built entirely on the Python standard library.

Key Features

Feature Description
Zero runtime dependencies Built on the Python standard library only
Full API coverage Every Netlas API operation exposed as a typed client method and a CLI subcommand
Streaming downloads Large result sets are yielded one document at a time instead of buffered in memory
Table, JSON, or TOON output --format table (default), json, or toon
Typed errors HTTP failures raise typed NetlasAPIError subclasses with status_code and body
Automatic retries HTTP 429 responses are retried automatically
Cross-platform Windows, Linux, and macOS, on x64 and ARM

Supported Outputs

Search/Detail results   table, JSON, TOON
Downloads                NDJSON (stdout or file), streamed

Installation

From PyPI

pip install netlascli

From Source

git clone https://github.com/seifreed/netlascli.git
cd netlascli
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -e ".[dev]"

Quick Start

# Save your API key
netlascli savekey YOUR_API_KEY

# Get a host summary
netlascli host example.com

# Search responses and export as JSON
netlascli responses-search "domain:example.com" --fields ip,port --format json

The API key can also be supplied via the --api-key flag or the NETLAS_API_KEY environment variable instead of netlascli savekey.


Usage

Command Line Interface

netlascli responses-search "domain:example.com" --fields ip,port
netlascli responses-count "domain:example.com"
netlascli domains-search "domain:*.example.com"
netlascli certs-search "domain:example.com"
netlascli indices
netlascli scans
netlascli user

Run netlascli --help or netlascli <command> --help for the full option list.

Available Commands (by category)

Category Commands
Auth savekey
Host host, my-host
Responses responses-search, responses-count, responses-download, responses-facet
Domains domains-search, domains-count, domains-download, domains-facet
IP WHOIS ip-whois-search, ip-whois-count, ip-whois-download, ip-whois-facet
Domain WHOIS domain-whois-search, domain-whois-count, domain-whois-download, domain-whois-facet
Certificates certs-search, certs-count, certs-download
Metadata indices, mapping, facet-mapping
Discovery discovery-node-searches, discovery-node-search, discovery-group-searches, discovery-group-search, discovery-status
Scans scans, scan-create, scanner-agents, scan, scan-update, scan-delete, scan-report, scan-priority, scans-delete
Datastore products, product, product-link
User user, user-update, user-counters

*-search commands have a short alias dropping -search (responses, domains, ip-whois, domain-whois, certs); *-facet commands alias to *-stat (e.g. responses-stat), matching the query/stat naming from the netlas-python CLI. -i/--include FIELDS and -e/--exclude FIELDS are shorthand for --fields FIELDS --source-type include/exclude on search, download, and host commands (mutually exclusive with each other).

Downloads and Discovery group searches show a live progress line on a real terminal (stderr only — never stdout); pass --no-progress to disable it, or redirect stderr to make it disappear automatically in scripts/CI.

Global Flags

Option Description
--api-key API_KEY Netlas API key (overrides saved key and env var)
--base-url BASE_URL Netlas API server URL
--format {table,json,toon} Output format for non-streaming commands (default: table)
--no-progress Disable the progress line for downloads and Discovery group searches

Output Format

Every non-streaming command prints an ASCII table by default:

netlascli indices
netlascli user --format json
netlascli user --format toon

Nested fields are flattened to dotted rows in table view (whois.org: ACME Inc); JSON and TOON preserve the full structure.

Downloading Data

*-download commands stream results to stdout one document per line (NDJSON), so they never hold the full result set in memory:

netlascli responses-download "domain:example.com" --size 1000 --fields ip,port --source-type include
netlascli responses-download "domain:example.com" --all --fields ip,port --source-type include
netlascli responses-download "domain:example.com" --size 500 --output-type csv --fields "*" --source-type include
netlascli responses-download "domain:example.com" --all --fields ip,port --source-type include -o results.ndjson

--size N downloads up to N documents; --all downloads every matching document (it counts first, then downloads — mutually exclusive with --size). -o/--output-file PATH writes to a file instead of stdout (- explicitly means stdout, the default). --format does not apply to download commands — streamed output is always printed as it arrives.


Python Library

Basic Usage

from netlascli import NetlasClient

client = NetlasClient(api_key="YOUR_API_KEY")

host = client.host("example.com")
results = client.search_responses("domain:example.com", fields=["ip", "port"])
count = client.count_responses("domain:example.com")
scans = client.get_scans()

# download_* and download_all_* are generators: documents are yielded as
# they arrive, so the full result set is never held in memory at once.
for document in client.download_responses(
    "domain:example.com", size=1000, fields=["ip", "port"], source_type="include"
):
    ...

for document in client.download_all_responses(
    "domain:example.com", fields=["ip", "port"], source_type="include"
):
    ...

If api_key is omitted, it is resolved from the NETLAS_API_KEY environment variable, then from the key saved by netlascli savekey.

Rendering Results

from netlascli import output

print(output.render(host, "table"))  # or "json" / "toon"

Requirements


Contributing

Contributions are welcome.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support the Project

If this project is useful in your workflows, you can support development:

Buy Me A Coffee

License

This project is licensed under the MIT license. See LICENSE.

Attribution


Built for practical internet-wide reconnaissance and OSINT automation

Download files

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

Source Distribution

netlascli-0.4.0.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

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

netlascli-0.4.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file netlascli-0.4.0.tar.gz.

File metadata

  • Download URL: netlascli-0.4.0.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for netlascli-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b69e4f5648c3eaa17a4c0419aaf1bb2976e9a8da4349034b8883dfaf2917d97a
MD5 c5b24110c3ab7842cbefadc8f4d5f6d3
BLAKE2b-256 4eedc067534f88e721aa2dad5d295337ee3daa48a7f22174a89e86a319d5ad04

See more details on using hashes here.

Provenance

The following attestation bundles were made for netlascli-0.4.0.tar.gz:

Publisher: release.yml on seifreed/netlascli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netlascli-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: netlascli-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for netlascli-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad42d34616a10b6fab1d277304a3feddb73a7af713abf635ae3c8563a6f9703
MD5 8963f9f7ef7f43cd88b2587821562276
BLAKE2b-256 29264852834e5fbc639daa09fc494d354342e0ee2eec144d20188717610d8d65

See more details on using hashes here.

Provenance

The following attestation bundles were made for netlascli-0.4.0-py3-none-any.whl:

Publisher: release.yml on seifreed/netlascli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.1

2 files

Supported by

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