Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

63 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pixel Detector v2

Detect tracking pixels on healthcare websites that may violate HIPAA. Fast, reliable scans with smart URL handling and enterprise features.

πŸ“Š Why This Matters | πŸ“ˆ Real Results | πŸ₯ Healthcare Analysis | 🏦 For Insurers

🏦 For Cyber Insurers

Purpose-built for insurance workflows. See our comprehensive Adoption Guide and 5-Minute Quick Start.

One-Command Docker Build

# For regular environments
docker build -t pixel-scanner .

# For corporate environments with proxy/SSL inspection
./build-with-proxy.sh

# For AWS Fargate deployment with S3 support
docker build -f Dockerfile.production -t pixel-scanner:fargate .

Integration Examples

⚑ Quick Start

# Install (one-time setup)
git clone https://github.com/minghsuy/pixel-detector-v2.git
cd pixel-detector-v2

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies
uv sync
uv run playwright install chromium

Quick Scan Examples:

# Single domain scan
pixel-detector scan healthcare-site.com

# Test if consent banners actually work (NEW!)
pixel-detector scan healthcare-site.com --test-consent

# With screenshot evidence
pixel-detector scan healthcare-site.com --screenshot

# Batch scan from CSV (custom_id,url columns)
pixel-detector batch portfolio.csv -o results/

# Batch scan from TXT (one domain per line)
pixel-detector batch domains.txt -o results/

# Docker: Single domain
docker run --rm pixel-scanner scan google.com

# Docker: Batch scan
docker run --rm -v $(pwd):/work pixel-scanner batch /work/portfolio.csv -o /work/results

☁️ Cloud Deployment (AWS Fargate / S3)

NEW: Deploy to AWS Fargate for serverless batch processing with S3 integration.

# Run with S3 input/output
docker run --rm \
  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  pixel-scanner:fargate \
  --input-file s3://my-bucket/input/portfolio.csv \
  --output-dir s3://my-bucket/results/ \
  --concurrency 10

See Docker Deployment Guide for complete Fargate setup.

πŸ“Š What It Detects

Tracker HIPAA Risk Why It's Dangerous Our Detection Rate
Meta Pixel πŸ”΄ Critical No BAA available, shares with advertisers 99.9%
Google Analytics πŸ”΄ Critical Links to ad network, no healthcare BAA 99.9%
Google Ads πŸ”΄ Critical Remarketing lists from patient data 99.9%
TikTok Pixel 🟑 High Foreign data sovereignty concerns 99%
LinkedIn Insight 🟑 High B2B targeting using healthcare data 98%
Twitter Pixel 🟑 High Conversion tracking without BAA 98%
Pinterest Tag 🟑 High Shopping behavior tracking 98%
Snapchat Pixel 🟑 High Demographic targeting risks 98%

πŸ›‘οΈ Consent Management Platforms & Testing (NEW!)

We detect 6 major consent management platforms AND test if they actually work:

Platform Market Share Detection Rate Risk Level
OneTrust 40% 99.9% 🟒 Low (Compliance Tool)
Cookiebot 15% 99.9% 🟒 Low (Compliance Tool)
Osano 8% 99% 🟒 Low (Compliance Tool)
TrustArc 7% 99% 🟒 Low (Compliance Tool)
Usercentrics 5% 98% 🟒 Low (Compliance Tool)
Termly 3% 98% 🟒 Low (Compliance Tool)

Why Detection Alone Isn't Enough: Many sites have consent banners installed but they're malfunctioning - tracking still fires before consent or after rejection. This is the compliance GAP that gets companies fined.

🎯 Consent Banner Interaction Testing (Phase 2 - NOW AVAILABLE!)

Use --test-consent flag to automatically test if consent platforms actually work:

# Test consent banner functionality
pixel-detector scan healthcare-site.com --test-consent

