Skip to content

About

Offline CLI tool to redact PII from text (email, phone, IP, IBAN, URLs)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

PII Redaction Tool (offline)

A small offline command-line tool that redacts common personally identifiable information (PII) from text.

This is a practical baseline for safely sharing:

  • support tickets
  • user reports
  • logs / incident writeups
  • documentation snippets

No API keys. No external services.


What it redacts

  • Emails → [REDACTED_EMAIL]
  • Phone numbers → [REDACTED_PHONE] (conservative patterns)
  • IPv4 addresses → [REDACTED_IP]
  • IBANs → [REDACTED_IBAN]
  • URLs (optional) → [REDACTED_URL]

Quick start

Windows (recommended)

Use the Python Launcher:

py redact.py --in examples/input.txt --print --urls

macOS / Linux

If python3 is available:

python3 redact.py --in examples/input.txt --print --urls

Usage

Read from a file

py redact.py --in examples/input.txt --print --urls

Write output to a file:

py redact.py --in examples/input.txt --out examples/output.txt --urls

Show stats as JSON (printed to stderr):

py redact.py --in examples/input.txt --out examples/output.txt --urls --json-stats

Read from STDIN (pipeline mode)

PowerShell example:

Get-Content -Raw examples/input.txt | py redact.py --stdin --print --urls

Development

Install dev dependencies

py -m pip install -r requirements-dev.txt

Run tests

py -m pytest

GitHub Actions runs the same tests on every push / PR.


Notes / limitations

This is a regex-based baseline:

  • It can miss edge cases (false negatives).
  • It can sometimes redact too much (false positives).

For production hardening you could add:

  • stricter country-specific phone patterns
  • IBAN checksum validation
  • Named Entity Recognition (NER) for names/locations
  • optional LLM-assisted redaction (still keeping secrets out of the repo)

License

MIT

About

Offline CLI tool to redact PII from text (email, phone, IP, IBAN, URLs)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages