Skip to main content

Steganography tool based on DeepLearning GANs

Project description

“SteganoGAN” An open source project from Data to AI Lab at MIT.

PyPI Shield Travis CI Shield

SteganoGAN

Overview

SteganoGAN is a steganographic tool that uses adversarial training to hide messages in images.

Installation

The simplest and recommended way to install SteganoGAN is using pip:

pip install steganogan

Alternatively, clone the repository and install it from source running the make install command.

git clone git@github.com:DAI-Lab/SteganoGAN.git
cd SteganoGAN
make install

For development, you can use the make install-develop command instead in order to install all the required dependencies for testing, code linting and notebook running.

Usage

Command Line

SteganoGAN includes a command line interface, which allows to easily hide messages in images and later on read them back.

Hide a message inside an image

To encode an image, after SteganoGAN has been installed, just execute steganogan encode passing the path to the image to be used as cover and the message to hide in it:

steganogan encode [options] path/to/cover/image.png "Message to hide"

Read a message from an image

To decode a message from a generated image, execute steganogan decode passing the path to the image:

steganogan decode [options] path/to/generated/image.png

Additional options

The script has some additional options to control its behavior:

  • -o, --output PATH: Path where the generated image will be stored. Defaults to output.png.
  • -a, --architecture ARCH: Architecture to use, basic or dense. Defaults to dense.
  • -v, --verbose: Be verbose.
  • --cpu: force CPU usage even if CUDA is available. This might be needed if there is a GPU available in the system but the VRAM amount is too low.

NOTE: Make sure to use the same architecture for both encoding and decoding, otherwise SteganoGAN won't be able to decode the message.

Python

The main way to interact with SteganoGAN from Python is through the class steganogan.SteganoGAN.

This class can be loaded by giving it the path to a pretrained model:

>>> from steganogan import SteganoGAN
>>> steganogan = SteganoGAN.load('research/models/dense.steg')
Using CUDA device

Once we have loaded our model, we are ready to give it an input image path, the path of the image that we want to generate, and the message that we want to hide:

>>> steganogan.encode('research/input.png', 'research/output.png', 'This is a super secret message!')
Encoding completed.

This will generate an output.png image that will look almost like the input one and will contain the message hidden inside it.

After this, when we want to extract the message from the image, we can simply pass it to the decode method:

>>> steganogan.decode('research/output.png')
'This is a super secret message!'

Fitting a new model

A usage example notebook has been included in the research folder with a step by step guide about how to fit a new model on a new images dataset, save it to a file, and later on reload it and use it to encode and decode messages.

A convenience script has been also included in the research/data folder to download a couple of demo datasets to train models with.

History

0.1.0 - First release to PyPi

  • SteganoGAN class which can be fitted, saved, loaded and used to encode and decode messages.
  • Basic command line interface that allow using pretrained models.
  • Basic and Dense pretrained models for demo purposes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

steganogan-0.1.0.tar.gz (1.7 MB view hashes)

Uploaded Source

Built Distribution

steganogan-0.1.0-py2.py3-none-any.whl (1.6 MB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page