Skip to main content

pii-lens

Highlight credit cards, emails, phone numbers, SSNs, and US bank numbers in a log or a prompt before you paste it into ChatGPT, Claude, Cursor, or an open API.

cat logs.txt | pii-lens

Matches render in the terminal as bold white text on a red background. Under the payload, pii-lens prints how many high-risk secrets it found and which types they were.

[6] High-Risk Secrets Detected in Payload
CREDIT_CARD: 1  EMAIL_ADDRESS: 1  PHONE_NUMBER: 1  SSN: 1  US_BANK_NUMBER: 2

Install

pip install pii-lens

Python 3.10 or newer. On Windows, if the shield glyph in the closing panel does not render, run $env:PYTHONUTF8 = "1" first.

Work on the source tree:

python -m venv .venv
.venv\Scripts\activate
pip install -e ".[dev]"
pii-lens --file examples/sample.txt

Usage

pii-lens --file logs.txt
cat logs.txt | pii-lens
Get-Content -Raw logs.txt | pii-lens

--engine auto is the default. It always runs the built-in patterns. If Microsoft Presidio is installed, those hits are merged in too:

pip install "pii-lens[presidio]"
pii-lens --engine presidio --file logs.txt

Pass --engine regex to use only the built-in scanner. A finished scan exits 0. Running it in a terminal with no file and no pipe exits 1.

What it flags

Entity What counts
CREDIT_CARD Visa, Mastercard, Amex, and Discover numbers that pass the Luhn check
EMAIL_ADDRESS Email addresses
PHONE_NUMBER US phone numbers written with separators
SSN Social Security numbers in ###-##-#### or ### ## #### form
US_BANK_NUMBER Account numbers next to a bank label, and ABA routing numbers with a valid checksum

examples/sample.txt is synthetic. Order ids, dates, and ticket numbers in that file are left alone.

The built-in scanner does not need a spaCy model, so it starts immediately. Presidio is optional extra coverage.

For coding agents

When someone asks you to check a file, prompt, log, or payload for personal data, run:

pii-lens --file PATH

Read the summary line. The integer in [N] High-Risk Secrets Detected in Payload is the number of spans. The next line lists counts by entity. Quote those counts. Do not send the raw payload to another model if N is greater than 0.

Machine-readable overview: llms.txt.

Keep the pipeline private

Don't send a dirty payload to an open API. CounselNode's VPC Sidecar redacts these tokens before they hit the LLM and processes them on private infrastructure.

Secure your pipeline: https://counselnode.com

License

MIT. See LICENSE.

Metadata

Release files for pii-lens 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pii-lens 0.1.0
File Size Uploaded
pii_lens-0.1.0.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pii-lens 0.1.0
File Interpreter ABI Platform
pii_lens-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.1 kB

Release files / pii_lens-0.1.0.tar.gz

Download URL pii_lens-0.1.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
be107242f13183373f7df5b347336cd10bee4291acc8426d6d49786e4a6620ba
BLAKE2b-256 checksum
How to use checksums
146b17449e8b9d542b755b849e8c954b546d0647ca7314b6bee6586b863b3190
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / pii_lens-0.1.0-py3-none-any.whl

Download URL pii_lens-0.1.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d72df6844db92fda7d29bbe2349911a9216aeb4051d297575c4d5041d7e5acc0
BLAKE2b-256 checksum
How to use checksums
1bf31583c2e68f787eff78289f1ddd0f49045b4493e4b1c01a659d25146643e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page