Skip to main content

Shodan-style CLI for the SecurityTrails API

Project description

sectra

Shodan-style CLI for the SecurityTrails API.

sectra is a lightweight, command-line client for SecurityTrails. It is built for quick lookups and scripting, with JSON output and optional response caching to save quota.

Features

  • Shodan-style CLI for common SecurityTrails endpoints
  • JSON or pretty output
  • Optional on-disk caching for GET requests
  • Generic request passthrough for any endpoint

Install

pip install sectra

Authentication

Set your API key in the environment:

export SECURITYTRAILS=YOUR_KEY

Or persist it in a config file:

sectra init --key YOUR_KEY

Usage

sectra --help
sectra ping
sectra usage
sectra domain example.com
sectra subdomains example.com
sectra whois example.com
sectra history-dns example.com A
sectra ip-whois 8.8.8.8

Search

sectra domains-search --query "ns = 'ns1.yahoo.com'"
sectra domains-stats --query "ns = 'ns1.yahoo.com'"
sectra ips-search --query "ip:8.8.8.0/24"
sectra ips-stats --query "ip:8.8.8.0/24"
sectra sql-query --query "select * from domains where apex_domain = 'example.com' limit 5"

ASI / V2 APIs

sectra projects
sectra assets-search PROJECT_ID --data '{"query":{"match_all":{}}}'
sectra assets-find PROJECT_ID --params '{"size":10}'
sectra asset PROJECT_ID ASSET_ID
sectra asset-exposures PROJECT_ID ASSET_ID
sectra asset-filters PROJECT_ID
sectra asset-tag-apply PROJECT_ID ASSET_ID critical
sectra asset-tag-remove PROJECT_ID ASSET_ID critical
sectra asset-tags-bulk PROJECT_ID ASSET_ID --data '{"tags":["critical","prod"]}'
sectra project-tags PROJECT_ID
sectra tag-task PROJECT_ID TASK_ID
sectra tags-bulk-assets PROJECT_ID --data '{"tags":["prod"],"asset_ids":["id1","id2"]}'
sectra exposures PROJECT_ID
sectra exposure-assets PROJECT_ID SIGNATURE_ID
sectra static-assets PROJECT_ID
sectra static-assets-bulk PROJECT_ID --data '{"assets":[{"asset_id":"id1","fields":{"note":"owned"}}]}'
sectra company-associated-ips example.com
sectra action-report PROJECT_ID report_type
sectra asi-risks PROJECT_ID
sectra asi-risks-history PROJECT_ID --params '{"page":1}'

Caching

By default, GET responses are cached on disk to reduce repeated API usage.

sectra --cache-ttl 3600 domain example.com
sectra --no-cache domain example.com

Cache location: ~/.cache/sectra (or XDG_CACHE_HOME).

Output formats

sectra --output pretty domain example.com
sectra --output json domain example.com
sectra --output raw domain example.com

Generic request

sectra request GET /domain/example.com
sectra request POST /domains/list --data '{"query":"ns = \'ns1.yahoo.com\'"}'

Configuration

  • Config: ~/.config/sectra/config.json (or XDG_CONFIG_HOME)
  • Cache: ~/.cache/sectra (or XDG_CACHE_HOME)

Development

pip install -e .
sectra --help

License

MIT

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

sectra-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

sectra-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sectra-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for sectra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e4a436e03f3937290114ce025e5d0ae5ccd3884c05f5b1bf8247654931f54cc6
MD5 8256505f442e0e69c3164ccd6a7d35b7
BLAKE2b-256 d5807db442da799f322ece46ac79b6a80b8df9e88fc18dbff052725595672b32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sectra-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for sectra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fde5b365c59f4a8361dc33019a662018db7733f87ab3a248326ef30af1024f23
MD5 41145ca86e08df7591574696c1e1146b
BLAKE2b-256 de3f91962f08d21223761aba666256539d28da0d0c263097934928225e9c5776

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