Coder Social home page Coder Social logo

steganogram / stegano-rs Goto Github PK

View Code? Open in Web Editor NEW
93.0 4.0 8.0 55.94 MB

A cross-platform command line tool for steganography focused on performance and simplicity written in rust-lang.

Home Page: https://crates.io/search?q=stegano-cli

License: GNU General Public License v3.0

Rust 99.70% Makefile 0.30%
steganography cli image-processing stegano stegano-cli lsb

stegano-rs's Introduction

Stegano

License: GPL v3 Build Status dependency status codecov LOC

A cross-platform command line tool for steganography, focused on performance and simplicity.

Demo

demo

Features

What is steganography?

In short, the art of hiding information in something (like a book, a image, a audio or even a video). speakerdeck You can find more information on my slides or checkout my talk on the rust meetup munich in june, 2020.

Install

On Linux as snap

Get it from the Snap Store

TL;DR:

sudo snap install stegano

With cargo

To install the stegano cli, you just need to run

❯ cargo install --force stegano-cli

(--force just makes it update to the latest stegano-cli if it's already installed)

Note the binary is called stegano (without -cli)

to verify if the installation went thru, you can run which stegano that should output similar to

$HOME/.cargo/bin/stegano

AUR

stegano can be installed from available AUR packages using an AUR helper. For example,

❯ yay -S stegano

Usage

❯ stegano --help
Stegano CLI 0.4.0
Sven Assmann <[email protected]>
Hiding secret data with steganography in PNG images and WAV audio files

USAGE:
    stegano [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    help          Prints this message or the help of the given subcommand(s)
    hide          Hides data in PNG images and WAV audio files
    unveil        Unveils data from PNG images
    unveil-raw    Unveils raw data in PNG images

Subcommands

hide

❯ stegano hide --help
stegano-hide
Hides data in PNG images and WAV audio files

USAGE:
    stegano hide [FLAGS] [OPTIONS] --data <data file> --in <media file> --out <output image file>

FLAGS:
        --x-force-content-version-2    Experimental: enforce content version 2 encoding (for backwards compatibility)
    -h, --help                         Prints help information
    -V, --version                      Prints version information

OPTIONS:
    -d, --data <data file>           File(s) to hide in the image
    -i, --in <media file>            Media file such as PNG image or WAV audio file, used readonly.
    -m, --message <text message>     A text message that will be hidden
    -o, --out <output image file>    Final image will be stored as file

Example with am Image PNG file

Let's illustrate how to hide a file like README.md, inside an image Base.png and save it as README.png:

❯ stegano hide --data README.md --in resources/plain/carrier-iamge.png --out README.png

The final result is then contained in the image README.png.

Pro TIP you can hide multiple files at once

here I'm using the shorthand parameters (--data, -d), (--in, -i), (--out, -o)

❯ stegano hide \
  -i resources/plain/carrier-image.png \
  -d resources/secrets/Blah.txt \
     resources/secrets/Blah-2.txt \
  -o secret.png

Hidden Feature you can use a .jpg for input and save it as .png

❯ stegano hide \
  -i resources/NoSecret.jpg \
  -d resources/secrets/Blah.txt \
  -o secret.png

Example with an Audio WAV file

❯ stegano hide \
  -i resources/plain/carrier-audio.wav \
  -d resources/secrets/Blah.txt \
     resources/secrets/Blah-2.txt \
  -o secret.wav

Example Hide short messages

Now let's assume we want to hide just a little text message in secret-text.png. So we would run:

❯ stegano hide \
  -i resources/NoSecrets.jpg \
  -m 'This is a super secret message' \
  -o secret-text.png

unveil

❯ stegano unveil --help
stegano-unveil
Unveils data from PNG images

USAGE:
    stegano unveil --in <image source file> --out <output folder>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -i, --in <image source file>    Source image that contains secret data
    -o, --out <output folder>       Final data will be stored in that folder

Example unveil from an Image PNG file

Let's unveil the README.md that we've hidden (just above) in README.png

❯ stegano unveil --in README.png --out ./

❯ file README.md
README.md: UTF-8 Unicode text

Example unveil short messages

Now let's unveil the message from above secret-text.png. So we would run:

❯ stegano unveil \
  -i secret-text.png \
  -o message

❯ cat message/secret-message.txt
This is a super secret message

unveil-raw

❯ stegano unveil-raw --help
stegano-unveil-raw
Unveils raw data in PNG images

USAGE:
    stegano unveil-raw --in <image source file> --out <output file>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -i, --in <image source file>    Source image that contains secret data
    -o, --out <output file>         Raw data will be stored as binary file

Example unveil raw data

Let's unveil the raw data of the README.md that we've hidden just above in README.png

❯ stegano unveil-raw --in README.png --out README.bin

The file README.bin contains all raw binary data unfiltered decoded by the LSB decoding algorithm. That is for the curious people, and not so much interesting for regular usage.

stegano on the web

Contribute

To contribute to stegano-rs you can either checkout existing issues labeled with good first issue or open a new issue and describe your problem.

Also every PR is welcome, just as a note of caution: at this very time the architecture and the API are still in flux and might change, so in any case I recommend opening an issue first to discuss a code contribution.

License

stegano-rs's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar lemonzyy avatar orhun avatar sassman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stegano-rs's Issues

[FEAT] error handling in stegano-core

stegano-core is the library for stegano-cli, by this it should handle error cases as like a library and should never panic

  • extend error codes for all error scenarios
  • extend tests to cover the error cases
  • no panic inside the lib
  • handle the error enums in the CLI and give clear error messages with suggestion to the end user

[FEAT] target which creates an appimage

Is your feature request related to a problem? Please describe.
appimages are a good way for providing single binaries on all distributions

Describe the solution you'd like
please provide an appimage

Release Binary Assets failed on v0.5.1

As on build

there is a problem on all 4 artifact builds:

Run filename="stegano-$TAG-amd64-static.deb"
  filename="stegano-$TAG-amd64-static.deb"
  mv target/x86_64-unknown-linux-musl/debian/stegano-cli*.deb "$filename"
  echo "::set-output name=filename::$filename"
  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    CACHE_ON_FAILURE: false
    CARGO_INCREMENTAL: 0
    TAG: v0.5.1
mv: rename target/x86_64-unknown-linux-musl/debian/stegano-cli*.deb to stegano-v0.5.1-amd64-static.deb: No such file or directory
Error: Process completed with exit code 1.

and

Run filename="stegano-$TAG-amd64-static.deb"
  filename="stegano-$TAG-amd64-static.deb"
  mv target/x86_64-unknown-linux-musl/debian/stegano-cli*.deb "$filename"
  echo "::set-output name=filename::$filename"
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    CACHE_ON_FAILURE: false
    CARGO_INCREMENTAL: 0
    TAG: v0.5.1
mv: cannot move 'target/x86_64-unknown-linux-musl/debian/stegano-cli_0.5.1_amd64.deb' to 'stegano-v0.5.1-amd64-static.deb': Permission denied
Error: Process completed with exit code 1.

[FEAT] finish migration of ci pipeline to github workflows

The CD portion of the CI pipeline is already migrated, but not stable yet. So here we want to tackle:

  1. CD Pipeline should be stable (also for windows)
  2. CI Pipeline should be migrated to GitHub workflows
  3. common build targets or steps in the pipeline should be assembled in a Makefile, to enable execution of steps locally by simple make target calls

stegano hide fails while encoding data bigger than target image

Describe the bug
stegano hide fails while encoding data bigger than target image

To Reproduce

$ ls -l
total 980
-rwxrwxrwx 1 user user 370539 Feb 11 18:49 kitten.png
-rwxrwxrwx 1 user user 627962 Feb 11 18:49 tiger.png

$ stegano hide --data tiger.png --in kitten.png --out out.png
thread 'main' panicked at /home/pt103441/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stegano-core-0.5.3/src/lib.rs:382:18:
Failed to hide message in media: ImageEncodingError
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior
The command should not fail and encode the data file (tiger.png) into the input image (kitten.png) and write it to output image (out.png)

Additional context
The command works for data sizes smaller than the target image. It seems after a certain threshold the command starts to fail.

** Attachments **
kitten
tiger

** RUST_BACKTRACE=full **

$ stegano hide --data tiger.png --in kitten.png --out out.png
thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stegano-core-0.5.3/src/lib.rs:382:18:
Failed to hide message in media: ImageEncodingError
stack backtrace:
   0:     0x55e5863e20c6 - std::backtrace_rs::backtrace::libunwind::trace::hbee8a7973eeb6c93
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x55e5863e20c6 - std::backtrace_rs::backtrace::trace_unsynchronized::hc8ac75eea3aa6899
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55e5863e20c6 - std::sys_common::backtrace::_print_fmt::hc7f3e3b5298b1083
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x55e5863e20c6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb235daedd7c6190
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55e586409ab0 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
   5:     0x55e586409ab0 - core::fmt::write::h3ed6aeaa977c8e45
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
   6:     0x55e5863e003f - std::io::Write::write_fmt::h78b18af5775fedb5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
   7:     0x55e5863e1ea4 - std::sys_common::backtrace::_print::h5d645a07e0fcfdbb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x55e5863e1ea4 - std::sys_common::backtrace::print::h85035a511aafe7a8
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x55e5863e3727 - std::panicking::default_hook::{{closure}}::hcce8cea212785a25
  10:     0x55e5863e3489 - std::panicking::default_hook::hf5fcb0f213fe709a
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
  11:     0x55e5863e3bb8 - std::panicking::rust_panic_with_hook::h095fccf1dc9379ee
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:779:13
  12:     0x55e5863e3a92 - std::panicking::begin_panic_handler::{{closure}}::h032ba12139b353db
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
  13:     0x55e5863e25c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h9259bc2ff8fd0f76
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x55e5863e37f0 - rust_begin_unwind
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
  15:     0x55e5860f5de5 - core::panicking::panic_fmt::h784f20a50eaab275
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
  16:     0x55e5860f6333 - core::result::unwrap_failed::h03d8a5018196e1cd
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
  17:     0x55e586109d4b - stegano_core::SteganoEncoder::hide::h410acb8b6154a859
  18:     0x55e5860ffaf9 - stegano::main::h8570879c0fd5c8a3
  19:     0x55e5860f9a43 - std::sys_common::backtrace::__rust_begin_short_backtrace::h75ac67cd7440b4bf
  20:     0x55e5860f9a5d - std::rt::lang_start::{{closure}}::h4a86a37165924b9f
  21:     0x55e5863d96f1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h37600b1e5eea4ecd
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
  22:     0x55e5863d96f1 - std::panicking::try::do_call::hb4bda49fa13a0c2b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  23:     0x55e5863d96f1 - std::panicking::try::h8bbf75149211aaaa
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  24:     0x55e5863d96f1 - std::panic::catch_unwind::h8c78ec68ebea34cb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  25:     0x55e5863d96f1 - std::rt::lang_start_internal::{{closure}}::hffdf44a19fd9e220
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
  26:     0x55e5863d96f1 - std::panicking::try::do_call::hcb3194972c74716d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  27:     0x55e5863d96f1 - std::panicking::try::hcdc6892c5f0dba4c
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  28:     0x55e5863d96f1 - std::panic::catch_unwind::h4910beb4573f4776
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  29:     0x55e5863d96f1 - std::rt::lang_start_internal::h6939038e2873596b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
  30:     0x55e5861007a5 - main
  31:     0x7f4d5bb79d90 - <unknown>
  32:     0x7f4d5bb79e40 - __libc_start_main
  33:     0x55e5860f65f5 - _start
  34:                0x0 - <unknown>

feat(api): provide a API that has progress callback hooks

A as API User
I want to register a progress update callback hook
So that I can easily implement a progress bar

Acceptance Criteria

  • The hook should be a simple function
  • The hook should accept a f32 argument that indicates the progress, with range 0..1
  • The hook should accept a argument that allows to cancel and interrupt the process

Example

This is the progress update callback that I want to register:

fn progress_update(progress: f32, should_cancel: &mut bool) {
    // let's print the current progress as percent 0..100 
    println!("Current Progress: {}", (progress * 100.0).floor());
    // let's cancel the progress
    *should_cancel = true;
}

[FEAT] hide and unveil support for wav audio files

It would be nice if hide and unveil of secret data from / to a wav audio file is possible

So that those use cases are possible:

hide

stegano hide --data README.md --in some-audio.wav --out some-audio-with-secret.wav

unveil

stegano unveil --in some-audio-with-secret.wav --out ./

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.