2pac / README.md
Richard Young
Restore personal elements: Tupac image and Jeff Young memorial
c8c4e95
metadata
title: 2PAC Picture Analyzer & Corruption Killer
emoji: πŸ”«
colorFrom: purple
colorTo: blue
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: mit
tags:
  - steganography
  - image-forensics
  - security
  - computer-vision
  - cryptography
2PAC Coding

πŸ”« 2PAC: Picture Analyzer & Corruption Killer

Advanced image security, steganography, and forensic analysis toolkit

"All Eyez On Your Images" πŸ‘οΈ

Hide secret messages in plain sight, detect hidden data in suspicious images, and validate image integrityβ€”all in one powerful, easy-to-use interface.

GitHub License Gradio


🎯 What Can You Do?

πŸ”’ Hide Secret Data in Images

Invisibly embed text messages inside images using military-grade LSB (Least Significant Bit) steganography:

  • Invisible to the Eye: Changes are imperceptibleβ€”modified images look identical to originals
  • High Capacity: Hide hundreds to thousands of characters depending on image size
  • Password Protection: Optional AES-256-equivalent encryption for sensitive data
  • Adjustable Strength: 1-4 bits per channel (1-2 bits = undetectable, 3-4 bits = maximum capacity)
  • Lossless Format: PNG output preserves hidden data perfectly

Use Cases:

  • Securely share passwords or private keys through public channels
  • Watermark images with ownership information
  • Embed metadata that survives image sharing platforms
  • Communicate covertly (digital dead drops)
  • CTF competitions and security challenges

πŸ” Detect & Extract Hidden Data

Advanced steganography detection powered by RAT Finder forensic technology:

Detection Methods:

  • 🎨 ELA (Error Level Analysis): Highlights compression artifacts and manipulated regions
  • πŸ“Š LSB Pattern Analysis: Detects non-random patterns in least significant bits using chi-square tests
  • πŸ“ˆ Histogram Forensics: Identifies statistical anomalies in color distribution
  • πŸ“ Metadata Inspection: Examines EXIF/XMP data for steganography tools
  • πŸ“ File Structure Analysis: Checks for trailing data after image EOF markers
  • πŸ”¬ Visual Noise Analysis: Detects abnormal channel-specific noise patterns

Extraction:

  • Recover Hidden Messages: Extract data hidden using this tool's LSB method
  • Password Support: Decrypt password-protected messages
  • Adjustable LSB Depth: Try different bit depths (1-4) to recover data

Use Cases:

  • Forensic investigation of suspect images
  • Counter-intelligence and threat detection
  • Academic research in steganography
  • Validate if received images contain hidden communications
  • Educational demonstrations of steganalysis techniques

πŸ›‘οΈ Check Image Integrity & Corruption

Comprehensive image validation and corruption detection:

  • Format Support: JPEG, PNG, GIF, TIFF, BMP, WebP, HEIC, AVIF
  • Header Validation: Verifies file signatures and structure
  • Completeness Checks: Detects truncated or incomplete files
  • Visual Corruption Detection: Identifies black regions, gray blocks, and pixel noise
  • JPEG Structure Analysis: Validates markers, segments, and EOI
  • Adjustable Sensitivity: Low/Medium/High thoroughness levels

Use Cases:

  • Validate photo archives before long-term storage
  • Check downloaded images for corruption
  • Quality control for image processing pipelines
  • Detect damaged files in recovered data
  • Pre-screen images before importing to databases

πŸ§ͺ How It Works

LSB Steganography Explained

The tool exploits a fundamental property of digital images: the human eye cannot detect 1-2 bit changes in pixel values.

Technical Process:

  1. Bit Extraction: Each RGB pixel has 3 bytes (24 bits). We use the least significant 1-4 bits of each byte.

    Original pixel: RGB(156, 89, 201)
    Binary:         10011100, 01011001, 11001001
                            ↑         ↑         ↑
                     These last bits can be modified!
    
  2. Data Encoding: Your text is encrypted (if password provided), then converted to binary and embedded

  3. Checksum Protection: MD5 hash ensures data integrity during extraction

  4. Capacity Calculation:

    Capacity = (Width Γ— Height Γ— 3 channels Γ— Bits-per-channel) / 8
    
    Example: 1920Γ—1080 image with 2 bits/channel
    = 1920 Γ— 1080 Γ— 3 Γ— 2 / 8 = 1,555,200 bytes (~1.5 MB!)
    

Why PNG? JPEG uses lossy compression that destroys LSB data. PNG is lossless and preserves every bit.


Steganography Detection Science

1. Error Level Analysis (ELA)

Re-compresses JPEG images at a known quality level and computes pixel-wise differences:

  • Natural images: Uniform error levels
  • Manipulated areas: Different error levels (bright spots)
  • Hidden data: Can alter compression behavior detectably

2. LSB Statistical Analysis

Performs chi-square tests on bit distributions:

  • Natural images: LSBs follow expected distributions
  • Embedded data: LSBs become statistically "too random"

3. Histogram Analysis

Analyzes color frequency distributions:

  • Natural images: Smooth, continuous gradients
  • Steganography: Introduces micro-patterns and color pair artifacts

πŸ“– Quick Start Guide

