Created
July 31, 2016 18:24
-
-
Save NanoDano/98c927f265ade49161bae737e42388c1 to your computer and use it in GitHub Desktop.
Create a stego image/zip archive with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create_stego_zip_jpg.py - Hide a zip file inside a JPEG | |
import sys | |
# Start with a jpeg file | |
jpg_file = open(sys.argv[1], 'rb') # Path to JPEG | |
jpg_data = jpg_file.read() | |
jpg_file.close() | |
# And the zip file to embed in the jpeg | |
zip_file = open(sys.argv[2], 'rb') # Path to ZIP file | |
zip_data = zip_file.read() | |
zip_file.close() | |
# Combine the files | |
out_file = open('special_image.jpg', 'wb') # Output file | |
out_file.write(jpg_data) | |
out_file.write(zip_data) | |
out_file.close() | |
# The resulting output file appears like a normal jpeg but can also be | |
# unzipped and used as an archive. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment