From 1def5672abbc105091e7fd640bd068012fb77fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Sun, 22 May 2016 22:30:32 +0200 Subject: [PATCH] Updated documentation. --- docs/index.rst | 10 +-- docs/installation.rst | 18 +++++ docs/module.rst | 109 ++++++++++++++++++++++++++++ docs/{tutorial.rst => software.rst} | 74 ------------------- docs/steganalysis.rst | 19 +++++ 5 files changed, 151 insertions(+), 79 deletions(-) create mode 100644 docs/installation.rst create mode 100644 docs/module.rst rename docs/{tutorial.rst => software.rst} (60%) create mode 100644 docs/steganalysis.rst diff --git a/docs/index.rst b/docs/index.rst index 70c763a..db975eb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,9 +3,6 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to Stéganô's documentation! -=================================== - Presentation ============ @@ -33,7 +30,7 @@ Moreover some methods of steganalysis_ are provided: Requirements ============ -- Python_ >= 3.2 (tested with Python 3.5.1); +- Python_ 3 (tested with Python 3.5.1); - `Pillow`_; - `piexif`_. @@ -44,7 +41,10 @@ Turorial .. toctree:: :maxdepth: 2 - tutorial + installation + module + software + steganalysis You can also have a look at the `unit tests `_. diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 0000000..e22cbe8 --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,18 @@ +Installation +============ + +.. code-block:: bash + + $ sudo pip install Stegano + +You will be able to use Stéganô in your Python programs +or as a command line tool. + +If you want to retrieve the source code (with the unit tests): + +.. code-block:: bash + + $ git clone https://github.com/cedricbonhomme/Stegano.git + +.. image:: https://api.travis-ci.org/cedricbonhomme/Stegano.svg?branch=master + :target: https://travis-ci.org/cedricbonhomme/Stegano diff --git a/docs/module.rst b/docs/module.rst new file mode 100644 index 0000000..cd660aa --- /dev/null +++ b/docs/module.rst @@ -0,0 +1,109 @@ +Using Stéganô as a Python module +================================ + +LSB method +---------- + +.. code-block:: python + + Python 3.5.1 (default, Dec 7 2015, 11:33:57) + [GCC 4.9.2] on linux + Type "help", "copyright", "credits" or "license" for more information. + >>> from stegano import lsb + >>> secret = lsb.hide("./tests/sample-files/Lenna.png", "Hello world!") + >>> secret.save("./Lenna-secret.png") + >>> print(lsb.reveal("./Lenna-secret.png")) + Hello world! + + + +LSB method with sets +-------------------- + +Sets are used in order to select the pixels where the message will be hidden. + +.. code-block:: python + + Python 3.5.1 (default, Dec 7 2015, 11:33:57) + [GCC 4.9.2] on linux + Type "help", "copyright", "credits" or "license" for more information. + >>> from stegano import lsbset + >>> from stegano.lsbset import generators + + # Hide a secret with the Sieve of Eratosthenes + >>> secret_message = "Hello World!" + >>> secret_image = lsbset.hide("./tests/sample-files/Lenna.png", + secret_message, + generators.eratosthenes()) + >>> secret_image.save("./image.png") + + # Try to decode with another generator + >>> message = lsbset.reveal("./image.png", generators.fibonacci()) + Traceback (most recent call last): + File "", line 1, in + File "/home/cedric/projects/Stegano/stegano/lsbset/lsbset.py", line 111, in reveal + for color in img_list[generated_number]: + IndexError: list index out of range + + # Decode with Eratosthenes + >>> message = lsbset.reveal("./image.png", generators.eratosthenes()) + >>> message + 'Hello World!' + + >>> # Generators available + >>> import inspect + >>> all_generators = inspect.getmembers(generators, inspect.isfunction) + >>> for generator in all_generators: + ... print(generator[0], generator[1].__doc__) + ... + Dead_Man_Walking None + OEIS_A000217 + http://oeis.org/A000217 + Triangular numbers: a(n) = C(n+1,2) = n(n+1)/2 = 0+1+2+...+n. + + ackermann + Ackermann number. + + carmichael None + eratosthenes + Generate the prime numbers with the sieve of Eratosthenes. + + eratosthenes_composite + Generate the composite numbers with the sieve of Eratosthenes. + + fermat + Generate the n-th Fermat Number. + + fibonacci + A generator for Fibonacci numbers, goes to next number in series on each call. + This generator start at 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, ... + See: http://oeis.org/A000045 + + identity + f(x) = x + + log_gen + Logarithmic generator. + + mersenne + Generate 2^n-1. + + syracuse + Generate the sequence of Syracuse. + + + +Description field of the image +------------------------------ + +For JPEG and TIFF images. + +.. code-block:: python + + Python 3.5.1 (default, Dec 7 2015, 11:33:57) + [GCC 4.9.2] on linux + Type "help", "copyright", "credits" or "license" for more information. + >>> from stegano import exifHeader + >>> secret = exifHeader.hide("./tests/sample-files/20160505T130442.jpg", + "./image.jpg", secret_message="Hello world!") + >>> print(exifHeader.reveal("./image.jpg")) diff --git a/docs/tutorial.rst b/docs/software.rst similarity index 60% rename from docs/tutorial.rst rename to docs/software.rst index c992acf..6feffb6 100644 --- a/docs/tutorial.rst +++ b/docs/software.rst @@ -1,57 +1,3 @@ -Installation -============ - -.. code-block:: bash - - $ sudo pip install Stegano - -You will be able to use Stéganô in your Python programs -or as a command line tool. - -If you want to retrieve the source code (with the unit tests): - -.. code-block:: bash - - $ git clone https://github.com/cedricbonhomme/Stegano.git - -.. image:: https://api.travis-ci.org/cedricbonhomme/Stegano.svg?branch=master - :target: https://travis-ci.org/cedricbonhomme/Stegano - -Using Stéganô as a Python module -================================ - -LSB method ----------- - -.. code-block:: python - - Python 3.5.1 (default, Dec 7 2015, 11:33:57) - [GCC 4.9.2] on linux - Type "help", "copyright", "credits" or "license" for more information. - >>> from stegano import slsb - >>> secret = slsb.hide("./tests/sample-files/Lenna.png", "Hello world!") - >>> secret.save("./Lenna-secret.png") - >>> print(slsb.reveal("./Lenna-secret.png")) - Hello world! - -Description field of the image ------------------------------- - -For JPEG and TIFF images. - -.. code-block:: python - - Python 3.5.1 (default, Dec 7 2015, 11:33:57) - [GCC 4.9.2] on linux - Type "help", "copyright", "credits" or "license" for more information. - >>> from stegano import exifHeader - >>> secret = exifHeader.hide("./tests/sample-files/20160505T130442.jpg", - "./image.jpg", secret_message="Hello world!") - >>> print(exifHeader.reveal("./image.jpg")) - -More examples are available in the -`tests `_. - Using Stéganô in command line for your scripts ============================================== @@ -144,23 +90,3 @@ An other example: # The output of lsb-set is given to lsb. lsb --reveal -i ./enc-identity.png - - - - -Steganalysis -============ - -.. code-block:: bash - - # Hide the message with Sieve of Eratosthenes - lsb-set --hide -i ./tests/sample-files/Ginnifer-Goodwin.png -o ./surprise.png --generator eratosthenes -m 'Very important message.' - - # Steganalysis of the original photo - steganalysis-parity -i ./tests/sample-files/Ginnifer-Goodwin.png -o ./surprise_st_original.png - - # Steganalysis of the secret photo - steganalysis-parity -i ./surprise.png -o ./surprise_st_secret.png - - # Reveal with Sieve of Eratosthenes - lsb-set --reveal --generator eratosthenes -i ./surprise.png diff --git a/docs/steganalysis.rst b/docs/steganalysis.rst new file mode 100644 index 0000000..f3c27a9 --- /dev/null +++ b/docs/steganalysis.rst @@ -0,0 +1,19 @@ +Steganalysis +============ + +Parity +------ + +.. code-block:: bash + + # Hide the message with Sieve of Eratosthenes + lsb-set --hide -i ./tests/sample-files/Ginnifer-Goodwin.png -o ./surprise.png --generator eratosthenes -m 'Very important message.' + + # Steganalysis of the original photo + steganalysis-parity -i ./tests/sample-files/Ginnifer-Goodwin.png -o ./surprise_st_original.png + + # Steganalysis of the secret photo + steganalysis-parity -i ./surprise.png -o ./surprise_st_secret.png + + # Reveal with Sieve of Eratosthenes + lsb-set --reveal --generator eratosthenes -i ./surprise.png