mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Added command line for steganalysis-parity.py and basic.py.
This commit is contained in:
parent
ae93079b99
commit
5d00f6334b
3 changed files with 38 additions and 29 deletions
36
basic.py
36
basic.py
|
@ -61,19 +61,27 @@ def reveal(img):
|
|||
|
||||
if __name__ == '__main__':
|
||||
# Point of entry in execution mode
|
||||
original_image_file = "./pictures/Lenna.png"
|
||||
encoded_image_file = "./pictures/Lenna_enc.png"
|
||||
# at this point don't exceed 255 characters
|
||||
secret_message = "Parce que je le vaut bien!"
|
||||
from optparse import OptionParser
|
||||
usage = "usage: %prog hide|reveal [options]"
|
||||
parser = OptionParser(usage)
|
||||
parser.add_option("-i", "--input", dest="input_image_file",
|
||||
help="Image file")
|
||||
parser.add_option("-o", "--output", dest="output_image_file",
|
||||
help="Image file")
|
||||
parser.add_option("-s", "--secret", dest="secret",
|
||||
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!')
|
||||
|
||||
img1 = Image.open(original_image_file)
|
||||
img_encoded = hide(img1, secret_message)
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if img_encoded:
|
||||
# Save it
|
||||
img_encoded.save(encoded_image_file)
|
||||
# Test it
|
||||
img2 = Image.open(encoded_image_file)
|
||||
print reveal(img2)
|
||||
else:
|
||||
print("text too long! (don't exeed 255 characters)")
|
||||
|
||||
if sys.argv[1] == "hide":
|
||||
img = Image.open(options.input_image_file)
|
||||
img_encoded = hide(img, options.secret)
|
||||
img_encoded.save(options.output_image_file)
|
||||
|
||||
elif sys.argv[1] == "reveal":
|
||||
img = Image.open(options.input_image_file)
|
||||
print reveal(img)
|
5
lsb-s.py
5
lsb-s.py
|
@ -108,7 +108,8 @@ def reveal_slow(img):
|
|||
if __name__ == '__main__':
|
||||
# Point of entry in execution mode.
|
||||
from optparse import OptionParser
|
||||
parser = OptionParser()
|
||||
usage = "usage: %prog hide|reveal [options]"
|
||||
parser = OptionParser(usage)
|
||||
parser.add_option("-i", "--input", dest="input_image_file",
|
||||
help="Image file")
|
||||
parser.add_option("-o", "--output", dest="output_image_file",
|
||||
|
@ -127,6 +128,6 @@ if __name__ == '__main__':
|
|||
img_encoded = hide(img, options.secret)
|
||||
img_encoded.save(options.output_image_file)
|
||||
|
||||
if sys.argv[1] == "reveal":
|
||||
elif sys.argv[1] == "reveal":
|
||||
img = Image.open(options.input_image_file)
|
||||
print reveal(img)
|
|
@ -34,16 +34,16 @@ def steganalyse(img):
|
|||
|
||||
if __name__ == '__main__':
|
||||
# Point of entry in execution mode
|
||||
original_image_file = "./pictures/free.png"
|
||||
encoded_image_file = "./pictures/free_enc.png"
|
||||
original_image_file_steganalysed = "./pictures/free_steganalysed.png"
|
||||
encoded_image_file_steganalysed = "./pictures/free_enc_steganalysed.png"
|
||||
|
||||
img_original_image_file = Image.open(original_image_file)
|
||||
img_encoded_image_file = Image.open(encoded_image_file)
|
||||
|
||||
img_original_image_steganalysde = steganalyse(img_original_image_file)
|
||||
img_encoded_image_steganalysed = steganalyse(img_encoded_image_file)
|
||||
|
||||
img_original_image_steganalysde.save(original_image_file_steganalysed)
|
||||
img_encoded_image_steganalysed.save(encoded_image_file_steganalysed)
|
||||
from optparse import OptionParser
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="input_image_file",
|
||||
help="Image file")
|
||||
parser.add_option("-o", "--output", dest="output_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()
|
||||
|
||||
input_image_file = Image.open(options.input_image_file)
|
||||
output_image = steganalyse(input_image_file)
|
||||
output_image.save(options.output_image_file)
|
Loading…
Add table
Reference in a new issue