Platform independent Python tool to implement LSB image steganography and a basic detection technique. Features:
How to use:
$ python lsb.py
LSB steganogprahy. Hide files within least significant bits of images.
Usage:
lsb.py hide <img_file> <payload_file> <password>
lsb.py extract <stego_file> <out_file> <password>
lsb.py analyse <stego_file>
All data is encrypted before being embedded into a picture. Encryption is not optional. Two consequences of this are that:
Encrypt and hide an archive:
$ python lsb.py hide samples/orig.jpg samples/secret.zip p@$5w0rD
[*] Input image size: 640x425 pixels.
[*] Usable payload size: 99.61 KB.
[+] Payload size: 74.636 KB
[+] Encrypted payload size: 74.676 KB
[+] samples/secret.zip embedded successfully!
Original image:
Image with 75k archive embedded:
$ python lsb.py extract samples/orig.jpg-stego.png out p@$5w0rD
[+] Image size: 640x425 pixels.
[+] Written extracted data to out.
$ file out
out: Zip archive data, at least v1.0 to extract
A simple way to detect tampering with least significant bits of images is based on the observation above – regions within tampered images will have the average of LSBs around 0.5, because the LSBs contain encrypted data, which is similar in structure with random data. So in order to analyse an image, we split it into blocks, and for each block calculate the average of LSBs. To analyse a file, we use the following syntax:
$ python lsb.py analyse <stego_file>
Example
Now let’s analyse the original:
$ python lsb.py analyse castle.jpg
… and now the one containing our payload:
$ python lsb.py analyse castle.jpg-stego.png
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。