greynoisecli
Typed Python client and command-line interface for the GreyNoise API
Overview
greynoisecli provides library and CLI access to all 68 operations registered from the current GreyNoise API reference. It supports structured queries, JSON request bodies, formatted responses, and streaming downloads without adding an SDK-specific abstraction for every endpoint.
Key Features
| Feature | Description |
|---|---|
| Complete API Surface | 68 registered GreyNoise operations exposed by OpenAPI operationId and CLI name |
| CLI + Library | Use the same endpoint registry from a terminal or Python application |
| Structured Requests | Path parameters, repeatable query values, inline JSON, and @file bodies |
| Multiple Outputs | Automatic output plus JSON, Rich table, and TOON 4.1 formats |
| Streaming Downloads | Stream PCAP, database, and other binary responses directly to disk |
| Atomic Files | Replace output files only after the complete response has been received |
| Typed API | Strictly typed public models and client methods for Python 3.14 |
| Secure Defaults | Verified HTTPS by default, strict JSON handling, and terminal-safe structured output |
Supported Outputs
JSON responses Pretty JSON, Rich tables, TOON 4.1
Text responses Original text
Binary responses Original bytes or streamed files
Library access Parsed JSON values or raw response bytes
Installation
From PyPI (Recommended)
python3.14 -m pip install greynoisecli
From GitHub
python3.14 -m pip install "git+https://github.com/seifreed/greynoisecli.git"
From Source
git clone https://github.com/seifreed/greynoisecli.git
cd greynoisecli
python3.14 -m venv .venv
Activate the environment on Linux or macOS:
source .venv/bin/activate
Or on Windows PowerShell:
.venv\Scripts\Activate.ps1
Then install the package:
python -m pip install -e .
Configuration
Set the API key in the environment.
Linux or macOS:
export GREYNOISE="your-api-key"
Windows PowerShell:
$env:GREYNOISE = "your-api-key"
Alternatively, create greynoise/config.toml below $XDG_CONFIG_HOME,
%APPDATA%, or ~/.config:
[greynoise]
api_key = "your-api-key"
Use GREYNOISE_CONFIG or the global --config option to select another file.
The environment variable takes precedence over the configuration file.
Quick Start
# List every supported operation
greynoise operations
# Query the Community API
greynoise get-community-ip 8.8.8.8
# Query IP context with an optional parameter
greynoise v3-ip 8.8.8.8 --query quick=true
# Run a GNQL query and render a table
greynoise gnql-v3-query \
--query "query=classification:malicious" \
--query size=10 \
--format table
Usage
Command Line Interface
Every OpenAPI operationId is available in kebab case. Path parameters are
positional, query parameters use repeatable --query NAME=VALUE options, and
request bodies use --data with inline JSON or @filename.
# Send a JSON request body
greynoise v3-multi-ip \
--data '{"ips":["8.8.8.8","1.1.1.1"],"quick":true}'
# Export compact TOON for LLM context
greynoise gnql-v3-query \
--query "query=classification:malicious" \
--format toon \
--output results.toon
# Stream a PCAP response
greynoise get-session-pcap SESSION_ID --output capture.pcap
# Select another documented response media type
greynoise post-psychic-model-download \
--accept application/vnd.maxmind.maxmind-db \
--output model.mmdb
Run greynoise COMMAND --help to see an operation's HTTP method, path, and
available options.
Main Options
| Option | Description |
|---|---|
--config FILE |
Read the API key from a specific TOML file |
--timeout SECONDS |
Set the request timeout |
-q, --query NAME=VALUE |
Add a query parameter; repeat for multiple values |
--data JSON|@FILE |
Send an inline or file-backed JSON body |
--format auto|json|table|toon |
Select response formatting |
--accept MEDIA_TYPE |
Override the requested response media type |
-o, --output FILE |
Write the complete response atomically to a file |
Python Library
GreyNoiseClient.call accepts either an OpenAPI operationId or its CLI name,
so every registered operation shares one predictable interface.
from greynoisecli import ResponseOptions, create_client
client = create_client() # GREYNOISE or the configuration file
community = client.call(
"getCommunityIP",
path={"ip": "8.8.8.8"},
)
print(community.json())
results = client.call(
"gnql-v3-query",
query={"query": "classification:malicious", "size": 10},
)
print(results.json())
with open("model.mmdb", "wb") as output:
client.stream(
"postPsychicModelDownload",
ResponseOptions(
accept="application/vnd.maxmind.maxmind-db",
output=output,
),
body={"model": "internet_scanner_intelligence"},
)
Use GreyNoiseClient(api_key="...") when the caller already manages secrets.
For an endpoint added after this package release, GreyNoiseClient.request can
call its HTTP method and path directly.
Development
Install the package and the development dependency group declared in the same
pyproject.toml file:
python3.14 -m pip install -e . --group dev
Run the project gates:
pytest --cov --cov-branch
black --check .
ruff check .
mypy .
bandit -r .
pip-audit
See ARCHITECTURE.md for module responsibilities and the dependency rule.
CI and Releases
CI runs the complete test, quality, and security gates on ubuntu-latest,
windows-latest, and macos-latest. The same matrix must pass before a tagged
release can be built.
Releases are published from tags that match the version in pyproject.toml:
# First update project.version in pyproject.toml and commit it.
git tag -a v0.1.0 -m "greynoisecli 0.1.0"
git push origin v0.1.0
The release workflow builds both the source distribution and wheel, then publishes them to PyPI with OIDC. It does not use a PyPI password or API token.
Before the first release, configure a pending Trusted Publisher in PyPI with:
| Setting | Value |
|---|---|
| PyPI project | greynoisecli |
| Owner | seifreed |
| Repository | greynoisecli |
| Workflow | release.yml |
| Environment | pypi |
Create the matching pypi environment in GitHub and restrict it to release
tags before pushing the first version tag.
Requirements
- Python 3.14
- Windows, Linux, or macOS on x64 or ARM
- A GreyNoise API key for authenticated operations
- See pyproject.toml for the single runtime and development dependency declaration
Contributing
- Fork the repository.
- Create a feature branch:
git switch -c feature/amazing-feature. - Add tests and run every quality and security gate.
- Commit and push the branch.
- Open a pull request.
Support the Project
If this project is useful in your workflows, you can support development:
Attribution
- Author: Marc Rivero Lopez | @seifreed
- Repository: github.com/seifreed/greynoisecli
Built for practical GreyNoise threat-intelligence workflows
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file greynoisecli-0.1.0.tar.gz.
File metadata
- Download URL: greynoisecli-0.1.0.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cd16dce3152cdeb2121ad210a6261390fa6657621d916cfbbb5b9de6d470335
|
|
| MD5 |
9c29e997792d4a6ac9492771bbfbc4d3
|
|
| BLAKE2b-256 |
8a974658c298fed5bfb18d1126b625496d1629d698bde36b281f8b16aecd77db
|
Provenance
The following attestation bundles were made for greynoisecli-0.1.0.tar.gz:
Publisher:
release.yml on seifreed/greynoisecli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
greynoisecli-0.1.0.tar.gz -
Subject digest:
2cd16dce3152cdeb2121ad210a6261390fa6657621d916cfbbb5b9de6d470335 - Sigstore transparency entry: 2795880226
- Sigstore integration time:
-
Permalink:
seifreed/greynoisecli@3e9701888298b43087f63aa4f8963fd07dc3133d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/seifreed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3e9701888298b43087f63aa4f8963fd07dc3133d -
Trigger Event:
push
-
Statement type:
File details
Details for the file greynoisecli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: greynoisecli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
268da726f0b83bd74b3349ec55352461c57254f3dd78c471cd8c228c038e78a9
|
|
| MD5 |
74d390c3f7e8b432ecee50a5f6b869c1
|
|
| BLAKE2b-256 |
54aac8a3e6a7404d322b914928a11882e104ef53127d2e1a7b365d65c676546b
|
Provenance
The following attestation bundles were made for greynoisecli-0.1.0-py3-none-any.whl:
Publisher:
release.yml on seifreed/greynoisecli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
greynoisecli-0.1.0-py3-none-any.whl -
Subject digest:
268da726f0b83bd74b3349ec55352461c57254f3dd78c471cd8c228c038e78a9 - Sigstore transparency entry: 2795880268
- Sigstore integration time:
-
Permalink:
seifreed/greynoisecli@3e9701888298b43087f63aa4f8963fd07dc3133d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/seifreed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3e9701888298b43087f63aa4f8963fd07dc3133d -
Trigger Event:
push
-
Statement type: