Using OpenStego from Command-line

The general syntax for OpenStego is:

java -jar <path>\openstego.jar <command> [options]

Here, the first argument must be a command. Valid commands are:

CommandAction
embed, --embedEmbed message into cover file
extract, --extractExtract message from stego file
algorithms, --algorithmsList down supported steganography algorithms
readformats --readformatsList down supported formats for cover file
writeformats, --writeformatsList down supported formats for stego file
help, --helpDisplay the help. To get help on options specific to an algorithm, provide the name of the algorithm using '-a' option

Following option is common for all commands other than 'algorithms':

OptionDescription
-a, --algorithm <algorithm_name>Name of the steganography algorithm to use. List of the supported algorithms can be retrieved using 'algorithms' command

Possible options for 'embed' command:

OptionDescription
-mf, --messagefile <filename>Source message/data file. If this option is not provided or '-' (without quotes) is provided as the value then the message data is read from stdin
-cf, --coverfile <filename>Cover file in which the message will be embedded. This option supports '*' and '?' wildcards for filename. If wildcard filename is provided then make sure that it is surrounded by double quotes. Multiple filenames can also be provided by separating them with ';' (semi-colon).

If the wildcard expression returns more than one file, then '-sf' option is ignored, and each coverfile is overwritten with the corresponding generated stegofile

-sf, --stegofile <filename>Output stego file containing the embedded message. If this option is not provided or '-' (without quotes) is provided as the value then the stego file is written to stdout
-c, --compressCompress the message file before embedding (default)
-C, --nocompressDo not compress the message file before embedding
-e, --encryptEncrypt the message file before embedding
-E, --noencryptDo not encrypt the message file before embedding (default)
-p, --passwordPassword to be used for encryption. If this is not provided then prompt will be displayed for entry

Additions and changes to 'embed' options while using LSB/RandomLSB Plugins:

OptionDescription
-b, --maxBitsUsedPerChannel <n>Max number of bits to use per color channel in the image for embedding data. This value can be increased at the expense of image quality, in case size of image is not able to accommodate the data (Default = 3)
-cf, --coverfile <filename>If this option is not provided or '-' (without quotes) is provided as the value then a random image containing noise is generated and used as cover file. The size of image is minimum required to embed the given source file when 'maxBitsUsedPerChannel' bits are used per color channel
-sf, --stegofile <filename>If this option is not provided or '-' (without quotes) is provided as the value then stego file is written to stdout in PNG format

Possible options for 'extract' command:

OptionDescription
-sf, --stegofile <filename>Stego file containing the embedded message
-xf, --extractfile <filename>Optional filename for the extracted data. Use this to override the filename embedded in the stego file
-xd, --extractdir <dir>Directory where the message file will be extracted. If this option is not provided, then the file is extracted to current directory
-p, --passwordPassword to be used for decryption. If this is not provided then prompt will be displayed for entry (if the message is encrypted)

Examples:

To embed secret.txt into wallpaper.png and generate the output into test.png:

java -jar <path>\openstego.jar embed -a lsb -mf secret.txt -cf wallpaper.png -sf test.png

OR

java -jar <path>\openstego.jar --embed --algorithm=lsb --messagefile=secret.txt --coverfile=wallpaper.png --stegofile=test.png

To extract embedded data from test.png to /data directory:

java -jar <path>\openstego.jar extract -a lsb -sf test.png -xd /data

OR

java -jar <path>\openstego.jar extract --algorithm=lsb --stegofile=test.png --extractdir=/data

Piping example:

ls -R | java -jar <path>\openstego.jar embed -a lsb > test.png

Wildcard example (Please note that the double quotes are important):

java -jar <path>\openstego.jar embed -a lsb -cf "img???.png;wall*.png" -mf watermark.txt