What It Tests:

  1. Baseline Test (Dark Patterns): Does tracking fire BEFORE you click anything?

    • βœ… Compliant: No tracking before consent
    • ❌ Violation: Pixels firing before user interaction
  2. Reject All Test (GDPR/CCPA Critical): Does "Reject All" actually block trackers?

    • βœ… Compliant: All tracking stops after rejection
    • ❌ Violation: Tracking continues despite rejection
  3. Accept All Test (Validation): Does tracking work after consent?

    • βœ… Validates our detection is working correctly

Real Results:

  • goodsamsanjose.com: Has Cookiebot, but Google Analytics fires BEFORE consent (Score: 33/100)
  • elcaminohealth.org: Has TrustArc, no pre-consent tracking detected (Score: 33/100, banner issues)

Output Includes:

  • Overall compliance score (0-100)
  • Detailed violation list with severity
  • Platform-specific recommendations
  • Timeline of when each tracker fired
  • Recommended action (APPROVE/REVIEW/DECLINE)

πŸ–ΌοΈ Sample Output

{
  "domain": "example-hospital.com",
  "timestamp": "2025-01-20T14:23:45Z",
  "hipaa_risk": "CRITICAL",
  "pixels_detected": [
    {
      "type": "google_analytics",
      "pixel_id": "GA-123456789",
      "risk_level": "critical",
      "evidence": {
        "network_requests": [
          "https://www.google-analytics.com/collect?v=1&tid=GA-123456789"
        ],
        "cookies_set": ["_ga", "_gid"],
        "global_variables": ["gtag", "dataLayer"]
      },
      "hipaa_concern": "Transmits user data without BAA"
    }
  ],
  "recommendation": "Remove immediately or obtain signed BAA"
}

πŸ’° ROI Calculator

For Healthcare Providers

  • Cost of manual audit: $5,000 - $25,000
  • Cost of Pixel Detector: $0 (open source)
  • Potential fine avoided: $2,100,000
  • ROI: 420x - 2,100x

For Cyber Insurers

  • Traditional assessment: $5,000 per client
  • With Pixel Detector: $0.10 per scan
  • Efficiency gain: 50,000x
  • Claims prevented: 80% reduction

πŸ₯ Real Healthcare Impact

"We found tracking pixels on our patient portal that we didn't even know existed. Removed them before our HHS audit. This tool literally saved us millions."

  • HIPAA Compliance Officer, Major Hospital System

Recent Scan Results (July 2025)

New York Healthcare Systems (Full Analysis):

  • 90% use Google Analytics (9 out of 10 institutions)
  • NYU Langone: βœ… Only major system without tracking
  • Mount Sinai, Montefiore, Northwell, Albany Med, Rochester Regional: ❌ All tracking with Google Analytics

Other Notable Results:

  • Stanford Health Care: ❌ Google Analytics detected
  • Kaiser Permanente: ❌ Google Analytics detected
  • Cedars-Sinai: βœ… Clean (no tracking)
  • Mayo Clinic: βœ… Clean (no tracking)

✨ Features

Detection Capabilities

  • 8 Major Tracking Pixels - All major advertising platforms covered
  • 6 Consent Platforms - OneTrust, Cookiebot, Osano, TrustArc, Usercentrics, Termly
  • Consent Banner Testing - Automated interaction testing to verify compliance (NEW!)
  • 5 Detection Methods - Network, DOM, JavaScript, cookies, and fingerprinting
  • 99%+ Accuracy - Virtually no false positives or negatives
  • Stealth Mode - Avoids bot detection with playwright-stealth
  • Evidence Collection - Screenshots, network logs, timeline events, and technical details

Performance & Reliability

  • 10-second scans - Fast enough for real-time assessments
  • Concurrent batch processing - Scan 100s of sites in minutes
  • Automatic retries - Handles network issues gracefully
  • DNS pre-check - Skips non-existent domains automatically
  • 91% test coverage - Production-ready reliability

Enhanced URL Handling (New!)

  • Smart URL normalization - Handles various input formats automatically
  • Intelligent domain resolution - Finds the best accessible version (www vs non-www, http vs https)
  • Copy-paste artifact cleaning - Removes quotes, markdown syntax, trailing punctuation
  • Subdomain and path support - Works with complex URLs like secure.hospital.com/patient-portal
  • Alternative suggestions - Provides helpful alternatives when domains fail

