Skip to content

Commit

Permalink
chore: Update files to match pypi requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
computationalcore committed Feb 6, 2018
1 parent 40c0b45 commit 0cf20eb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 123 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 computationalcore
Copyright (c) 2017-2018 computationalcore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.rst
include LICENSE
181 changes: 83 additions & 98 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Cryptosteganography
=================
===================

A python steganography module to store messages or files protected with
AES-256 encryption inside an image.
Expand All @@ -10,129 +10,114 @@ no one, apart from the sender and intended recipient, suspects the
existence of the message. By default steganography is a type of security
through obscurity.

Additionally this module also enhanced the security of image steganography through image encryption. The data concealed
Additionally this module also enhance the security of the steganography through data encryption. The data concealed
is encrypted using AES 256 encryption, a popular algorithm used in symmetric key cryptography.

Prerequisites
-------------

`Python 3+ <https://www.python.org/downloads>`__
`Python 3+ <https://www.python.org/downloads>`_

`setuptools <https://github.com/pypa/setuptools>`__
`pip3 <https://pip.pypa.io/en/stable>`_

(Most Linux systems comes with python 3 installed by default).

Dependencies Installation (Ubuntu)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----------------------------------

::
.. code:: bash
$ sudo apt-get install python3-setuptools
$ sudo apt-get install python3-pip
Dependencies Installation (MacOS)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------

To install Python3 I recommend use Homebrew package manager

The script will explain what changes it will make and prompt you before
the installation begins.

::
.. code:: bash
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Edit your ~/.profile to include (if it is not already there)

::
.. code:: bash
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
To install Python 3:

::
.. code:: bash
$ brew install python3
$ pip3 install --upgrade setuptools

::

$ python3

will launch the Python 3 interpreter
Installation
------------

To download and install the project follow the instructions:
To install the package just run

::
.. code:: bash
git clone https://github.com/computationalcore/cryptosteganography
cd cryptosteganography
python3 setup.py install
$ pip3 install cryptosteganography
Usage
-----

Use as a library in a python program
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Store a message string inside an image
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

>>> from cryptosteganography import CryptoSteganography
>>>
>>> crypto_steganography = CryptoSteganography('My secret password key')
>>> # Save the encrypted file inside the image
...
>>> crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', 'My secret message')
>>>
>>> secret = crypto_steganography.retrieve('output_image_file.png')
>>> print(secret)
My secret message

Store a binary file inside an image
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Note: This only works if the concealed file size is smaller than the
input image

::

>>> from cryptosteganography import CryptoSteganography
>>>
>>> message = None
>>> with open('sample.mp3', "rb") as f:
... message = f.read()
...
>>> crypto_steganography = CryptoSteganography('My secret password key')
>>> # Save the encrypted file inside the image
...
>>> crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', message)
>>>
>>> # Retrieve the file ( the previous crypto_steganography instance could be used but I instantiate
>>> # a brand new object with the same password key just to demostrate that can it can be used
>>> # to decrypt)
...
>>> crypto_steganography = CryptoSteganography('My secret password key')
>>> decrypted_bin = crypto_steganography.retrieve('output_image_file.png')
>>>
>>> # Save the data to a new file
>>> with open('decrypted_sample.mp3', 'wb') as f:
... f.write(secret_bin)
...
198658
''''''''''''''''''''''''''''''''''''

**Store a message string inside an image**

.. code:: python
from cryptosteganography import CryptoSteganography
crypto_steganography = CryptoSteganography('My secret password key')
# Save the encrypted file inside the image
crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', 'My secret message')
secret = crypto_steganography.retrieve('output_image_file.png')
print(secret)
# My secret message
**Store a binary file inside an image**

Note: This only works if the concealed file size is smaller than the input image

.. code:: python
from cryptosteganography import CryptoSteganography
message = None
with open('sample.mp3', "rb") as f:
message = f.read()
crypto_steganography = CryptoSteganography('My secret password key')
# Save the encrypted file inside the image
crypto_steganography.hide('input_image_name.jpg', 'output_image_file.png', message)
# Retrieve the file ( the previous crypto_steganography instance could be used but I instantiate a brand new object
# with the same password key just to demonstrate that can it can be used to decrypt)
crypto_steganography = CryptoSteganography('My secret password key')
decrypted_bin = crypto_steganography.retrieve('output_image_file.png')
# Save the data to a new file
with open('decrypted_sample.mp3', 'wb') as f:
f.write(secret_bin)
Use as a python program
~~~~~~~~~~~~~~~~~~~~~~~
'''''''''''''''''''''''

Check help at command line prompt to know how to use it.
**Check help at command line prompt to learn how to use it.**

::
.. code:: bash
$ python3 cryptosteganography.py -h
$ cryptosteganography -h
usage: cryptosteganography [-h] {save,retrieve} ...
A python steganography script that save/retrieve a text/file (AES 256
Expand All @@ -146,11 +131,11 @@ Check help at command line prompt to know how to use it.
optional arguments:
-h, --help show this help message and exit
Save sub command help
**Save sub command help**

::
.. code:: bash
$ python3 cryptosteganography.py save -h
$ cryptosteganography save -h
usage: cryptosteganography save [-h] -i INPUT_IMAGE_FILE
(-m MESSAGE | -f MESSAGE_FILE) -o
OUTPUT_IMAGE_FILE
Expand All @@ -166,11 +151,11 @@ Save sub command help
-o OUTPUT_IMAGE_FILE, --output OUTPUT_IMAGE_FILE
Output image containing the secret.
Retrieve sub command help
**Retrieve sub command help**

::
.. code:: bash
$ python3 cryptosteganography.py retrieve -h
$ cryptosteganography retrieve -h
usage: cryptosteganography retrieve [-h] -i INPUT_IMAGE_FILE [-o RETRIEVED_FILE]
optional arguments:
Expand All @@ -181,45 +166,45 @@ Retrieve sub command help
Output for the binary secret file (Text or any binary
file).
Save message example
**Save message example**

::
.. code:: bash
$ python3 cryptosteganography.py save -i 4824157.png -m "My secret message..." -o output.png
$ cryptosteganography save -i 4824157.png -m "My secret message..." -o output.png
Enter the key password:
Confirm the key password:
Output image output.png saved with success
Retrieve message example
**Retrieve message example**

::
.. code:: bash
$ python3 cryptosteganography.py retrieve -i output.png
$ cryptosteganography retrieve -i output.png
Enter the key password:
My secret message...
Save file example
**Save file example**

::
.. code:: bash
$ python3 cryptosteganography.py save -i input_image_name.jpg -f duck_logo.pem -o output_file.png
$ cryptosteganography save -i input_image_name.jpg -f duck_logo.pem -o output_file.png
Enter the key password:
Confirm the key password:
Output image output_file.png saved with success
Retrieve file example
**Retrieve file example**

::
.. code:: bash
$ python3 cryptosteganography.py retrieve -i output.png -o decrypted_file
$ cryptosteganography retrieve -i output.png -o decrypted_file
Enter the key password:
decrypted_file saved with success
License
-------

This project is licensed under the MIT License - see the
`LICENSE <LICENSE>`__ file for details
`LICENSE <https://github.com/computationalcore/cryptosteganography/blob/master/LICENSE>`_ file for details

Limitations
-----------
Expand All @@ -228,10 +213,10 @@ Limitations
- It does not work if the conceived file is greater than original input
file
- I did not tested with all conceived file types. Feel free to
`report </issues>`__ any bug you find
`report <https://github.com/computationalcore/cryptosteganography/issues>`_ any bug you find

Acknowledgments
---------------

- `PyCryptodome <https://github.com/Legrandin/pycryptodome>`__
- `Stéganô <https://github.com/cedricbonhomme/Stegano>`__
- `PyCryptodome <https://github.com/Legrandin/pycryptodome>`_
- `Stéganô <https://github.com/cedricbonhomme/Stegano>`_
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[metadata]
description-file = README.rst
license_file = LICENSE
26 changes: 2 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,11 @@ def readme():

setup(
name='cryptosteganography',
version='0.2.1',
version='0.2.0',
py_modules=['cryptosteganography'],
description='A python steganography module to store messages or files protected with AES-256 encryption inside an image.',
long_description=readme(),
url='https://github.com/computationalcore/cryptosteganography',
author='Vin Busquet',
author_email='[email protected]',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Topic :: Security',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6'
],
keywords=['steganography', 'cryptography', 'encryption', 'aes', 'cryptosteganography', 'image'],
install_requires=install_requires,
python_requires='>=3',
entry_points={
'console_scripts': ['cryptosteganography=cryptosteganography:main'],
}
license='MIT'
)

0 comments on commit 0cf20eb

Please sign in to comment.