Skip to main content

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

PyPI Python License

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

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

redteam_cli-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

redteam_cli-0.1.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

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

Hashes for redteam_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 53099fe60ae55b73898af118d7c33d79b3f159f299a11be921efaee681be2094
MD5 25f806ece1ae811295a3ca483df2cbaf
BLAKE2b-256 0dee15deffdf2b82236d5b3271fa65e9bc1e8a675abe1ba4874bb02d43040730

See more details on using hashes here.

Provenance

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

Publisher: release-pypi.yml on Anbar26/redteam-ai

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

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

Hashes for redteam_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1325d997ef7967882e4c7990bda538de5e48bfe16fc68ccab49df89b5b4ff80
MD5 071e1f546075c186dbc4198d9e2e26b3
BLAKE2b-256 664d132bf0258411caea64007124c67b5b18519eaecc6f7e261f65c08e2b48f9

See more details on using hashes here.

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

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