Added a command line for the 'red' module.

This commit is contained in:
Cédric Bonhomme 2017-02-06 09:31:26 +01:00
parent 4a45689298
commit 086c3898b7
No known key found for this signature in database
GPG key ID: A1CB94DE57B7A70D
5 changed files with 94 additions and 2 deletions

View file

@ -1,6 +1,13 @@
Release History
===============
0.6.4 (2017-02-06)
------------------
* a command line for the 'red' module has been added;
* bugfix: fixed a bug in the lsb-set command line when the generator wasn't
specified by the user.
0.6.3 (2017-01-29)
------------------

View file

@ -72,6 +72,12 @@ parser_reveal.add_argument("-o", dest="secret_binary",
arguments = parser.parse_args()
try:
arguments.generator_function
except AttributeError:
print('You must specify the name of a generator.')
parser.print_help()
exit(1)
try:
generator = getattr(generators, arguments.generator_function)()

56
bin/stegano-red Normal file
View file

@ -0,0 +1,56 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Stéganô - Stéganô is a basic Python Steganography module.
# Copyright (C) 2010-2017 Cédric Bonhomme - https://www.cedricbonhomme.org
#
# For more information : https://github.com/cedricbonhomme/Stegano
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__date__ = "$Date: 2017/02/06 $"
__license__ = "GPLv3"
try:
from stegano import red
except:
print("Install stegano: sudo pip install Stegano")
import argparse
parser = argparse.ArgumentParser(prog='stegano-red')
subparsers = parser.add_subparsers(help='sub-command help', dest='command')
parser_hide = subparsers.add_parser('hide', help='hide help')
parser_hide.add_argument("-i", "--input", dest="input_image_file",
help="Image file")
parser_hide.add_argument("-m", dest="secret_message",
help="Your secret message to hide (non binary).")
parser_hide.add_argument("-o", "--output", dest="output_image_file",
help="Image file")
parser_reveal = subparsers.add_parser('reveal', help='reveal help')
parser_reveal.add_argument("-i", "--input", dest="input_image_file",
help="Image file")
arguments = parser.parse_args()
if arguments.command == 'hide':
secret = red.hide(arguments.input_image_file, arguments.secret_message)
secret.save(arguments.output_image_file)
elif arguments.command == 'reveal':
secret = red.reveal(arguments.input_image_file)
print(secret)

View file

@ -107,3 +107,26 @@ An other example:
# The output of lsb-set is given to lsb.
lsb reveal -i ./enc-identity.png
Hide and reveal a text message with the red portion of a pixel
--------------------------------------------------------------
.. code-block:: bash
$ stegano-red hide --help
usage: stegano-red hide [-h] [-i INPUT_IMAGE_FILE] [-m SECRET_MESSAGE]
[-o OUTPUT_IMAGE_FILE]
optional arguments:
-h, --help show this help message and exit
-i INPUT_IMAGE_FILE, --input INPUT_IMAGE_FILE
Image file
-m SECRET_MESSAGE Your secret message to hide (non binary).
-o OUTPUT_IMAGE_FILE, --output OUTPUT_IMAGE_FILE
Image file
$ stegano-red hide -i ./tests/sample-files/Lenna.png -m 'Basic steganography technique.' -o ~/Lenna1.png
$ stegano-red reveal -i ~/Lenna1.png
Basic steganography technique.

View file

@ -22,6 +22,7 @@ packages = [
scripts = [
'bin/lsb',
'bin/lsb-set',
'bin/stegano-red',
'bin/steganalysis-parity',
'bin/steganalysis-statistics'
]
@ -35,7 +36,7 @@ with open('CHANGELOG.rst', 'r') as f:
setup(
name='Stegano',
version='0.6.3',
version='0.6.4',
author='Cédric Bonhomme',
author_email='cedric@cedricbonhomme.org',
packages=packages,
@ -53,7 +54,6 @@ setup(
"Environment :: Console",
"Topic :: Utilities",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"