Download
Anti-Forensics – JPG and ZIP Steganography by File Appending
Introduction
This software is very simple and it performs the following operations:
- Reads the contents of both the JPG and ZIP files in binary mode.
- Concatenates the ZIP file’s content to the end of the JPG file’s content.
- Writes the combined content to a new file.
Code Review
Both the .zip file and .jpg file are read into memory.
def open_zip(self) -> bytes:
with open(self.zip_file_path, 'rb') as zip_obj:
return zip_obj.read()
def open_jpg(self) -> bytes:
with open(self.jpg_file_path, 'rb') as jpg_obj:
return jpg_obj.read()
The files are then simply concatenated.
def combine(self) -> None:
zip_file_data = self.open_zip()
jpg_file_data = self.open_jpg()
combined_file = jpg_file_data + zip_file_data
with open(self.output_file_path, 'wb') as output_obj:
output_obj.write(combined_file)
print("[+] Data combined!")
The two data are combined/concatenated and a resultant jpg is written (output_obj) to the output path.
The resultant .jpg can be opened in archive manager software such as 7zip to ensure that the embedded zip file is accessible.