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
Metadata
Release files for greynoisecli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| greynoisecli-0.1.0.tar.gz | 24.0 kB | With provenance | Details for greynoisecli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| greynoisecli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for greynoisecli-0.1.0-py3-none-any.whl |
Total release size: 41.9 kB
Release files / greynoisecli-0.1.0.tar.gz
| Download URL | greynoisecli-0.1.0.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cd16dce3152cdeb2121ad210a6261390fa6657621d916cfbbb5b9de6d470335
|
|
BLAKE2b-256 checksum How to use checksums |
8a974658c298fed5bfb18d1126b625496d1629d698bde36b281f8b16aecd77db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logRelease files / greynoisecli-0.1.0-py3-none-any.whl
| Download URL | greynoisecli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
268da726f0b83bd74b3349ec55352461c57254f3dd78c471cd8c228c038e78a9
|
|
BLAKE2b-256 checksum How to use checksums |
54aac8a3e6a7404d322b914928a11882e104ef53127d2e1a7b365d65c676546b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logSecurity for greynoisecli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for greynoisecli-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.