Coder Social home page Coder Social logo

stegpy's Introduction

stegpy

A program for encoding information in image and audio files through steganography. Any type of data can be encoded, from raw strings to files, as shown below:

On the left, a house with a steganographically hidden image. On the right, the extracted hidden image of a cat. It is revealed by removing all but the least significant bit of each color component in the host image.


Supported host formats

  • PNG
  • BMP
  • GIF
  • WebP
  • WAV

Images in a different format are automatically converted to PNG. Different audio formats are not supported at all.


Dependencies

  • numpy
  • cryptography
  • Pillow (PIL fork)

Installation

 pip3 install stegpy

Usage:

Hide a message or file:

 stegpy "Hello World!" image.png

Extract it:

 stegpy _image.png

Data is encoded without any protection by default, but it can be encrypted with the -p flag:

Encrypt:

 stegpy "Hello World!" image.png -p
Enter password (will not be echoed):
Verify password (will not be echoed):
 stegpy _image.png -p
Enter password (will not be echoed):
Hello World!

More options:

 stegpy -h

To do

  • Add docstrings
  • Allow encoding across multiple files
  • Support JPEG & FLAC as hosts

stegpy's People

Contributors

0x08088405 avatar bornunique911 avatar dhsdshdhk avatar izcoser avatar novel-yet-trivial avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stegpy's Issues

'utf-8' codec can't decode byte 0x9d in position 0: invalid start byte

I'm trying to use the library as part of a backend project so i got the code files not the command line tool, the encoding goes just fine. but whenever I try to decode I get this error..
this is the line that causes the problem, in the read_message function

text = bytes(msg[start:end]).decode('utf-8')

Index 0 is out of bounds

Traceback (most recent call last):
File "/usr/local/bin/stegpy", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/stegpy/steg.py", line 52, in main
host.read_message(password)
File "/usr/local/lib/python3.8/dist-packages/stegpy/lsb.py", line 45, in read_message
msg = decode_message(self.data)
File "/usr/local/lib/python3.8/dist-packages/stegpy/lsb.py", line 167, in decode_message
bits = 2 ** ((host_data[0] & 48) >> 4) # bits = 2 ^ (5th and 6th bits)
IndexError: index 0 is out of bounds for axis 0 with size 0

file size increases by huge amount

I used stegpy to embed a message in a .gif file and the resulting file size was about 8 times larger than the original file size.

After embedding my message I got this:

Host dimension: 209,952,000 bytes
Message size: 22 bytes
Maximum size: 52,488,000 bytes

And when looking at the new file's size it was 52M.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.