A simple steganography tool to hide information inside other files
- Rust 100%
|
|
||
|---|---|---|
| src | map error instead of plain unwrap | |
| .gitignore | init | |
| Cargo.lock | remove unused dependency | |
| Cargo.toml | remove unused dependency | |
| README.md | Update README.md | |
Veil - PNG Steganography Tool
A Rust library and command-line tool for hiding and extracting data in PNG files using steganography. This project was created as a learning exercise to explore Rust's type system, error handling, and working with binary file formats.
Features
- Check: Detect if there is hidden data in a PNG file
- Hide: Hide text messages or files inside PNG images
- Extract: Extract hidden data from PNG files
- Clean API: Simple trait-based design for library usage
- PNG Chunks: Uses custom "vEiL" chunks to store hidden data
Installation
git clone https://github.com/mitsimi/veil.git
cd veil
cargo build --release
Usage
Command Line Interface
# Check if there is hidden data
veil check -f image.png
# Hide a text message inside an image
veil hide -f image.png -m "Secret message" -o hidden_image.png
# Hide a file inside an image
veil hide -f image.png -d secret.txt -o hidden_image.png
# Hide piped data
echo "Secret message" | veil hide -f image.png -o hidden_image.png
# Extract hidden data
veil extract -f hidden_image.png -o extracted/
As a Library
The library provides a clean, extensible API through the Steganography trait:
useveil::{SteganographyFile,Steganography};// Load a PNG file
letmutfile=SteganographyFile::from_file("image.png")?;// Check if file contains hidden data
iffile.has_hidden_data(){println!("Hidden data detected!");}// Hide data (text or binary)
letsecret_message=b"This is my secret message";file.hide_data(secret_message)?;// Save the modified file
file.save_to_file("output.png")?;// Extract hidden data
lethidden_data=file.extract_data()?;letmessage=String::from_utf8(hidden_data)?;println!("Secret: {}",message);Working with PNG directly
useveil::png::{Png,Chunk,ChunkType};usestd::str::FromStr;// Direct PNG manipulation
letmutpng=Png::from_file("image.png")?;// Create custom chunk
letchunk_type=ChunkType::from_str("tEXt")?;letchunk=Chunk::new(chunk_type,b"metadata".to_vec());png.append_chunk(chunk);// Save modified PNG
png.to_file("output.png")?;// Extract custom chunks
letcustom_chunks=png.custom_chunks();forchunkincustom_chunks{println!("Found chunk: {}",chunk.chunk_type());println!("Data: {:?}",chunk.data_as_string());}How It Works
Veil uses PNG's chunk-based structure to hide data. PNG files are composed of chunks, each with a type and data. The tool creates custom chunks with the type "vEiL" to store hidden data.
- Leverages PNG's built-in chunk system - No pixel manipulation required
- Preserves image integrity - The image displays normally in any PNG viewer
- Supports any binary data - Hide text, files, or any other data
- Standard compliant - Generated files work with all PNG-compatible tools
License
MIT