mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Command line improvement.
This commit is contained in:
parent
2f34fac27c
commit
96a65a45a2
1 changed files with 8 additions and 5 deletions
13
lsb-s.py
13
lsb-s.py
|
@ -126,8 +126,11 @@ def reveal_slow(img):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Point of entry in execution mode.
|
# Point of entry in execution mode.
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
usage = "usage: %prog hide|reveal [options]"
|
parser = OptionParser(version=__version__)
|
||||||
parser = OptionParser(usage)
|
parser.add_option('--hide', action='store_true', default=False,
|
||||||
|
help="Hides a message in an image.")
|
||||||
|
parser.add_option('--reveal', action='store_true', default=False,
|
||||||
|
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 fil.e")
|
help="Input image fil.e")
|
||||||
|
@ -153,7 +156,7 @@ if __name__ == '__main__':
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
if sys.argv[1] == "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 != "":
|
||||||
|
@ -167,7 +170,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 sys.argv[1] == "reveal":
|
elif options.reveal:
|
||||||
img = Image.open(options.input_image_file)
|
img = Image.open(options.input_image_file)
|
||||||
secret = reveal(img)
|
secret = reveal(img)
|
||||||
if options.secret_binary != "":
|
if options.secret_binary != "":
|
||||||
|
@ -175,4 +178,4 @@ if __name__ == '__main__':
|
||||||
with open(options.secret_binary, "w") as f:
|
with open(options.secret_binary, "w") as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
else:
|
else:
|
||||||
print secret
|
print secret
|
Loading…
Add table
Reference in a new issue