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__':
|
if __name__ == '__main__':
|
||||||
# Point of entry in execution mode
|
# Point of entry in execution mode
|
||||||
original_image_file = "./pictures/Lenna.png"
|
from optparse import OptionParser
|
||||||
encoded_image_file = "./pictures/Lenna_enc.png"
|
usage = "usage: %prog hide|reveal [options]"
|
||||||
# at this point don't exceed 255 characters
|
parser = OptionParser(usage)
|
||||||
secret_message = "Parce que je le vaut bien!"
|
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)
|
(options, args) = parser.parse_args()
|
||||||
img_encoded = hide(img1, secret_message)
|
|
||||||
|
|
||||||
if img_encoded:
|
|
||||||
# Save it
|
if sys.argv[1] == "hide":
|
||||||
img_encoded.save(encoded_image_file)
|
img = Image.open(options.input_image_file)
|
||||||
# Test it
|
img_encoded = hide(img, options.secret)
|
||||||
img2 = Image.open(encoded_image_file)
|
img_encoded.save(options.output_image_file)
|
||||||
print reveal(img2)
|
|
||||||
else:
|
elif sys.argv[1] == "reveal":
|
||||||
print("text too long! (don't exeed 255 characters)")
|
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__':
|
if __name__ == '__main__':
|
||||||
# Point of entry in execution mode.
|
# Point of entry in execution mode.
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
parser = OptionParser()
|
usage = "usage: %prog hide|reveal [options]"
|
||||||
|
parser = OptionParser(usage)
|
||||||
parser.add_option("-i", "--input", dest="input_image_file",
|
parser.add_option("-i", "--input", dest="input_image_file",
|
||||||
help="Image file")
|
help="Image file")
|
||||||
parser.add_option("-o", "--output", dest="output_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 = hide(img, options.secret)
|
||||||
img_encoded.save(options.output_image_file)
|
img_encoded.save(options.output_image_file)
|
||||||
|
|
||||||
if sys.argv[1] == "reveal":
|
elif sys.argv[1] == "reveal":
|
||||||
img = Image.open(options.input_image_file)
|
img = Image.open(options.input_image_file)
|
||||||
print reveal(img)
|
print reveal(img)
|
|
@ -34,16 +34,16 @@ def steganalyse(img):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Point of entry in execution mode
|
# Point of entry in execution mode
|
||||||
original_image_file = "./pictures/free.png"
|
from optparse import OptionParser
|
||||||
encoded_image_file = "./pictures/free_enc.png"
|
parser = OptionParser()
|
||||||
original_image_file_steganalysed = "./pictures/free_steganalysed.png"
|
parser.add_option("-i", "--input", dest="input_image_file",
|
||||||
encoded_image_file_steganalysed = "./pictures/free_enc_steganalysed.png"
|
help="Image file")
|
||||||
|
parser.add_option("-o", "--output", dest="output_image_file",
|
||||||
img_original_image_file = Image.open(original_image_file)
|
help="Image file")
|
||||||
img_encoded_image_file = Image.open(encoded_image_file)
|
parser.set_defaults(input_image_file = './pictures/Lenna.png',
|
||||||
|
output_image_file = './pictures/Lenna_steganalysed.png')
|
||||||
img_original_image_steganalysde = steganalyse(img_original_image_file)
|
(options, args) = parser.parse_args()
|
||||||
img_encoded_image_steganalysed = steganalyse(img_encoded_image_file)
|
|
||||||
|
input_image_file = Image.open(options.input_image_file)
|
||||||
img_original_image_steganalysde.save(original_image_file_steganalysed)
|
output_image = steganalyse(input_image_file)
|
||||||
img_encoded_image_steganalysed.save(encoded_image_file_steganalysed)
|
output_image.save(options.output_image_file)
|
Loading…
Add table
Reference in a new issue