Skip to content

Commit 7cdb936

Browse files
ricyoungclaude
andcommitted
Add Gradio web interface with LSB steganography
- Add steg_embedder.py: LSB steganography embedding/extraction with encryption - Add app.py: Gradio interface with 3 tabs (Hide Data, Detect/Extract, Check Corruption) - Update requirements.txt: Add Gradio dependency - Add GitHub Actions workflow for auto-sync to Hugging Face Spaces - Add README_SPACE.md: Hugging Face Space documentation Features: - Hide text in images using LSB technique with optional password encryption - Extract hidden data from steganographic images - Detect steganography using RAT Finder analysis (ELA, LSB, histogram, metadata) - Validate image integrity and check for corruption 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cf39c97 commit 7cdb936

5 files changed

Lines changed: 1044 additions & 1 deletion

File tree

.github/workflows/sync-to-hf.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Sync to Hugging Face Spaces
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'app.py'
9+
- 'steg_embedder.py'
10+
- 'rat_finder.py'
11+
- 'find_bad_images.py'
12+
- 'requirements.txt'
13+
- 'README.md'
14+
15+
jobs:
16+
sync:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
lfs: true
24+
25+
- name: Push to Hugging Face Space
26+
env:
27+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
28+
run: |
29+
git config --global user.email "noreply@deepneuro.ai"
30+
git config --global user.name "DeepNeuro AI Bot"
31+
32+
# Add Hugging Face remote
33+
git remote add space https://richardyoung:$HF_TOKEN@huggingface.co/spaces/richardyoung/2pac || true
34+
35+
# Force push to Hugging Face Space
36+
git push space main --force

README_SPACE.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: 2PAC Picture Analyzer & Corruption Killer
3+
emoji: 🔫
4+
colorFrom: purple
5+
colorTo: blue
6+
sdk: gradio
7+
sdk_version: 4.44.0
8+
app_file: app.py
9+
pinned: false
10+
license: mit
11+
---
12+
13+
# 🔫 2PAC: Picture Analyzer & Corruption Killer
14+
15+
**Advanced image security and steganography toolkit**
16+
17+
## Features
18+
19+
### 🔒 Hide Secret Data
20+
Invisibly hide text messages inside images using **LSB (Least Significant Bit) steganography**:
21+
- Hide text of any length (capacity depends on image size)
22+
- Optional password encryption for added security
23+
- Adjustable LSB depth (1-4 bits per channel)
24+
- PNG output preserves hidden data perfectly
25+
26+
### 🔍 Detect & Extract Hidden Data
27+
Advanced steganography detection using **RAT Finder** technology:
28+
- **ELA (Error Level Analysis)** - Highlights compression artifacts
29+
- **LSB Analysis** - Detects randomness in least significant bits
30+
- **Histogram Analysis** - Finds statistical anomalies
31+
- **Metadata Inspection** - Checks EXIF data for suspicious tools
32+
- **Extract Data** - Recover messages hidden with this tool
33+
34+
### 🛡️ Check Image Integrity
35+
Comprehensive image validation and corruption detection:
36+
- File format validation (JPEG, PNG, GIF, TIFF, BMP, WebP, HEIC)
37+
- Header integrity checks
38+
- Data completeness verification
39+
- Visual corruption detection (black/gray regions)
40+
- Structure validation
41+
42+
## How It Works
43+
44+
### LSB Steganography
45+
The tool hides data in the **least significant bits** of pixel values. Since changing the last 1-2 bits of a pixel value (e.g., changing 200 to 201) is imperceptible to the human eye, we can encode arbitrary data without visible changes to the image.
46+
47+
**Example:**
48+
- Original pixel: RGB(156, 89, 201) = `10011100, 01011001, 11001001`
49+
- After hiding bit '1': RGB(156, 89, 201) = `10011100, 01011001, 11001001` (last bit already 1)
50+
- After hiding bit '0': RGB(156, 88, 201) = `10011100, 01011000, 11001001` (89→88)
51+
52+
This allows hiding hundreds to thousands of bytes in a typical photo!
53+
54+
### Steganography Detection
55+
The RAT Finder uses multiple forensic techniques:
56+
57+
1. **ELA (Error Level Analysis)**: Re-saves the image at a known quality and compares compression artifacts. Hidden data or manipulation shows as bright areas.
58+
59+
2. **LSB Analysis**: Statistical tests check if the least significant bits are too random (hidden data) or too uniform (natural image).
60+
61+
3. **Histogram Analysis**: Analyzes color distribution for anomalies typical of steganography.
62+
63+
4. **Metadata Forensics**: Checks EXIF data for steganography tools or suspicious editing history.
64+
65+
## Usage Tips
66+
67+
### For Hiding Data:
68+
- ✅ Use **PNG** images (JPEG compression destroys hidden data)
69+
- ✅ Larger images = more capacity
70+
- ✅ Use 1-2 bits per channel for undetectable hiding
71+
- ✅ Add password encryption for sensitive data
72+
- ⚠️ Don't re-save or edit the output image!
73+
74+
### For Detection:
75+
- 🔍 Higher sensitivity = more thorough but more false positives
76+
- 📊 Check the ELA image for bright spots (potential hiding)
77+
- 💡 High confidence doesn't guarantee hidden data (could be compression artifacts)
78+
- 🔓 Use "Extract Data" tab if you suspect LSB steganography
79+
80+
### For Corruption Checking:
81+
- 🛡️ Enable visual corruption check for damaged photos
82+
- ⚙️ Higher sensitivity for stricter validation
83+
- 📁 Useful before archiving important photo collections
84+
85+
## About
86+
87+
**2PAC** combines three powerful tools:
88+
- **LSB Steganography** engine (new!)
89+
- **RAT Finder** - Advanced steg detection
90+
- **Image Validator** - Corruption checker
91+
92+
Created by [Richard Young](https://github.com/ricyoung) | Part of [DeepNeuro.AI](https://deepneuro.ai)
93+
94+
🔗 **GitHub Repository:** [github.com/ricyoung/2pac](https://github.com/ricyoung/2pac)
95+
🌐 **More Tools:** [demo.deepneuro.ai](https://demo.deepneuro.ai)
96+
97+
## Security & Privacy
98+
99+
- ✅ All processing happens in your browser session (Hugging Face Space)
100+
- ✅ Images are not stored or logged
101+
- ✅ Temporary files are deleted after processing
102+
- ✅ Your hidden data and passwords are never saved
103+
104+
---
105+
106+
*"All Eyez On Your Images" 👁️*

0 commit comments

Comments
 (0)