Skip to main content

Command-line client for ThreatCluster (`tc`)

Project description

threatcluster-cli

Command-line client for ThreatCluster. Installs the tc command.

Install

Once published to PyPI:

pipx install threatcluster-cli

Until then, install from source:

git clone <this-repo>
pipx install ./tc-testing/cli

See PUBLISHING.md for the PyPI publish flow.

Authenticate

tc auth login

This runs an Auth0 device-code flow and mints a scoped tc_agent_* refresh credential, storing it in your OS keyring (Keychain / SecretService / Credential Manager). On headless systems it falls back to a 0600 file at ~/.config/tc-cli/credentials.

Use

All commands print JSON. Pipe through jq for human reading.

tc threats list --limit 5 | jq '.threats[].title'
tc entities search "lazarus" --type apt_group
tc darkweb ransomware victims --days 7

Cookbook

Worked examples for common analyst / agent flows.

Smart search

tc search merges entity hits and threat clusters into one shape so you don't have to know which sub-command applies.

tc search "Volt Typhoon" --limit 5
tc search lockbit --only entities
tc search cisco --only threats --limit 20

Stdin chaining

Any command that takes an id/identifier accepts - to read ids from stdin. Compose freely:

# IOCs for the top 5 trending threats
tc threats list --limit 5 \
  | jq -r '.threats[].cluster_id' \
  | tc threats iocs - \
  | jq -r '.iocs[]'

# STIX export of every threat tagged "ransomware"
tc threats list --query ransomware --limit 50 \
  | jq -r '.threats[].cluster_id' \
  | tc threats stix -

# Open every CVE in your browser (xdg-open / open)
tc vulns list --severity CRITICAL --limit 5 \
  | jq -r '.cves[].cve_id' \
  | xargs -I{} echo "https://nvd.nist.gov/vuln/detail/{}"

Live feeds (--watch)

Poll an endpoint and emit only new items as NDJSON. Ctrl+C to stop.

# New ransomware victims as they're posted
tc darkweb ransomware victims --watch --interval 60

# Pipe live victims into a Slack webhook
tc darkweb ransomware victims --watch \
  | while read line; do
      echo "$line" | jq -r '"new victim: \(.group): \(.name)"' \
        | curl -X POST -d @- "$SLACK_WEBHOOK_URL"
    done

# Watch new threats matching a keyword
tc threats list --query lockbit --watch --interval 30

Per-session containment for sub-agents

Hand a child process a narrower bearer than your own. The server enforces the subset — the child cannot escalate.

# Read-only sub-agent with a 50-request budget per session
TC_SCOPES=threats:read \
TC_SESSION_ID="$(uuidgen)" \
TC_MAX_REQUESTS=50 \
  tc threats list --limit 5

Auth diagnostics

tc auth status -v        # storage backend, bearer jti, key id
tc auth logout           # hard kill: revokes server-side too
tc auth logout --keep-remote   # local-only clear (you're moving the key)

Shell completion

tc --install-completion bash      # or zsh / fish
exec $SHELL                       # restart your shell
tc thr<TAB>                       # completes to `tc threats`

Environment

Var Purpose
TC_API_URL Override API base (default https://api.threatcluster.io).
TC_REFRESH_TOKEN Refresh credential (overrides keyring + file). For CI only.
TC_SCOPES Comma-separated subset of refresh scopes for the bearer.
TC_PROPAGATE_AUTH Set to 1 to propagate auth env to subprocesses.
TC_DEBUG Set to 1 for verbose stderr (auth headers redacted).

Security notes

  • Refresh credential is never sent on argv (--api-key flag is rejected).
  • Bearer JWTs (15 min ttl) are minted on demand and cached only in memory.
  • The CLI refuses to talk to plaintext http:// URLs except 127.0.0.1/localhost.
  • Auth env vars are scrubbed from subprocess environments unless TC_PROPAGATE_AUTH=1 is set.

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

threatcluster_cli-0.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

threatcluster_cli-0.1.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: threatcluster_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for threatcluster_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2fdec300a48f43cb99f4f52a07a6858910c10801b0862d34a7b8344764e5e87b
MD5 7c01898ca1c51235d522471ad67bd5b2
BLAKE2b-256 03c0a60414f48c6af256e7c553492886ea2c7f7329afd68ddb038a934109742e

See more details on using hashes here.

Provenance

The following attestation bundles were made for threatcluster_cli-0.1.0.tar.gz:

Publisher: publish.yml on Jam0k/threatcluster-cli

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

File details

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

File metadata

File hashes

Hashes for threatcluster_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6931f5a23683a6d0968a65bb0ce16f4c8122c3d1534c5567356634b8f22beb76
MD5 6d37a48a4ce17945b9d6ceaae6e356c7
BLAKE2b-256 4e5b7ee8984c63139619cc59c9b64fe4b00a8534179d6465fdbf3a2eb3705052

See more details on using hashes here.

Provenance

The following attestation bundles were made for threatcluster_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Jam0k/threatcluster-cli

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

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