πŸ”’ Hiding Data

  1. Upload a PNG image (JPEG works but won't survive re-saving)
  2. Enter your secret message
  3. (Optional) Set a strong password for encryption
  4. Choose LSB depth:
    • 1 bit = Undetectable (best for security)
    • 2 bits = Good balance
    • 3-4 bits = Maximum capacity
  5. Download the output PNG

⚠️ Critical: Never edit, crop, or re-save the output image (except as PNG)!

πŸ” Detecting Hidden Data

  1. Upload suspicious image
  2. Adjust sensitivity (higher = more thorough but more false positives)
  3. Review confidence score and analysis breakdown
  4. Check ELA visualization (bright = suspicious)

Confidence Interpretation:

  • 70-100% = High suspicion
  • 40-69% = Moderate
  • 0-39% = Low (likely clean)

πŸ›‘οΈ Checking Corruption

  1. Upload image to validate
  2. Enable "Visual Corruption Check" for damaged photos
  3. Adjust sensitivity (Low/Medium/High)
  4. Review diagnostic results

πŸ” Security & Privacy

  • βœ… No Server Storage: All processing happens in your browser session
  • βœ… No Logging: Images and data are never saved or transmitted
  • βœ… Auto-Cleanup: Temporary files deleted immediately after processing
  • βœ… Client-Side: Encryption/decryption happens in the Space container
  • βœ… Open Source: Full source code available for audit

Encryption Details:

  • Password β†’ SHA-256 hash β†’ XOR cipher
  • 8-byte MD5 checksum for integrity
  • Custom header with magic number for validation

πŸ’‘ Pro Tips

For Maximum Stealth:

  1. Use 1-bit LSB depth (hardest to detect)
  2. Start with high-resolution images (more bits to work with)
  3. Use password encryption (adds randomness)
  4. Share via platforms that don't re-compress
  5. Embed in photos with complex scenes (harder to analyze)

For Maximum Capacity:

  1. Use 4-bit LSB depth (8Γ— more capacity than 1-bit)
  2. Large images (4K photos can hide megabytes)
  3. Compress your message before embedding

For Detection:

  1. Always check ELA visualization first
  2. Run multiple sensitivity levels
  3. Compare with known clean versions
  4. Check metadata for software signatures
  5. Try extraction even with low confidence scores

πŸš€ Use Cases & Examples

Example 1: Secure Password Sharing

Scenario: Share database password with remote team member
1. Hide password in office photo
2. Encrypt with shared passphrase
3. Email photo (looks innocent)
4. Recipient extracts password securely

Example 2: Digital Watermarking

Scenario: Protect intellectual property in stock photos
1. Embed copyright info + contact details
2. Use 1-bit depth (invisible)
3. Survives screenshot + basic editing
4. Prove ownership if image is stolen

Example 3: Forensic Investigation

Scenario: Suspect image seized in investigation
1. Run detection analysis (high sensitivity)
2. Check ELA for manipulation
3. Attempt extraction with common passwords
4. Examine metadata for tool signatures

πŸ› οΈ Technical Specifications

Supported Formats:

  • Input: JPEG, PNG, GIF, BMP, TIFF, WebP, HEIC, AVIF
  • Output (Hiding): PNG only (lossless requirement)

Steganography Algorithm:

  • Method: LSB replacement
  • Channels: RGB (3 bytes per pixel)
  • Bit depth: 1-4 configurable
  • Encryption: XOR cipher with SHA-256 key derivation
  • Integrity: MD5 checksum (8 bytes)

Detection Algorithms:

  • ELA (Error Level Analysis)
  • Chi-square test for LSB randomness
  • Histogram pair analysis
  • EXIF metadata inspection
  • File structure validation
  • Visual noise coefficient analysis

Performance:

  • Images resized to max 1000Γ—1000 for analysis
  • Processing time: 1-5 seconds for typical images
  • Maximum recommended image size: 10 megapixels

πŸŽ“ Educational Resources

Learn More About Steganography:

Research Papers:

  • Johnson & Jajodia (1998): "Exploring Steganography: Seeing the Unseen"
  • Provos & Honeyman (2003): "Hide and Seek: An Introduction to Steganography"
  • Fridrich (2009): "Steganography in Digital Media"

πŸ† About 2PAC

2PAC combines three powerful open-source tools into one comprehensive suite:

  1. LSB Steganography Engine (custom implementation)

    • High-capacity data hiding
    • Password encryption
    • Integrity verification
  2. RAT Finder - Advanced steganalysis

    • Multi-method detection
    • ELA visualization
    • Statistical analysis
  3. Image Validator - Corruption detection

    • Format verification
    • Structure analysis
    • Visual inspection

πŸ‘¨β€πŸ’» Created By

Richard Young - Computational Neuroscience & AI Research

Part of the DeepNeuro.AI research toolkit


πŸ•ŠοΈ In Memory of Jeff Young

Jeff Young

This project is dedicated to the memory of Jeff Young, who loved Tupac's music and embodied his spirit of bringing people together. Like my brother, Jeff would always reach out to help others, making connections and building community wherever he went. His compassion for people and willingness to always lend a hand to those in need are qualities that inspired this tool's purposeβ€”helping others preserve their precious memories.

May your photos always be as bright and clear as the memories they capture, and may we all strive to connect and help others as Jeff did.


πŸ“œ License

MIT License - Free for educational, research, and commercial use

Disclaimer: This tool is for educational and legitimate security research purposes. Users are responsible for compliance with applicable laws. Do not use for illegal surveillance, unauthorized data exfiltration, or malicious purposes.


🀝 Contributing

Found a bug? Have a feature request?


πŸ™ Acknowledgments

  • Steganography Research: Johnson, Fridrich, Provos, Jajodia
  • LSB Method: Based on classical least-significant-bit techniques
  • ELA Algorithm: Inspired by forensic analysis tools
  • Gradio Framework: For the excellent UI framework
  • Hugging Face: For free hosting of ML/AI tools

🎯 "All Eyez On Your Images" πŸ‘οΈ

Hide it. Find it. Verify it.

"I ain't a killer but don't push me. Corrupt images got their days numbered."

Made with ❀️ by Richard Young