Steganography tool, written in rust.

Overview

Stegosaurust
Stegosaurust

A simple image steganography tool, written in rust.

Publish CI

Disclaimer

⚠️ This is a program I made for fun. There is no guarantee of cryptographic security or data confidentiality. Please do not use this for sensitive information. If you do, you are doing so at your own risk. ⚠️

Introduction

Easily encode messages in images:

echo "text to hide" | stegosaurust --output encoded_image.png image.png
stegosaurust --decode encoded_image.png 

See the examples below for more usage.

Usage

🦕 stegosaurust 0.3.0
Hide text in images, using rust.

USAGE:
    stegosaurust [FLAGS] [OPTIONS] <image>

FLAGS:
    -b, --base64              Encode/decode with base64
    -C, --check-max-length    Check max message size that can be encoded with options given. Does not perform the
                              encoding, acts like a dry-run
    -c, --compress            Compress/decompress data
    -d, --decode              Decode a message from the image
    -h, --help                Prints help information
    -V, --version             Prints version information

OPTIONS:
    -i, --input <input>        Input file to encode, stdin if not present
    -k, --key <key>            Encrypt the text before encoding it with AES-256-CBC
    -N, --max-bit <max-bit>    Maximum bit to possible modify (1-4)
    -m, --method <method>      Method to use for encoding (lsb,rsb) [default: lsb]
    -o, --output <output>      Output file, stdout if not present
    -s, --seed <seed>          Seed for random significant bit encoding

ARGS:
    <image>    Input image

Installation

From crates.io

cargo install stegosaurust

From Source

Build and install the executable from the source code.

git clone https://github.com/jj-style/stegosaurust.git
cd stegosaurust
cargo install --path .

# to uninstall :(
cargo uninstall stegosaurust

Examples

The examples below assume you have installed the program (see here) and are in the repository directory (if not installed use cargo run -- instead of stegosaurust).

# how much data can we fit in an image...
stegosaurust --decode examples/example-2.png | mpv -

