Crates.io | pnger |
lib.rs | pnger |
version | 0.1.3 |
created_at | 2025-07-22 21:14:23.94777+00 |
updated_at | 2025-07-26 08:45:59.323539+00 |
description | Cross-platform PNG steganography tool for embedding and extracting payloads |
homepage | https://github.com/mathyslv/pnger |
repository | https://github.com/mathyslv/pnger |
max_upload_size | |
id | 1764029 |
size | 222,836 |
A cross-platform command-line tool for embedding payloads within PNG files using steganography techniques.
git clone https://github.com/mathyslv/pnger.git
cd pnger
cargo build --release --features bin
The binary will be available at target/release/pnger
.
cargo install pnger --features bin
Embed payload.json into image.png and save to output.png:
pnger -i image.png -p payload.json -o output.png
Use explicit LSB strategy (default, so optional):
pnger -i image.png -p payload.bin -o output.png --strategy lsb
Output raw binary data to stdout:
pnger -i image.png -p payload.txt --raw > output.png
LSB with password-based pattern (secure, nothing embedded):
pnger -i image.png -p secret.txt -o output.png --lsb-password "mypassword123"
LSB with manual hex seed (32 bytes = 64 hex chars):
pnger -i image.png -p data.bin -o output.png --lsb-seed "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
LSB linear pattern instead of random:
pnger -i image.png -p data.txt -o output.png --lsb-pattern linear
LSB with custom bit index (target bit 3 instead of 0):
pnger -i image.png -p secret.bin -o output.png --lsb-bit-index 3
XOR obfuscation with default key:
pnger -i image.png -p sensitive.txt -o output.png --xor
XOR obfuscation with custom key:
pnger -i image.png -p data.json -o output.png --xor --xor-key "mykey123"
Combined: LSB password + XOR:
pnger -i image.png -p payload.bin -o output.png --lsb-password "mypassword" --xor --xor-key "encrypt"
Extract payload from image.png and save to payload.json:
pnger -x -i output.png -o payload.json
Extract with matching LSB and XOR parameters:
pnger -x -i output.png -o extracted.txt --lsb-password "mypassword" --xor --xor-key "encrypt"
Extract payload to stdout:
pnger -x -i output.png --raw
Usage: pnger [OPTIONS] --input <FILE>
Options:
-i, --input <FILE> Input PNG file
-p, --payload <FILE> Payload file to embed
-o, --output <FILE> Output file (write result to file)
--raw Output raw result data to stdout
-s, --strategy <STRATEGY> Embedding strategy to use [default: lsb]
-x, --extract Extract payload from input file
--xor Toggle payload obfuscation with XOR algorithm
--xor-key <XOR_KEY> Key to use for XOR obfuscation
--lsb-pattern <LSB_PATTERN> LSB pattern to use (linear or random) [default: random]
--lsb-bit-index <LSB_BIT_INDEX> LSB target bit index (0-7) [default: 0]
--lsb-password <LSB_PASSWORD> Password for reproducible random patterns (nothing embedded in PNG)
--lsb-seed <LSB_SEED> LSB seed for reproducible random patterns (raw 32-byte hex seed)
-h, --help Print help
-V, --version Print version
Available strategies:
lsb Least Significant Bit embedding
Available LSB patterns:
linear Linear pattern (sequential)
random Random pattern (pseudo-random) [default: random]
PNGer can also be used as a Rust library:
use pnger::{EmbeddingOptions, Strategy, Obfuscation};
use pnger::strategy::lsb::{LSBConfig, BitIndex};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Basic embedding with random LSB (default)
let strategy = Strategy::LSB(LSBConfig::random());
let options = EmbeddingOptions::new(strategy);
// Password-protected random pattern
let strategy = Strategy::LSB(
LSBConfig::random().with_password("my_secret_password".to_string())
);
let mut options = EmbeddingOptions::new(strategy);
// Add XOR obfuscation
options.set_obfuscation(Some(Obfuscation::Xor {
key: b"secretkey".to_vec()
}));
// Linear pattern with custom bit index
let strategy = Strategy::LSB(
LSBConfig::linear().with_bit_index(BitIndex::Bit3)
);
let options = EmbeddingOptions::new(strategy);
// Using fluent builder API (recommended)
let options = EmbeddingOptions::linear()
.with_xor_string("encryption_key");
let options = EmbeddingOptions::random_with_password("secure_password")
.with_bit_index(BitIndex::Bit1)
.with_xor_key(b"additional_layer".to_vec());
Ok(())
}
embed_payload_from_file(png_path, payload_data)
- Embed using default optionsembed_payload_from_file_with_options(png_path, payload_data, options)
- Embed with custom optionsembed_payload_from_bytes(png_data, payload_data)
- Memory-based embeddingembed_payload_from_bytes_with_options(png_data, payload_data, options)
- Memory-based with optionsextract_payload_from_file(png_path)
- Extract using default optionsextract_payload_from_file_with_options(png_path, options)
- Extract with matching optionsPNGer uses steganography to hide data within PNG images by modifying the least significant bits of pixel data. The embedded data includes a length prefix, allowing for reliable extraction while maintaining image quality.
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
This tool is intended for educational purposes and legitimate use cases. Users are responsible for complying with applicable laws and regulations regarding data hiding and steganography.