Minor changes in the slsb executable file.

This commit is contained in:
cedricbonhomme 2011-04-07 21:56:06 +02:00
parent 567315ed1d
commit ea472c0e9a

View file

@ -29,40 +29,38 @@ try:
except: except:
print "Install stegano: python setup.py install" print "Install stegano: python setup.py install"
if __name__ == '__main__': from optparse import OptionParser
# Point of entry in execution mode. parser = OptionParser(version=__version__)
from optparse import OptionParser parser.add_option('--hide', action='store_true', default=False,
parser = OptionParser(version=__version__)
parser.add_option('--hide', action='store_true', default=False,
help="Hides a message in an image.") help="Hides a message in an image.")
parser.add_option('--reveal', action='store_true', default=False, parser.add_option('--reveal', action='store_true', default=False,
help="Reveals the message hided in an image.") help="Reveals the message hided in an image.")
# Original image # Original image
parser.add_option("-i", "--input", dest="input_image_file", parser.add_option("-i", "--input", dest="input_image_file",
help="Input image file.") help="Input image file.")
# Image containing the secret # Image containing the secret
parser.add_option("-o", "--output", dest="output_image_file", parser.add_option("-o", "--output", dest="output_image_file",
help="Output image containing the secret.") help="Output image containing the secret.")
# Non binary secret message to hide # Non binary secret message to hide
parser.add_option("-m", "--secret-message", dest="secret_message", parser.add_option("-m", "--secret-message", dest="secret_message",
help="Your secret message to hide (non binary).") help="Your secret message to hide (non binary).")
# Binary secret to hide (OGG, executable, etc.) # Binary secret to hide (OGG, executable, etc.)
parser.add_option("-f", "--secret-file", dest="secret_file", parser.add_option("-f", "--secret-file", dest="secret_file",
help="Your secret to hide (Text or any binary file).") help="Your secret to hide (Text or any binary file).")
# Output for the binary binary secret. # Output for the binary binary secret.
parser.add_option("-b", "--binary", dest="secret_binary", parser.add_option("-b", "--binary", dest="secret_binary",
help="Output for the binary secret (Text or any binary file).") help="Output for the binary secret (Text or any binary file).")
parser.set_defaults(input_image_file = './pictures/Lenna.png', parser.set_defaults(input_image_file = './pictures/Lenna.png',
output_image_file = './pictures/Lenna_enc.png', output_image_file = './pictures/Lenna_enc.png',
secret_message = '', secret_file = '', secret_binary = "") secret_message = '', secret_file = '', secret_binary = "")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if options.hide: if options.hide:
if options.secret_message != "" and options.secret_file == "": if options.secret_message != "" and options.secret_file == "":
secret = options.secret_message secret = options.secret_message
elif options.secret_message == "" and options.secret_file != "": elif options.secret_message == "" and options.secret_file != "":
@ -75,7 +73,7 @@ if __name__ == '__main__':
# If hide() returns an error (Too long message). # If hide() returns an error (Too long message).
print e print e
elif options.reveal: elif options.reveal:
secret = slsb.reveal(options.input_image_file) secret = slsb.reveal(options.input_image_file)
if options.secret_binary != "": if options.secret_binary != "":
data = tools.base642binary(secret) data = tools.base642binary(secret)