# is there something hidden in the logo on the README?
stegosaurust --decode .github/logo.png | xargs python -c "import webbrowser,sys; webbrowser.open(sys.argv[1])"
Comments
  • disguise directory

    disguise directory

    Implementation for feature request #4

    Breaking change to CLI introduces subcommands so normal usage requires encode subcommand (i.e. stegosaurust encode ... )

    Disguise added as subcommand stegosaurust disguise /path/to/directory. 10 images are compressed and embedded in the binary making encoding slower (as images are decompressed), but decoding is normal. 10 images are cycled so if there are more than 10 images multiple of the same will be present. New image names are just base64 encoded old filenames so original can be retrieved, and old files are deleted.

    Needs a bit more thought to error handling and neatness so will push some more changes soon. This is just an initial MVP for visibility. See the GIF for workings.

    new-steg-feature

    areas to improve:

    • error handling
    • security of base64 encoding filenames (effectively none)
    • if a file is too large to be encoded it fails (skip over and carry on encoding?)
    • more images to less repetitions

    Also note: images are taken from unsplash so are free to use as per their license

    opened by jj-style 2
  • Compression for encoded data

    Compression for encoded data

    Compress data to be encoded so more can be squeezed into an image. Of course, decompression needed on decoding.

    May need to experiment when in pipeline to do compression:

    • on raw data
    • after encryption and base64

    Could have command flag to use different compression algorithms (xz, gzip, bzip etc)

    enhancement 
    opened by jj-style 1
  • 13 add more assets to disguise feature

    13 add more assets to disguise feature

    Interface to picsum image API for fetching image during disguise command. When a file is found to be disguised, the rough image size to fetch is calculated and fetched and then used to encode the file.

    This means every file is encoded with a unique image, and no assets need to be stored in the binary which massively limited how many assets could be stored due to crates.io limit

    opened by jj-style 0
  • 14 asset best fit

    14 asset best fit

    Fixes #14 - asset best fit

    Does so by iterating through assets until one is found that fits the data, or it loops back round to the first asset again at which point it skips the file.

    Output from Logs

    Logs show one file which gets encoded but not with the first asset found, and then a file which is too large to be encoded by any asset

    [2022-07-14T10:49:11Z DEBUG stegosaurust::run] assets/images/cat-0.jpg too small to mask tmp/1/file.pdf
    [2022-07-14T10:49:14Z DEBUG stegosaurust::run] encoding tmp/1/survey.pdf with assets/images/cat-1.jpg ==> tmp/1/ZmlsZS5wZGY=.png
    [2022-07-14T10:49:28Z DEBUG stegosaurust::run] assets/images/cat-2.jpg too small to mask tmp/1/example-2.png
    [2022-07-14T10:49:29Z DEBUG stegosaurust::run] assets/images/cat-3.jpg too small to mask tmp/1/example-2.png
    [2022-07-14T10:49:30Z DEBUG stegosaurust::run] assets/images/cat-0.jpg too small to mask tmp/1/example-2.png
    [2022-07-14T10:49:33Z DEBUG stegosaurust::run] assets/images/cat-1.jpg too small to mask tmp/1/example-2.png
    [2022-07-14T10:49:33Z DEBUG stegosaurust::run] no asset large enough to mask tmp/1/example-2.png. Skipping file
    [jj@arch:11:49: stegosaurust] λ RUST_LOG=debug cargo run -- disguise -d tmp/1 
        Finished dev [unoptimized + debuginfo] target(s) in 0.04s
         Running `target/debug/stegosaurust disguise -d tmp/1`
    [2022-07-14T10:49:56Z DEBUG stegosaurust::run] decoding tmp/1/ZmlsZS5wZGY=.png ==> tmp/1/file.pdf
    [2022-07-14T10:50:22Z WARN  stegosaurust::run] error decoding original filename from "tmp/1/example-2.png": InvalidLength
    
    opened by jj-style 0
  • 15 asset not found

    15 asset not found

    fixes #15 - file not found when running disguise

    from disguise, was passing the asset file name to the encode procedure which attempted to load from the filesystem so this didn't work when outside the project directory.

    fix by using the rust-embed Asset::get to load the embedded_data from the binary and pass the image data to the encode function itself

    additionally ignores hidden files in the disguise subcommand's target directory

    opened by jj-style 0
  • Asset Not Found

    Asset Not Found

    Version: 🦕 stegosaurust 0.4.1

    Reproduce: stegosaurust disguise ~/Desktop

    [2022-07-06T13:47:39Z ERROR stegosaurust::run] error encoding DirEntry("Desktop/.directory"): opening "assets/images/cat-2.jpg"
        
        Caused by:
            No such file or directory (os error 2)
    

    Assets searching relative to where stegosaurust is run from.

    Fix: Check documentation for rust-embed has a line for interpolating path relative to where Cargo.toml crate root is

    bug 
    opened by jj-style 0
  • Asset Best Fit

    Asset Best Fit

    When using the disguise subcommand, the assets are iterated over and encoding is attempted with the file skipped if an error occurs (e.g. due to file being larger than can be stored in the image)

    But there may be another asset that could fit the image. Therefore the program should find this image if it exists and use it for compression.

    Solution may be attempt encoding, if error due to max size exceeded:

    • keep iterating through assets until succeed or first asset reached again (full circle so can't encode)
    • keep map of asset and size that can be encoded. Key map to find image that can fit the content
    bug enhancement good first issue 
    opened by jj-style 0
  • Add more assets to disguise feature

    Add more assets to disguise feature

    In release v0.4.1 assets were deleted to bring the crates size within crates.io maximum upload size of 10MB.

    It would be preferable to have more assets so the same ones aren't repeated over and over in a directory when using the disguise command.

    Solutions may involve:

    • getting an increase in this crates maximum allowed size
    • compressing assets
    • fetching assets remotely on the first run and caching them
    • having assets of different sizes e.g. one at 1MB, one at 750KB, one at 500KB, ... and selecting best fit
    enhancement 
    opened by jj-style 0
  • 4 disguise

    4 disguise

    Implement #4 - disguise all files in directory by masking with assets embedded in the binary.

    :warning: PR introduces breaking changes to CLI interface with introduction of subcommands Previous behaviour now accessed with the enc (encode) subcommand.

    Examples

    • Old: echo message | stegosaurust -o out.png image.png and stegosaurust --decode out.png
    • New: echo message | stegosaurust enc -o out.png image.png and stegosaurust enc --decode out.png

    New Features

    Disguise subcommand: stegosaurust disguise /path/to/directory All files are masked with steganography with images embedded in the binary. All* flags (compression, encryption, base64 etc.) can be used on the disguise subcommand and will be applied to all files.

    *only the bit distribution cannot be used as on decoding each file would require a different "key" to unlock the linear bit distribution, so the bit distribution must be linear when using disguise.

    See GIF below for example of new behaviour Peek 2022-07-06 11-47

    Note: images are taken from unsplash so are free to use as per their license

    opened by jj-style 0
  • 6 distribute encoded bits

    6 distribute encoded bits

    implements #6 providing a linear bit distribution to spread message out evenly throughout an image. Default option is to use sequential encoding.

    New behaviour

    • use --distribution linear when encoding
    • If linear is used when encoding, a "key" (number representing the number of pixels to generate based on the length of the message) is displayed. It is necessary to use this number when decoding to ensure the right pixels are selected (as the original message is unknown we need the length to determine which pixels to look at)
    • use --distribution linear-N when decoding where N is the length output when encoding as described above

    Bit hacky with the string parsing of distribution-N - perhaps better to switch to subcommands in the future

    opened by jj-style 0
  • initial compression implementation

    initial compression implementation

    • implementation for #7 - compression.
    • Adds a --compression/-c flag to the command line.
    • Uses Bzip2 compression by default. Perhaps in future add support for selecting different algorithms
    opened by jj-style 0
  • Implement steganography for other file formats

    Implement steganography for other file formats

    allow messages to be hidden in different files other than just images:

    • videos/gif (each frame is an image which can use existing technique)
    • word documents (use existing techniques to put messages in images contained within word doc)
    • audio
    • ...
    enhancement 
    opened by jj-style 0
  • Encryption not interoperable with openssl

    Encryption not interoperable with openssl

    Encryption with AES-256-CBC does not produce the same encrypted value as when using openssl.

    Versions

    • 🦕 Stegosaurust 0.2.1
    • OpenSSL 1.1.1o 3 May 2022

    Steps to Reproduce

    echo "message" | stegosaurust -o /tmp/output.png -k password -b examples/stegosaurus.png
    stegosaurust -d /tmp/output.png 
    U2FsdGVkX181UW0xWkdxSUR29UYSXWm2dsewkAE+X2Q=
    echo "message" | openssl enc -aes-256-cbc -pbkdf2 -a -pass pass:password
    U2FsdGVkX1+i6Cvu1qVM1h3vkBlaBkUOgSq9BdVv+zg=
    

    As seen: U2FsdGVkX181UW0xWkdxSUR29UYSXWm2dsewkAE+X2Q= != U2FsdGVkX1+i6Cvu1qVM1h3vkBlaBkUOgSq9BdVv+zg=

    Expected Outcome

    Encrypted values should match so that data encrypted with stegosaurust can be decrypted separately with openssl, and data encrypted with openssl and subsequently hidden in an image, is decrypted using stegosaurust.

    bug help wanted 
    opened by jj-style 1
Owner
JJ Style
JJ Style
A command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects.

CCake CCake is a command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects. Goals To be easily und

Boston Vanseghi 4 Oct 24, 2022
Blockoli is a high-performance tool for code indexing, embedding generation and semantic search tool for use with LLMs.

blockoli ???? Blockoli is a high-performance tool for code indexing, embedding generation and semantic search tool for use with LLMs. blockoli is buil

Asterisk 76 Jul 24, 2024
Command line tool for cheap and efficient email automation written in Rust

Pigeon Pigeon is a command line tool for automating your email workflow in a cheap and efficient way. Utilize your most efficient dev tools you are al

null 57 Nov 20, 2022
Cli tool for git productivity written in Rust and packaged for consumption via NPM

crust ?? cli tool for git productivity written in Rust and packaged for consumption via NPM This repo is identical with @skyneticist/golee in terms of

null 2 Jul 30, 2022
A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust

A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust. This tool is intended for Witcher 3 modders who make mainly scri

Przemysław Cedro 5 Apr 20, 2022
A command line tool, manage your hundreds of repository, written with Rust

A command line tool, manage your hundreds of repository, written with Rust

Axetroy 4 Aug 16, 2022
A native screenshot tool for wlroots based compositors such as sway and river written in Rust

A native screenshot tool for wlroots based compositors such as sway and river written in Rust. X11 support coming soon.

Waycrate 66 Dec 28, 2022
'apk-yara-checker' is a little CLI tool written in Rust to check Yara rules against a folder of APK files.

apk-yara-checker 'apk-yara-checker' is a little CLI tool written in Rust to check Yara rules against a folder of APK files. You have to pass the folde

alberto__segura 15 Oct 5, 2022
A system fetch tool for Linux, written in Rust.

fetchit A system fetch tool for Linux, written in Rust. fetchit is a simple system info tool, written in Rust, for Linux based operating systems. It o

Ruturaj Nanoti 26 Nov 21, 2022
A tool for chatting using the ChatGPT API, written in Rust CLI.

ChatGPT CLI A tool for chatting using the ChatGPT API, written in Rust CLI. You can use this tool to chat, just by setting your API Key. You can modif

null 6 Apr 5, 2023
Markdown to HTML converter written in Rust. Inspired by Katsuki Yuri's Makudaun Tool.

Makurust Makurust is a powerful tool written in Rust that allows you to effortlessly convert your Markdown files into static HTML pages. Inspired by T

Said (Fromgodd) 15 Apr 9, 2023
GREP like cli tool written in rust.

Show [ grep,tail,cat ] like cli tool written in rust. Only one release as of now which does very basic function,code has been refactored where other f

Siri 4 Jul 24, 2023
Dechrome is a tool written in Rust for batch removing Chromium-based browsers.

Dechrome Dechrome is a tool written in Rust for batch removing Chromium-based browsers and installing Firefox as a replacement. Warning The script is

Ryze 7 Aug 29, 2023
REC2 (Rusty External Command and Control) is client and server tool allowing auditor to execute command from VirusTotal and Mastodon APIs written in Rust. 🦀

Information: REC2 is an old personal project (early 2023) that I didn't continue development on. It's part of a list of projects that helped me to lea

Quentin Texier (g0h4n) 104 Oct 7, 2023
A simple CLI tool to create python project file structure, written in Rust

Ezpie Create python projects blazingly fast What Ezpie can do? It can create a python project directory What kind of directory can Ezpie create? For c

Faseeh 3 Sep 29, 2023
Tool written in Rust to enumerate the valid email addresses of an Azure/Office 365 Tenant

AzureEmailChecker Tool written in Rust to enumerate the valid email addresses of an Azure/Office 365 Tenant. It is multi threaded and makes no connect

Pierre 11 Feb 27, 2024
A Linux laptop battery loggin tool written in Rust.

batt_log A Linux laptop battery logging tool written in Rust. It was built to track power usage of a laptop battery during each session. It keeps trac

Marco Padeiro 3 Apr 4, 2024
A gui tool written in Dioxus to make it easy to release a workspace of crates to crates.io

Easy-Release: a visual tool for releasing workspaces of libraries A work-in-progress GUI for releasing a large workspace of crates manually, but easil

Jon Kelley 13 Jan 18, 2023
FTL Rust Demangler is a command-line tool for demangling symbol names that are mangled with the Rust convention

FTL Rust Demangler is a command-line tool for demangling symbol names that are mangled with the Rust convention. It takes a mangled symbol name as input and returns the demangled name

timetravel3 7 Mar 30, 2023