From 61b6ec717583f855adbc948b33fb16e2d8cb3264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Mon, 15 May 2017 22:57:13 +0200 Subject: [PATCH] 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). --- CHANGELOG.rst | 5 +++++ bin/stegano-lsb | 11 +++++++++-- setup.py | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 295a2bb..4db74d3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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-*; diff --git a/bin/stegano-lsb b/bin/stegano-lsb index 85185b9..0cd010e 100755 --- a/bin/stegano-lsb +++ b/bin/stegano-lsb @@ -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: diff --git a/setup.py b/setup.py index 8eeff75..d7eb703 100644 --- a/setup.py +++ b/setup.py @@ -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,