keyvan/screenshot-guard

Secret scanner with OCR superpowers - finds secrets in code AND screenshots

Maintainers

Package info

github.com/Keyvanhardani/screenshot-guard

Language:Python

pkg:composer/keyvan/screenshot-guard

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

dev-main 2026-01-05 00:52 UTC

This package is auto-updated.

Last update: 2026-03-05 01:11:39 UTC


README

Screenshot Guard

Screenshot Guard

๐Ÿ” Secret Scanner with OCR Superpowers

The first secret scanner that finds secrets in code AND screenshots.

german-ocr
Powered by german-ocr

PyPI version npm version Packagist License

Powered by german-ocr 50+ Patterns OCR Screenshots

๐Ÿšจ The Problem

Developers take screenshots. Screenshots of terminals, dashboards, documentation.

And sometimes those screenshots contain secrets:

๐Ÿ˜ฑ Scenario ๐Ÿ’ธ Impact
AWS keys in terminal output $47,000 cloud bill
API tokens in dashboard screenshots Data breach
"Example" credentials that are actually real Account compromise

Regular secret scanners miss all of this.

๐Ÿ’ก The Solution

Screenshot Guard scans your code AND your images using OCR.

# Install
pip install screenshot-guard[ocr]

# Scan
screenshot-guard scan ./your-project

Text Files PNG JPG GIF WebP BMP

โœจ Features

Feature Description
๐Ÿ” OCR-powered Finds secrets in PNG, JPG, GIF, BMP, WebP images
๐ŸŽฏ 50+ patterns AWS, Azure, GCP, GitHub, Stripe, Slack, and more
๐Ÿ  Local processing No cloud, no data leaves your machine
๐Ÿค– GitHub Action Easy CI/CD integration with SARIF support
๐Ÿช Pre-commit hook Catch secrets before they're committed

๐Ÿ“ฆ Installation

๐Ÿ Python

pip install screenshot-guard[ocr]

๐Ÿ“ฆ Node.js

npm install screenshot-guard

๐Ÿ˜ PHP

composer require keyvan/screenshot-guard

Python Installation Options

Command What's installed
pip install screenshot-guard Text scanning only (no OCR)
pip install screenshot-guard[ocr] + german-ocr with llama.cpp
pip install screenshot-guard[ollama] + german-ocr with Ollama backend

๐Ÿ’ก Note: You don't need to install german-ocr separately - it comes automatically with [ocr]!

โšก Quick Start

๐Ÿ’ป CLI Usage

# Scan current directory
screenshot-guard scan .

# Scan with JSON output
screenshot-guard scan ./src --format json --output report.json

# Only critical and high severity
screenshot-guard scan . --severity high

# Disable OCR (faster, but misses images)
screenshot-guard scan . --no-ocr

# Use Ollama backend for OCR
screenshot-guard scan . --backend ollama

๐Ÿค– GitHub Action

name: Security Scan

on: [push, pull_request]

jobs:
  secrets:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Scan for secrets
        uses: Keyvanhardani/screenshot-guard@v1
        with:
          path: '.'
          severity: 'medium'
          ocr: 'true'
          fail-on-findings: 'true'

๐Ÿช Pre-commit Hook

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/Keyvanhardani/screenshot-guard
    rev: v0.1.0
    hooks:
      - id: screenshot-guard
        args: ['--severity', 'high', '--no-ocr']

๐ŸŽฏ Supported Patterns

Provider Patterns Examples
AWS 5 Access Keys, Secret Keys, Session Tokens
Azure 5 Storage Keys, Connection Strings, SAS Tokens
GCP 5 API Keys, Service Accounts, OAuth Secrets
GitHub 6 PATs, OAuth Tokens, App Private Keys
Slack 2 Bot Tokens, Webhooks
Stripe 2 Secret Keys, Restricted Keys
๐Ÿ” Generic 15+ Passwords, Private Keys, JWTs, Database URLs
# List all patterns
screenshot-guard patterns

๐Ÿ“Š Output Formats

Table (default)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ File             โ”‚ Line โ”‚ Type               โ”‚ Severity โ”‚ Source โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ screenshot.png   โ”‚ 3    โ”‚ AWS Access Key ID  โ”‚ CRITICAL โ”‚ OCR    โ”‚
โ”‚ config.yaml      โ”‚ 12   โ”‚ Database URL       โ”‚ CRITICAL โ”‚ Text   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Export Options

Format Command Use Case
๐Ÿ“‹ JSON --format json CI/CD pipelines
๐Ÿ”’ SARIF --format sarif GitHub Security
๐Ÿ“ Markdown --format markdown Documentation

๐Ÿ”ง OCR Backends

llama.cpp Ollama Cloud

Backend Speed Setup GPU
llamacpp โšก Fast pip install screenshot-guard[ocr] Optional
ollama โšก Fast Requires Ollama Optional
cloud โšกโšก Fastest API key required N/A
# Use specific backend
screenshot-guard scan . --backend llamacpp
screenshot-guard scan . --backend ollama

๐Ÿ”Œ API Usage

๐Ÿ Python
from screenshot_guard import Scanner, SecretDetector, OCREngine

# Initialize
detector = SecretDetector(min_severity="high")
ocr = OCREngine(backend="llamacpp")
scanner = Scanner(detector=detector, ocr_engine=ocr)

# Scan
findings = scanner.scan("./your-project")

for finding in findings:
    print(f"{finding.file_path}:{finding.line_number} - {finding.pattern_name}")
    print(f"  Severity: {finding.severity}")
    print(f"  From OCR: {finding.from_ocr}")
๐Ÿ“ฆ Node.js
const { scan } = require('screenshot-guard');

// Scan a directory
const findings = await scan({
  path: './your-project',
  severity: 'high',
  ocr: true
});

findings.forEach(finding => {
  console.log(`${finding.file}:${finding.line} - ${finding.type}`);
  console.log(`  Severity: ${finding.severity}`);
});
๐Ÿ˜ PHP
use ScreenshotGuard\Client;

$guard = new Client();
$findings = $guard->scan('./your-project', [
    'severity' => 'high'
]);

foreach ($findings as $finding) {
    echo "{$finding['file_path']}:{$finding['line_number']} - {$finding['pattern_name']}\n";
}

๐Ÿ™ˆ Ignoring Files

Create .screenshotguardignore in your project root:

# Ignore test fixtures
tests/fixtures/*

# Ignore vendor
vendor/

# Ignore specific files
docs/example-config.yaml

๐Ÿ˜ฑ Why OCR?

Real examples where OCR would have helped:

Incident Secret Exposed Cost
๐Ÿ“ธ Terminal screenshot in docs AWS Access Key $47,000 cloud bill
๐Ÿ“Š Dashboard screenshot in README "Example" API key (was real) 2 months exposed
๐Ÿ’ฌ Slack screenshot in GitHub issue GitHub token Repository compromised

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md.

๐Ÿ“„ License

Apache 2.0 - see LICENSE

๐Ÿ‘ค Author

Keyvan Hardani

Website GitHub HuggingFace

Made with โค๏ธ for security

โญ Star us on GitHub!