pythonterminalsteganographystepic

Stepic JPEG circumventing Fail


I'm trying to use stepic in the Mac Terminal to decode a steganograph:

stepic --decode --image-in=goldfish.bmp --out=goldfish.txt

The online file is a JPEG but to circumvent the fact I tried downloading it as a .psd and then a .bmp file but it still knows it's a JPEG.

Is their any way to make this work or do I need a different python module? And in the latter case what module. Thanks.


Solution

  • I'm mostly converting my comment to an answer after further clarification from the OP.

    Stepic embeds the information directly to the pixels of an image. Lossy formats, such as jpeg, will change some of these pixels, thereby destroying your secret. Only lossless formats, such as bmp and png, are suitable for this application.

    Since your friend encoded your message and you are the receiver of the steganographic image, there are two places where this process has gone wrong. Either your friend saved the image to jpeg (not clear from the documentation whether the program even allows that), or he was a good boy, but upon uploading it to a website, the website re-encoded to jpeg.

    You should ask him and/or upload a non-jpeg image to the website and download it back and check for file differences between the two. The following python script will print true if the two files are the same, byte by byte.

    a = open('filename before upload', 'rb').read()
    b = open('filename after download', 'rb').read()
    print a == b
    

    If the image was saved to jpeg, simply advise your friend to use a suitable format. If the image was modified during the upload, you either have to use a different uploading service which doesn't re-encode images in a way that detroys the image e.g., saving to different format, cropping or resizing, or you have to use a steganographic algorithm with which your secret can survive such modifications. This is called robust steganography and there is a lot of literature describing such algorithms, though you may not readily find their source code.

    If you're specifically interested in embedding a secret in jpeg images, you have to look for jpeg steganography.

    However, recommending such a tool or software is considered off-topic as per the FAQ.