Metadata-Version: 2.5
Name: litmus-cli
Version: 0.5.0
Summary: AI provenance inspector and quality-preserving transformation system
Project-URL: Homepage, https://github.com/LastDev-coder/litmus
Project-URL: Repository, https://github.com/LastDev-coder/litmus
Project-URL: Issues, https://github.com/LastDev-coder/litmus/issues
Author: Atanu
License: MIT
License-File: LICENSE
Keywords: ai-detection,c2pa,provenance,unicode,watermark
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Text Processing
Requires-Python: >=3.11
Requires-Dist: pydantic>=2.7
Requires-Dist: typer>=0.12
Provides-Extra: c2pa
Requires-Dist: c2pa-python>=0.5; extra == 'c2pa'
Provides-Extra: code
Requires-Dist: tree-sitter-language-pack>=0.9; extra == 'code'
Requires-Dist: tree-sitter>=0.23; extra == 'code'
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: tree-sitter-language-pack>=0.9; extra == 'dev'
Requires-Dist: tree-sitter>=0.23; extra == 'dev'
Requires-Dist: yara-python>=4.3; extra == 'dev'
Provides-Extra: yara
Requires-Dist: yara-python>=4.3; extra == 'yara'
Description-Content-Type: text/markdown

# litmus

**See what's hiding in your files — and remove it, safely.**

![litmus — a local web app that reveals and removes hidden content from your files](https://raw.githubusercontent.com/LastDev-coder/litmus/main/assets/screenshot.png)

litmus is a private, fully local tool that reveals invisible characters, hidden
file information and content credentials in your documents, code and images —
then strips them out without changing anything you can see. Every clean-up is
checked before it is saved: if a change cannot be confirmed safe, litmus keeps
your original untouched.

- **Check** — see what's hidden: invisible characters, embedded file info, content credentials
- **Clean** — remove it, while what you see stays exactly the same
- **Trust** — nothing is saved unless the result is verified safe
- **Private** — 100% offline; your files never leave your machine

Works with text, source code, PNG, JPEG, GIF, WebP, SVG, BMP, ICO, TIFF,
HEIC / AVIF, PDF and Office files (docx / xlsx / pptx). Cleaning is available
for text, code, PNG, JPEG, GIF, WebP, SVG, PDF and Office files; the other image
types are checked but not changed.

## Install

With [uv](https://docs.astral.sh/uv/) — works even if your system Python is
old or `pip` is missing (the default on macOS):

```bash
uv tool install litmus-cli
litmus serve        # opens the web app in your browser
```

Or with pip, if you already have Python 3.11+:

```bash
pip install litmus-cli          # or: python3 -m pip install litmus-cli
```

Either way the package installs the `litmus` command; see
[Command line](#command-line) below for terminal usage. If `litmus` isn't
found after a uv install, run `uv tool update-shell` once and open a new
terminal.

### Or run from source

```bash
git clone https://github.com/LastDev-coder/litmus
cd litmus
./start.sh          # macOS / Linux
./start.ps1         # Windows (PowerShell)
```

That's the whole setup — it prepares everything and opens the app in your
browser — no Python setup needed if you have
[uv](https://docs.astral.sh/uv/), which fetches everything for you.

## Using the app

1. **Drop a file** onto the page.
2. **Check** shows what's hiding inside, explained in plain language.
3. **Clean** removes it and hands you the cleaned file. Your original is never
   modified.

Pick a cleaning level to control how much is done:

| Level | What it does |
|---|---|
| Minimal | Remove invisible characters only |
| Standard *(default)* | Also normalize unusual spaces, line endings and letterforms |
| Tidy | Also neaten extra blank lines |
| Code-aware | Also remove unused Python imports |

## Command line

Prefer a terminal? After setup, the same features are available as commands:

```bash
source .venv/bin/activate

litmus inspect myfile.txt        # what's hidden? (read-only)
litmus transform myfile.txt      # print the cleaned version
litmus transform myfile.txt --in-place --backup   # save it, keep a .bak
litmus serve                     # open the web app
litmus --help                    # everything else
```

For source-code files, litmus is deliberately strict: it saves a cleaned code
file only when it can verify the program still behaves the same. If it can't
verify, it refuses and tells you why.

## Image security checks

litmus also looks for structural signs that an image hides something harmful,
and gives each file a verdict: **high**, **suspicious** or **none found**.

- Data hidden after the end of the image (for example a PHP web shell
  appended to a JPEG), and file or script signatures inside the image
- Files whose content does not match their extension (a ".jpg" that is a ZIP)
- SVG files with scripts, event handlers, `javascript:` links or risky XML
  entities — the SVG clean removes scripts and handlers, behind a proof that
  the drawing is unchanged
- Images that declare huge dimensions (decompression bombs) and damaged files
- Optional: known-signature scanning with YARA (bundled rules for image
  exploits) or your own local ClamAV

```bash
litmus inspect uploads/ --fail-on-threat suspicious   # CI / batch gate
litmus guard avatar.jpg                               # one JSON verdict; exit 1 = blocked
litmus watch uploads/ --quarantine quarantine/        # scan new files, move high-threat ones
litmus inspect uploads/ --security-report report.html # plain-language report: what, why, what to do
pip install "litmus-cli[yara]"                        # then: --signatures yara
```

From Python, `litmus.scan_upload(data, filename)` returns a verdict before you
save an upload. In the web app, **Export report (PDF)** opens the detailed report
and your browser's print dialog — choose "Save as PDF". **litmus is not an antivirus.** "None found" means none of its
checks matched — it is not proof that a file is safe.

## What litmus won't claim

Honesty is the point of this tool, so two limits are stated up front:

- litmus finds *hidden content* — it does **not** detect statistical AI
  watermarks in plain text (no public tool can), and it never labels a file
  "AI-generated" or "human-written".
- Finding nothing is not proof there is nothing. litmus reports only what it
  can actually verify.

## Privacy

Everything runs on your machine. No accounts, no uploads, no telemetry, no
network access. The web app binds to `127.0.0.1` and analyses files in memory.

## License

[MIT](LICENSE)
