Local-first red-team scanner for ML models — runs adversarial, extraction, and prompt-injection attacks on your machine and uploads only the scores.
Project description
redteam-cli
Local-first security scanner for ML models. Runs five adversarial / extraction / prompt-injection attacks against your model on the machine that already has it and uploads only the per-attack scores. The model itself never leaves your environment.
Install
pip install "redteam-cli[torch]" # image classifiers (.pt / .pth / state-dict)
pip install "redteam-cli[onnx]" # ONNX models (boundary + extraction)
pip install "redteam-cli[hf]" # HuggingFace LLMs via hf:org/model
pip install redteam-cli # CLI only (use --dry-run, no attacks)
Usage
export REDTEAM_API_KEY=rtai_…
export REDTEAM_API_URL=https://your-redteam-platform.example.com
# Image classifier (full nn.Module saved with torch.save)
redteam scan --model ./mymodel.pt --type image-classifier \
--input-shape 3,224,224 --num-samples 32
# State-dict only — supply the architecture file
redteam scan --model ./weights.pt --type image-classifier \
--arch ./model.py:MyResNet --input-shape 3,224,224
# ONNX — boundary + extraction (FGSM N/A, no gradients)
redteam scan --model ./mymodel.onnx --type image-classifier --input-shape 3,224,224
# LLM via HuggingFace
redteam scan --model hf:Qwen/Qwen2-7B-Instruct --type llm
# LLM via custom .py adapter
redteam scan --model ./llm_adapter.py --type llm
# Dry-run anything (run locally, print JSON, skip upload)
redteam scan --model ./mymodel.pt --type image-classifier --dry-run
Attacks
| Attack | Model types | What it tests |
|---|---|---|
| FGSM | image-classifier | White-box adversarial robustness (single ε-step gradient sign) |
| Boundary | image-classifier | Black-box decision-boundary fragility (median L2 to flip) |
| Model extraction | image-classifier, tabular | Whether a surrogate trained from queries can clone the model |
| Prompt injection | llm | Canary-leak detection across role-hijack / jailbreak payloads |
| Output manipulation | llm | Refusal-marker matching on disallowed prompts (markers customisable for non-English models) |
Where the results go
This CLI sends results to the redteam-ai platform (FastAPI backend + Next.js dashboard) running either locally via Docker Compose or deployed to your own host. To run the platform yourself:
git clone https://github.com/Anbar26/redteam-ai
cd redteam-ai && docker compose up -d --build
# Visit http://localhost:3000 — sign up to get an API key
Or use --dry-run to skip the upload entirely and just read the JSON.
License
Project details
Release history Release notifications | RSS feed
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 redteam_cli-0.1.0.tar.gz.
File metadata
- Download URL: redteam_cli-0.1.0.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53099fe60ae55b73898af118d7c33d79b3f159f299a11be921efaee681be2094
|
|
| MD5 |
25f806ece1ae811295a3ca483df2cbaf
|
|
| BLAKE2b-256 |
0dee15deffdf2b82236d5b3271fa65e9bc1e8a675abe1ba4874bb02d43040730
|
Provenance
The following attestation bundles were made for redteam_cli-0.1.0.tar.gz:
Publisher:
release-pypi.yml on Anbar26/redteam-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
redteam_cli-0.1.0.tar.gz -
Subject digest:
53099fe60ae55b73898af118d7c33d79b3f159f299a11be921efaee681be2094 - Sigstore transparency entry: 1719523036
- Sigstore integration time:
-
Permalink:
Anbar26/redteam-ai@970995a38a551147dbaa41229f6d68b5a4e3015f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Anbar26
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@970995a38a551147dbaa41229f6d68b5a4e3015f -
Trigger Event:
push
-
Statement type:
File details
Details for the file redteam_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: redteam_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1325d997ef7967882e4c7990bda538de5e48bfe16fc68ccab49df89b5b4ff80
|
|
| MD5 |
071e1f546075c186dbc4198d9e2e26b3
|
|
| BLAKE2b-256 |
664d132bf0258411caea64007124c67b5b18519eaecc6f7e261f65c08e2b48f9
|
Provenance
The following attestation bundles were made for redteam_cli-0.1.0-py3-none-any.whl:
Publisher:
release-pypi.yml on Anbar26/redteam-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
redteam_cli-0.1.0-py3-none-any.whl -
Subject digest:
d1325d997ef7967882e4c7990bda538de5e48bfe16fc68ccab49df89b5b4ff80 - Sigstore transparency entry: 1719523112
- Sigstore integration time:
-
Permalink:
Anbar26/redteam-ai@970995a38a551147dbaa41229f6d68b5a4e3015f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Anbar26
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@970995a38a551147dbaa41229f6d68b5a4e3015f -
Trigger Event:
push
-
Statement type: