mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Added command line for exif-header.py.
This commit is contained in:
parent
f039e8f9a6
commit
647a5e8fc8
4 changed files with 53 additions and 12 deletions
6
basic.py
6
basic.py
|
@ -85,11 +85,11 @@ if __name__ == '__main__':
|
|||
usage = "usage: %prog hide|reveal [options]"
|
||||
parser = OptionParser(usage)
|
||||
parser.add_option("-i", "--input", dest="input_image_file",
|
||||
help="Image file")
|
||||
help="Image file.")
|
||||
parser.add_option("-o", "--output", dest="output_image_file",
|
||||
help="Image file")
|
||||
help="Image file.")
|
||||
parser.add_option("-s", "--secret", dest="secret",
|
||||
help="Your secret (Message, Image, Music or any binary file.)")
|
||||
help="Your secret (Message, Image, Music or any binary file).")
|
||||
parser.set_defaults(input_image_file = './pictures/Lenna.png',
|
||||
output_image_file = './pictures/Lenna_enc.png',
|
||||
secret = 'Hello World!')
|
||||
|
|
|
@ -26,7 +26,8 @@ __license__ = "GPLv3"
|
|||
|
||||
# Thanks to: http://www.julesberman.info/spec2img.htm
|
||||
|
||||
def hide(img, img_enc, copyright="http://bitbucket.org/cedricbonhomme/stegano"):
|
||||
def hide(img, img_enc, copyright="http://bitbucket.org/cedricbonhomme/stegano", \
|
||||
secret_message = None, secret_file = None):
|
||||
"""
|
||||
"""
|
||||
import shutil
|
||||
|
@ -36,12 +37,16 @@ def hide(img, img_enc, copyright="http://bitbucket.org/cedricbonhomme/stegano"):
|
|||
from base64 import b64encode
|
||||
from exif.minimal_exif_writer import MinimalExifWriter
|
||||
|
||||
file = open("lorem_ipsum.txt", "r")
|
||||
if secret_file != None:
|
||||
with open(secret_file, "r") as f:
|
||||
secret_file_content = f.read()
|
||||
text = "\nImage annotation date: "
|
||||
text = text + str(datetime.date.today())
|
||||
text = text + "\nImage description:\n"
|
||||
text = compress(b64encode(text + file.read()))
|
||||
file.close()
|
||||
if secret_file != None:
|
||||
text = compress(b64encode(text + secret_file_content))
|
||||
else:
|
||||
text = compress(b64encode(text + secret_message))
|
||||
|
||||
try:
|
||||
shutil.copy(img, img_enc)
|
||||
|
@ -73,5 +78,41 @@ def reveal(img):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
hide(img='./pictures/Elisha-Cuthbert.jpg', img_enc='./pictures/Elisha-Cuthbert_enc.jpg')
|
||||
reveal(img='./pictures/Elisha-Cuthbert_enc.jpg')
|
||||
# Point of entry in execution mode.
|
||||
from optparse import OptionParser
|
||||
parser = OptionParser(version=__version__)
|
||||
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
|
||||
parser.add_option("-i", "--input", dest="input_image_file",
|
||||
help="Input image file.")
|
||||
# Image containing the secret
|
||||
parser.add_option("-o", "--output", dest="output_image_file",
|
||||
help="Output image containing the secret.")
|
||||
|
||||
# Secret raw message to hide
|
||||
parser.add_option("-m", "--secret-message", dest="secret_message",
|
||||
help="Your raw secret message to hide.")
|
||||
|
||||
# Secret text file to hide.
|
||||
parser.add_option("-f", "--secret-file", dest="secret_file",
|
||||
help="Your secret textt file to hide.")
|
||||
|
||||
parser.set_defaults(input_image_file = './pictures/Elisha-Cuthbert.jpg',
|
||||
output_image_file = './pictures/Elisha-Cuthbert_enc.jpg',
|
||||
secret_message = '', secret_file = '')
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if options.hide:
|
||||
if options.secret_message != "" and options.secret_file == "":
|
||||
hide(img=options.input_image_file, img_enc=options.output_image_file, \
|
||||
secret_message=options.secret_message)
|
||||
elif options.secret_message == "" and options.secret_file != "":
|
||||
hide(img=options.input_image_file, img_enc=options.output_image_file, \
|
||||
secret_file=options.secret_file)
|
||||
|
||||
elif options.reveal:
|
||||
reveal(img=options.input_image_file)
|
2
lsb-s.py
2
lsb-s.py
|
@ -106,7 +106,7 @@ if __name__ == '__main__':
|
|||
help="Reveals the message hided in an image.")
|
||||
# Original image
|
||||
parser.add_option("-i", "--input", dest="input_image_file",
|
||||
help="Input image fil.e")
|
||||
help="Input image file.")
|
||||
# Image containing the secret
|
||||
parser.add_option("-o", "--output", dest="output_image_file",
|
||||
help="Output image containing the secret.")
|
||||
|
|
|
@ -58,9 +58,9 @@ if __name__ == '__main__':
|
|||
from optparse import OptionParser
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="input_image_file",
|
||||
help="Image file")
|
||||
help="Image file.")
|
||||
parser.add_option("-o", "--output", dest="output_image_file",
|
||||
help="Image file")
|
||||
help="Image file.")
|
||||
parser.set_defaults(input_image_file = './pictures/Lenna.png',
|
||||
output_image_file = './pictures/Lenna_steganalysed.png')
|
||||
(options, args) = parser.parse_args()
|
||||
|
|
Loading…
Add table
Reference in a new issue