Steganography by File Appending – Hiding a zip File in a jpg


Anti-Forensics – JPG and ZIP Steganography by File Appending


This software is very simple and it performs the following operations:

  1. Reads the contents of both the JPG and ZIP files in binary mode.
  2. Concatenates the ZIP file’s content to the end of the JPG file’s content.
  3. 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:

    def open_jpg(self) -> bytes:
        with open(self.jpg_file_path, 'rb') as jpg_obj:

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:

        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.


Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest article