This Python script allows you to hide a payload within a JPG image using steganography techniques. It uses the stegano
library to encode and decode messages within the least significant bit (LSB) of the image pixels.
I must emphasize that using such techniques for malicious purposes is unethical and potentially illegal. However, if you have a legitimate use case, such as for educational purposes or digital watermarking.
This code requires two external libraries:
- stegano: This is the core library used for hiding and revealing data within images using Least Significant Bit (LSB) steganography.
- Pillow (PIL Fork): This library provides functionalities for image manipulation, including opening, saving, and processing images.
Use pip:
pip install stegano Pillow
- stegano: This library likely provides functions like hide and reveal for manipulating image data and embedding messages using LSB steganography.
- Pillow (PIL Fork): Pillow is a popular library for image processing in Python. It offers functions like Image.open and save for working with image files in various formats.
Depending on the specific implementation of stegano, the actual function names might differ slightly. Consult the library's documentation for precise details. I'm no expert. Make sure you install the Pillow library, not the original PIL (Python Imaging Library).
- Clone the repository:
git clone https://github.com/basicW/badjpg.git
- Install the required dependencies:
pip install -r requirements.txt
- Install the
stegano
library if you have not already:pip install stegano
- Place the image file (JPG format) you want to hide the payload in within the project directory.
- Run the Python script
steganography.py
. - Follow the prompts to specify the image file path, the payload to hide, and the output file name.
- The script will then encode the payload into the image and save the resulting image with the hidden payload.
To extract the hidden payload from the image:
- Run the Python script
steganography.py
. - Choose the option to extract the payload.
- Provide the path to the image file with the hidden payload.
- The script will reveal the hidden payload from the image.
python steganography.py
- Python 3.x
stegano
library
This project uses the stegano library.