The generator provided to lsbset.hide() lsbset.reveal() is now a function. Closes #5.

This commit is contained in:
Cédric Bonhomme 2016-05-22 15:23:54 +02:00
parent a0f6f24d7c
commit f8668a978e
No known key found for this signature in database
GPG key ID: A1CB94DE57B7A70D
3 changed files with 29 additions and 23 deletions

View file

@ -20,12 +20,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.5 $"
__version__ = "$Revision: 0.5.1 $"
__date__ = "$Date: 2016/03/18 $"
__revision__ = "$Date: 2016/05/22 $"
__license__ = "GPLv3"
try:
from stegano import lsbset
from stegano.lsbset import generators
except:
print("Install stegano: sudo pip install Stegano")
@ -67,6 +69,10 @@ parser.set_defaults(input_image_file = './pictures/Lenna.png',
(options, args) = parser.parse_args()
try:
generator = getattr(generators, options.generator_function)()
except AttributeError as e:
raise e
if options.hide:
if options.secret_message != "" and options.secret_file == "":
@ -74,7 +80,7 @@ if options.hide:
elif options.secret_message == "" and options.secret_file != "":
secret = tools.binary2base64(options.secret_file)
img_encoded = lsbset.hide(options.input_image_file, secret, options.generator_function)
img_encoded = lsbset.hide(options.input_image_file, secret, generator)
try:
img_encoded.save(options.output_image_file)
except Exception as e:
@ -83,7 +89,7 @@ if options.hide:
elif options.reveal:
try:
secret = lsbset.reveal(options.input_image_file, options.generator_function)
secret = lsbset.reveal(options.input_image_file, generator)
except IndexError:
print("Impossible to detect message.")
exit(0)