🐳 Docker Deployment (v2.0 Production Ready!)

Run Pixel Detector at scale with Docker containers:

  • Simple CLI interface: Uses the proven pixel-detector CLI tool
  • CSV batch processing: Supports custom_id,url columns for portfolio analysis
  • Corporate proxy support: Works behind firewalls with SSL inspection
  • Pre-cached dependencies: Handles corporate environments gracefully

Quick Start:

# Build image
./build-with-proxy.sh  # Handles corporate proxies automatically

# Run single scan
docker run --rm pixel-scanner scan google.com

# Run batch scan
docker run --rm -v $(pwd):/work pixel-scanner batch /work/domains.csv -o /work/results

Documentation:

πŸ“¦ Installation

Prerequisites

  • Python 3.11 or higher
  • uv package manager
  • 1GB free disk space (for Chromium)

GitHub Release Artifacts

Pixel Detector is distributed from this repository and its GitHub Releases. It is not currently published on PyPI; pip install pixel-detector is not a supported installation path.

Starting with v2.3.0, each GitHub Release includes a reviewed wheel and source distribution. To install a downloaded wheel:

uv venv
uv pip install ./pixel_detector-2.3.0-py3-none-any.whl
uv run playwright install chromium
uv run pixel-detector --version

Detailed Setup

# 1. Clone the repository
git clone https://github.com/minghsuy/pixel-detector-v2.git
cd pixel-detector-v2

# 2. Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 3. Install dependencies
uv sync

# 4. Install browser
uv run playwright install chromium

# 5. Verify installation
uv run pixel-detector --version
uv run pixel-detector list-detectors

Troubleshooting

Issue: Playwright installation fails

# Try installing with dependencies
uv run playwright install --with-deps chromium

Issue: Permission denied errors

# Run with proper permissions
sudo uv run playwright install chromium

πŸš€ Scanner Features

Feature CLI Scanner (pixel-detector)
Single Domain pixel-detector scan domain.com
Batch TXT pixel-detector batch domains.txt -o results/
Batch CSV pixel-detector batch portfolio.csv -o results/
Speed ⚑ Fast without screenshots (2-3 hrs/1700 domains)
Screenshots βœ… Optional (--screenshot flag)
CSV Support βœ… Yes (custom_id,url columns)
Docker Ready βœ… Fully optimized
Corporate Proxy βœ… Supported with build script
Output Format CSV with timestamps, duration, pipe-separated pixel names

πŸš€ Batch Processing

CSV Input Format

For portfolio analysis with custom tracking:

custom_id,url
COMP001,healthcare-site.com
COMP002,hospital.org

CSV Output Format

Comprehensive results with timing and error tracking:

custom_id,url,domain,scan_status,has_pixel,pixel_count,pixel_names,timestamp,duration_seconds,error
COMP001,healthcare-site.com,healthcare-site.com,success,1,2,google_analytics|meta_pixel,2025-01-21T10:30:45Z,3.45,
COMP002,invalid-url,,rejected,0,0,,2025-01-21T10:30:46Z,0.01,Invalid domain format

Batch Commands

# CSV with custom IDs (portfolio mode)
pixel-detector batch portfolio.csv -o results/ --max-concurrent 10

# TXT file (simple list mode)
pixel-detector batch domains.txt -o results/ --max-concurrent 10

# Docker batch processing
docker run --rm -v $(pwd):/work pixel-scanner batch /work/portfolio.csv -o /work/results

Smart URL Handling

  • Automatic normalization: Cleans URLs, removes protocols, handles variations
  • Invalid domain detection: Flags and reports invalid entries
  • Deduplication: Scans each unique domain only once
  • Error tracking: Captures and reports all failures with reasons

πŸš€ CLI Scanner Usage (With Screenshots)

The pixel-detector CLI provides comprehensive scanning with optional screenshot evidence.

Basic Scanning

# Scan a single domain (NO screenshot by default)
pixel-detector scan healthcare-site.com

