it is now possible to specify the encoding (UTF-8 or UTF-32LE) of the message to hide/reveal through the command line (for the LSb module).

This commit is contained in:
Cédric Bonhomme 2017-05-15 22:57:13 +02:00
parent b907985886
commit 61b6ec7175
3 changed files with 15 additions and 3 deletions

View file

@ -1,6 +1,11 @@
Release History
===============
0.8.1 (not yet released)
------------------------
* it is now possible to specify the encoding (UTF-8 or UTF-32LE) of the message
to hide/reveal through the command line.
0.8 (2017-05-06)
----------------
* updated command line. All commands are now prefixed with *stegano-*;

View file

@ -40,6 +40,9 @@ parser_hide = subparsers.add_parser('hide', help='hide help')
# Original image
parser_hide.add_argument("-i", "--input", dest="input_image_file",
required=True, help="Input image file.")
parser_hide.add_argument("-e", "--encoding", dest="encoding", default="UTF-8",
help="Specify the encoding of the message to hide." +
" UTF-8 (default) or UTF-32LE.")
group_secret = parser_hide.add_mutually_exclusive_group(required=True)
# Non binary secret message to hide
@ -58,6 +61,9 @@ parser_hide.add_argument("-o", "--output", dest="output_image_file",
parser_reveal = subparsers.add_parser('reveal', help='reveal help')
parser_reveal.add_argument("-i", "--input", dest="input_image_file",
required=True, help="Input image file.")
parser_reveal.add_argument("-e", "--encoding", dest="encoding", default="UTF-8",
help="Specify the encoding of the message to reveal." +
" UTF-8 (default) or UTF-32LE.")
parser_reveal.add_argument("-o", dest="secret_binary",
help="Output for the binary secret (Text or any binary file).")
@ -71,7 +77,8 @@ if arguments.command == 'hide':
elif arguments.secret_file != None:
secret = tools.binary2base64(arguments.secret_file)
img_encoded = lsb.hide(arguments.input_image_file, secret)
img_encoded = lsb.hide(arguments.input_image_file, secret,
arguments.encoding)
try:
img_encoded.save(arguments.output_image_file)
except Exception as e:
@ -79,7 +86,7 @@ if arguments.command == 'hide':
print(e)
elif arguments.command == 'reveal':
secret = lsb.reveal(arguments.input_image_file)
secret = lsb.reveal(arguments.input_image_file, arguments.encoding)
if arguments.secret_binary != None:
data = tools.base642binary(secret)
with open(arguments.secret_binary, "wb") as f:

View file

@ -29,7 +29,7 @@ with open('CHANGELOG.rst', 'r') as f:
setup(
name='Stegano',
version='0.8',
version='0.8.1',
author='Cédric Bonhomme',
author_email='cedric@cedricbonhomme.org',
packages=packages,