diff --git a/bin/slsb b/bin/lsb similarity index 95% rename from bin/slsb rename to bin/lsb index 1fa4893..4cd66db 100755 --- a/bin/slsb +++ b/bin/lsb @@ -25,7 +25,7 @@ __date__ = "$Date: 2016/03/18 $" __license__ = "GPLv3" try: - from stegano import slsb + from stegano import lsb except: print("Install Stegano: sudo pip install Stegano") @@ -68,7 +68,7 @@ if options.hide: elif options.secret_message == "" and options.secret_file != "": secret = tools.binary2base64(options.secret_file) - img_encoded = slsb.hide(options.input_image_file, secret) + img_encoded = lsb.hide(options.input_image_file, secret) try: img_encoded.save(options.output_image_file) except Exception as e: @@ -76,7 +76,7 @@ if options.hide: print(e) elif options.reveal: - secret = slsb.reveal(options.input_image_file) + secret = lsb.reveal(options.input_image_file) if options.secret_binary != "": data = tools.base642binary(secret) with open(options.secret_binary, "w") as f: diff --git a/bin/slsb-set b/bin/lsb-set similarity index 94% rename from bin/slsb-set rename to bin/lsb-set index b45ecb3..0712b14 100755 --- a/bin/slsb-set +++ b/bin/lsb-set @@ -25,7 +25,7 @@ __date__ = "$Date: 2016/03/18 $" __license__ = "GPLv3" try: - from stegano import slsbset + from stegano import lsbset except: print("Install stegano: sudo pip install Stegano") @@ -74,7 +74,7 @@ if options.hide: elif options.secret_message == "" and options.secret_file != "": secret = tools.binary2base64(options.secret_file) - img_encoded = slsbset.hide(options.input_image_file, secret, options.generator_function) + img_encoded = lsbset.hide(options.input_image_file, secret, options.generator_function) try: img_encoded.save(options.output_image_file) except Exception as e: @@ -83,7 +83,7 @@ if options.hide: elif options.reveal: try: - secret = slsbset.reveal(options.input_image_file, options.generator_function) + secret = lsbset.reveal(options.input_image_file, options.generator_function) except IndexError: print("Impossible to detect message.") exit(0) diff --git a/docs/index.rst b/docs/index.rst index 65a6bc5..70c763a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -46,7 +46,7 @@ Turorial tutorial -You can also take a look at the +You can also have a look at the `unit tests `_. diff --git a/examples/example1.sh b/examples/example1.sh index 8f0d353..0bebc12 100755 --- a/examples/example1.sh +++ b/examples/example1.sh @@ -1,6 +1,6 @@ #!/bin/sh wget http://www.gnu.org/music/free-software-song.ogg -slsb --hide -i ./pictures/Montenach.png -o ./pictures/Montenach_enc.png -f ./free-software-song.ogg +lsb --hide -i ./pictures/Montenach.png -o ./pictures/Montenach_enc.png -f ./free-software-song.ogg rm free-software-song.ogg -slsb --reveal -i ./pictures/Montenach_enc.png -b ./zik.ogg +lsb --reveal -i ./pictures/Montenach_enc.png -b ./zik.ogg diff --git a/examples/example2.sh b/examples/example2.sh index 62a54af..9694924 100755 --- a/examples/example2.sh +++ b/examples/example2.sh @@ -7,20 +7,20 @@ echo "We're going to test a little Stéganô..." echo "Hide the message with the Sieve of Eratosthenes..." -slsb-set --hide -i ./pictures/Montenach.png -o ./surprise.png --generator eratosthenes -m 'Joyeux Noël!' +lsb-set --hide -i ./pictures/Montenach.png -o ./surprise.png --generator eratosthenes -m 'Joyeux Noël!' echo "" echo "Try to reveal with Mersenne numbers..." -slsb-set --reveal --generator mersenne -i ./surprise.png +lsb-set --reveal --generator mersenne -i ./surprise.png echo "" echo "Try to reveal with fermat numbers..." -slsb-set --reveal --generator fermat -i ./surprise.png +lsb-set --reveal --generator fermat -i ./surprise.png echo "" echo "Try to reveal with carmichael numbers..." -slsb-set --reveal --generator carmichael -i ./surprise.png +lsb-set --reveal --generator carmichael -i ./surprise.png echo "" echo "Try to reveal with Sieve of Eratosthenes..." -slsb-set --reveal --generator eratosthenes -i ./surprise.png +lsb-set --reveal --generator eratosthenes -i ./surprise.png diff --git a/examples/example3.sh b/examples/example3.sh index 813e08e..560293c 100644 --- a/examples/example3.sh +++ b/examples/example3.sh @@ -5,18 +5,18 @@ # Hide the message - LSB with a set defined by the identity function (f(x) = x). -slsb-set --hide -i examples/pictures/Montenach.png -o ~/enc-identity.png --generator identity -m 'I like steganography.' +lsb-set --hide -i examples/pictures/Montenach.png -o ~/enc-identity.png --generator identity -m 'I like steganography.' # Hide the message - LSB only. -slsb --hide -i examples/pictures/Montenach.png -o ~/enc.png -m 'I like steganography.' +lsb --hide -i examples/pictures/Montenach.png -o ~/enc.png -m 'I like steganography.' # Check if the two generated files are the same. -sha1sum ~/enc-identity.png ~/enc.png +sha1sum ~/enc-identity.png ~/enc.png # The output of slsb is given to slsb-set. -slsb-set --reveal -i ~/enc.png --generator identity +lsb-set --reveal -i ~/enc.png --generator identity # The output of slsb-set is given to slsb. -slsb --reveal -i ~/enc-identity.png +lsb --reveal -i ~/enc-identity.png diff --git a/examples/example4.sh b/examples/example4.sh index cf250b7..a7fda98 100755 --- a/examples/example4.sh +++ b/examples/example4.sh @@ -6,7 +6,7 @@ echo "Hide the message with Sieve of Eratosthenes..." -slsb-set --hide -i ./pictures/Ginnifer-Goodwin.png -o ./surprise.png --generator eratosthenes -m 'Probably the most beautiful woman in the world.' +lsb-set --hide -i ./pictures/Ginnifer-Goodwin.png -o ./surprise.png --generator eratosthenes -m 'Probably the most beautiful woman in the world.' echo "" echo "Steganalysis of the original photo..." @@ -18,4 +18,4 @@ echo "" echo "Reveal with Sieve of Eratosthenes..." echo "The secret is:" -slsb-set --reveal --generator eratosthenes -i ./surprise.png \ No newline at end of file +lsb-set --reveal --generator eratosthenes -i ./surprise.png diff --git a/setup.py b/setup.py index 1acaf0f..cafe0aa 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,12 @@ except ImportError: from distutils.core import setup packages = [ - 'stegano' + 'stegano', + 'stegano.red', + 'stegano.exifHeader', + 'stegano.lsb', + 'stegano.lsbset', + 'stegano.steganalysis' ] requires = ['pillow', 'piexif'] @@ -28,7 +33,7 @@ setup( author_email='cedric@cedricbonhomme.org', packages=packages, include_package_data=True, - scripts=['bin/slsb', 'bin/slsb-set', 'bin/steganalysis-parity'], + scripts=['bin/lsb', 'bin/lsb-set', 'bin/steganalysis-parity'], url='https://github.com/cedricbonhomme/Stegano', description='A Python Steganography module.', long_description=readme + '\n\n' + changelog, diff --git a/stegano/__init__.py b/stegano/__init__.py index 8d1c8b6..c76943b 100755 --- a/stegano/__init__.py +++ b/stegano/__init__.py @@ -1 +1,9 @@ - +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from . import red +from . import exifHeader +from . import lsb +from . import lsbset + +from . import steganalysis diff --git a/stegano/exifHeader/__init__.py b/stegano/exifHeader/__init__.py new file mode 100644 index 0000000..a4c17d0 --- /dev/null +++ b/stegano/exifHeader/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +from .exifHeader import * diff --git a/stegano/exifHeader.py b/stegano/exifHeader/exifHeader.py similarity index 100% rename from stegano/exifHeader.py rename to stegano/exifHeader/exifHeader.py diff --git a/stegano/lsb/__init__.py b/stegano/lsb/__init__.py new file mode 100644 index 0000000..a3c093c --- /dev/null +++ b/stegano/lsb/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +from .lsb import * diff --git a/stegano/slsb.py b/stegano/lsb/lsb.py similarity index 99% rename from stegano/slsb.py rename to stegano/lsb/lsb.py index 99a8bbb..6f40e9e 100755 --- a/stegano/slsb.py +++ b/stegano/lsb/lsb.py @@ -28,7 +28,7 @@ import sys from PIL import Image -from . import tools +from stegano import tools try: input = raw_input diff --git a/stegano/lsbset/__init__.py b/stegano/lsbset/__init__.py new file mode 100644 index 0000000..034bb97 --- /dev/null +++ b/stegano/lsbset/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +from .lsbset import * diff --git a/stegano/generators.py b/stegano/lsbset/generators.py similarity index 100% rename from stegano/generators.py rename to stegano/lsbset/generators.py diff --git a/stegano/slsbset.py b/stegano/lsbset/lsbset.py similarity index 99% rename from stegano/slsbset.py rename to stegano/lsbset/lsbset.py index b559896..983d9e2 100644 --- a/stegano/slsbset.py +++ b/stegano/lsbset/lsbset.py @@ -28,7 +28,7 @@ import sys from PIL import Image -from . import tools +from stegano import tools from . import generators try: diff --git a/stegano/red/__init__.py b/stegano/red/__init__.py new file mode 100644 index 0000000..72a6728 --- /dev/null +++ b/stegano/red/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +from .red import * diff --git a/stegano/red.py b/stegano/red/red.py similarity index 100% rename from stegano/red.py rename to stegano/red/red.py diff --git a/stegano/steganalysis/__init__.py b/stegano/steganalysis/__init__.py new file mode 100644 index 0000000..aed55fa --- /dev/null +++ b/stegano/steganalysis/__init__.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +#-*- coding: utf-8 -*- + +from .steganalysisParity import * +from .steganalysisStatistics import * diff --git a/stegano/steganalysisParity.py b/stegano/steganalysis/steganalysisParity.py similarity index 100% rename from stegano/steganalysisParity.py rename to stegano/steganalysis/steganalysisParity.py diff --git a/stegano/steganalysisStatistics.py b/stegano/steganalysis/steganalysisStatistics.py similarity index 100% rename from stegano/steganalysisStatistics.py rename to stegano/steganalysis/steganalysisStatistics.py diff --git a/tests/test_slsb.py b/tests/test_lsb.py similarity index 80% rename from tests/test_slsb.py rename to tests/test_lsb.py index 5fb935b..7762fb4 100644 --- a/tests/test_slsb.py +++ b/tests/test_lsb.py @@ -27,18 +27,18 @@ __license__ = "GPLv3" import os import unittest -from stegano import slsb +from stegano import lsb -class TestSLSB(unittest.TestCase): +class TestLSB(unittest.TestCase): def test_hide_empty_message(self): """ Test hiding the empty string. """ - secret = slsb.hide("./examples/pictures/Lenna.png", "") + secret = lsb.hide("./examples/pictures/Lenna.png", "") secret.save("./image.png") - clear_message = slsb.reveal("./image.png") + clear_message = lsb.reveal("./image.png") self.assertEqual("", clear_message) @@ -46,20 +46,20 @@ class TestSLSB(unittest.TestCase): messages_to_hide = ["a", "foo", "Hello World!", ":Python:"] for message in messages_to_hide: - secret = slsb.hide("./examples/pictures/Lenna.png", message) + secret = lsb.hide("./examples/pictures/Lenna.png", message) secret.save("./image.png") - clear_message = slsb.reveal("./image.png") + clear_message = lsb.reveal("./image.png") self.assertEqual(message, clear_message) def test_with_long_message(self): with open("./examples/lorem_ipsum.txt") as f: message = f.read() - secret = slsb.hide("./examples/pictures/Lenna.png", message) + secret = lsb.hide("./examples/pictures/Lenna.png", message) secret.save("./image.png") - clear_message = slsb.reveal("./image.png") + clear_message = lsb.reveal("./image.png") self.assertEqual(message, clear_message) def test_with_too_long_message(self): @@ -67,7 +67,7 @@ class TestSLSB(unittest.TestCase): message = f.read() message += message*2 with self.assertRaises(Exception): - slsb.hide("./examples/pictures/Lenna.png", message) + lsb.hide("./examples/pictures/Lenna.png", message) def tearDown(self): try: diff --git a/tests/test_slsbset.py b/tests/test_lsbset.py similarity index 79% rename from tests/test_slsbset.py rename to tests/test_lsbset.py index ed74499..c5b7d83 100644 --- a/tests/test_slsbset.py +++ b/tests/test_lsbset.py @@ -27,19 +27,19 @@ __license__ = "GPLv3" import os import unittest -from stegano import slsbset +from stegano import lsbset -class TestSLSBSet(unittest.TestCase): +class TestLSBSet(unittest.TestCase): def test_hide_empty_message(self): """ Test hiding the empty string. """ - secret = slsbset.hide("./examples/pictures/Lenna.png", "", + secret = lsbset.hide("./examples/pictures/Lenna.png", "", "eratosthenes") secret.save("./image.png") - clear_message = slsbset.reveal("./image.png", "eratosthenes") + clear_message = lsbset.reveal("./image.png", "eratosthenes") self.assertEqual("", clear_message) @@ -47,23 +47,23 @@ class TestSLSBSet(unittest.TestCase): messages_to_hide = ["a", "foo", "Hello World!", ":Python:"] for message in messages_to_hide: - secret = slsbset.hide("./examples/pictures/Lenna.png", message, + secret = lsbset.hide("./examples/pictures/Lenna.png", message, "eratosthenes") secret.save("./image.png") - clear_message = slsbset.reveal("./image.png", "eratosthenes") + clear_message = lsbset.reveal("./image.png", "eratosthenes") self.assertEqual(message, clear_message) def test_hide_and_reveal_with_bad_generator(self): message_to_hide = "Hello World!" - secret = slsbset.hide("./examples/pictures/Lenna.png", message_to_hide, + secret = lsbset.hide("./examples/pictures/Lenna.png", message_to_hide, "eratosthenes") secret.save("./image.png") with self.assertRaises(IndexError): - clear_message = slsbset.reveal("./image.png", "identity") + clear_message = lsbset.reveal("./image.png", "identity") def tearDown(self): try: