# Laundromatic

[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-TBD-lightgrey.svg)](LICENSE)
[![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)

**Red team toolkit for testing deepfake detection system robustness.**

Laundromatic applies anti-forensic transformations to images, audio, and video to evaluate how well detection systems perform against adversarial manipulation. It is designed for defensive security research and benchmarking.

## Purpose

This toolkit exists to help detection system developers and security researchers:

- **Test robustness**: Evaluate how detection systems perform against common evasion techniques
- **Benchmark solutions**: Compare vendor solutions under standardised adversarial conditions
- **Identify weaknesses**: Discover vulnerabilities before malicious actors exploit them
- **Improve defences**: Use findings to strengthen detection capabilities

## Intended Users

- Detection system vendors conducting internal red team exercises
- Security researchers evaluating deepfake detection robustness
- Government programmes benchmarking detection solutions (e.g., UK Home Office C581.2)
- Academic researchers studying anti-forensics and detection evasion

## Installation

Requires Python 3.12+.

```bash
# Using UV (recommended)
uv sync
uv run laundromatic --help

# Using pip
pip install laundromatic
laundromatic --help
```

For advanced ML transforms (adversarial perturbations, generative laundering):

```bash
uv sync --extra ml
# or
pip install laundromatic[ml]
```

## Quick Start

```bash
# Apply blur to an image
laundromatic image blur input.jpg output.jpg --strength 2.0

# Compress audio
laundromatic audio compress input.wav output.mp3 --bitrate 128

# Batch process a folder (apply random transforms to 30% of files)
laundromatic batch transform ./input ./output --percent 30
```

### Python API

```python
from laundromatic.transforms.image import blur, add_noise, compress

# Apply transforms programmatically
blurred = blur(image, strength=2.0)
noisy = add_noise(image, sigma=10)
compressed = compress(image, quality=75)
```

## Available Transforms

| Category | Transforms |
|----------|------------|
| **Image** | blur, noise, compression, resize, crop, rotation, colour shift, EXIF manipulation, and more |
| **Audio** | compression, noise injection, speed change, pitch shift, codec transcoding |
| **Video** | frame-level image transforms, recompression, framerate manipulation |

## Documentation

Full documentation: *Coming soon*

## Responsible Use

This toolkit is intended **exclusively for defensive security research, authorised red team exercises, and detection system benchmarking**.

**Do not use this software to:**
- Evade detection for malicious deepfakes
- Spread misinformation or disinformation
- Deceive individuals or organisations
- Violate any applicable laws or regulations

Users are responsible for ensuring their use complies with all applicable laws, regulations, and ethical guidelines. The authors accept no liability for misuse.

## Contributing

Contributions welcome. Please ensure code passes `ruff check .` and `pytest` before submitting.

## License

*License TBD*

---

Built for the UK Home Office Deepfake Detection Challenge (C581.2).