# Scan WITH screenshot evidence (slower but provides visual proof)
pixel-detector scan hospital.com --screenshot

# The scanner will automatically:
# - Add https:// if no protocol specified
# - Try www/non-www versions to find the accessible one
# - Clean up copy-paste artifacts (quotes, commas, etc.)
# - Follow redirects to the correct URL

# Scan with custom timeout
pixel-detector scan slow-site.com --timeout 60

Batch Operations

# Batch scan WITHOUT screenshots (faster)
pixel-detector batch sites.txt -o results/

# Batch scan WITH screenshots (slower, creates evidence)
pixel-detector batch sites.txt -o results/ --screenshot

# Scan with more concurrent connections (faster for many sites)
pixel-detector batch large-list.txt --max-concurrent 10

# Scan with custom timeout and retries
pixel-detector batch slow-sites.txt --timeout 60000 --max-retries 5

Advanced Usage

# Python API
from pixel_detector import Scanner

scanner = Scanner()
result = await scanner.scan_domain("hospital.com")

if result.pixels_detected:
    print(f"Found {len(result.pixels_detected)} trackers!")
    for pixel in result.pixels_detected:
        print(f"- {pixel.type}: {pixel.risk_level}")

πŸ”§ Configuration

Performance Tuning

For optimal performance when scanning many sites:

# Increase concurrent scans (default: 5)
pixel-detector batch sites.txt --max-concurrent 20

# For sites with bot protection
pixel-detector batch protected-sites.txt --max-retries 5 --timeout 60000

# Skip health checks for faster scanning (less reliable)
pixel-detector batch sites.txt --no-health-check

Concurrent Scanning Guidelines:

  • 5 concurrent (default): Safe for most systems
  • 10 concurrent: Good for modern machines with 8GB+ RAM
  • 20 concurrent: Maximum recommended, requires 16GB+ RAM
  • Each browser instance uses ~200MB RAM

Environment Variables

# Increase timeout for slow sites
export PIXEL_DETECTOR_TIMEOUT=60000

# Enable debug logging
export PIXEL_DETECTOR_LOG_LEVEL=DEBUG

# Set custom user agent
export PIXEL_DETECTOR_USER_AGENT="Custom Bot 1.0"

Scan Options

Option Description Default
--timeout Page load timeout (ms) 30000
--screenshot Capture screenshots False
--headless Run without browser UI True
--retries Number of retry attempts 3
--max-concurrent Maximum concurrent scans 5

πŸ“š Documentation

πŸ—ΊοΈ Roadmap

βœ… Completed

  • Phase 1: Core detection engine (8 tracking pixels)
  • Phase 1.5: Consent platform detection (6 CMPs)
  • Phase 2: Banner interaction testing ✨ NEW!
  • Phase 3: Performance optimization (5x faster)
  • Testing: 91% code coverage achieved
  • Cloud deployment: Docker/Kubernetes ready

🚧 In Progress

  • REST API development - FastAPI wrapper available
  • Batch consent testing for portfolio analysis
  • Enhanced reporting and dashboards

πŸ“… Planned

  • Real-time monitoring service
  • Historical tracking database
  • Automated compliance report generation
  • Email alerts for violations
  • Integration with GRC platforms
  • Browser extension for manual testing

πŸ“š Documentation

Deployment & Operations

Business & Strategy

Technical Reference

Archive

🀝 Contributing

We welcome contributions! Key areas:

  • Add new pixel detectors
  • Improve detection accuracy
  • Performance optimizations
  • Documentation improvements
  • Bug fixes

See CONTRIBUTING.md for guidelines.

πŸ“ž Support

βš–οΈ Legal

License

MIT License - See LICENSE for details

Disclaimer

This tool is for legitimate security testing and compliance verification only. Users are responsible for obtaining proper authorization before scanning any websites they do not own.

Privacy

Pixel Detector:

  • βœ… Never collects or transmits scanned data
  • βœ… All scanning happens locally
  • βœ… No telemetry or usage tracking
  • βœ… Open source for full transparency

Built with ❀️ for healthcare privacy by the security community

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages