📺 Video Tutorial: Watch how to use the repo here
An educational tool for creating polyglot files — files that are simultaneously valid in multiple formats (e.g., JPEG + PDF, PNG + PDF). Built with Python for steganography research and file structure exploration.
Warning
Educational Purposes Only: This tool is designed for educational purposes and security research. The authors are not responsible for any misuse.
- 🖼️ Multi-Format Support: Generate valid
JPG+PDFandPNG+PDFpolyglot files. - 🎨 Premium UI: Beautiful ASCII art banner and color-coded output via
rich. - 🖱️ Interactive Mode: Easy-to-use wizard for drag-and-drop file selection.
- 🛡️ Auto-Injection: Handles complex chunk injection and comment segmentation automatically.
- 🧠 Smart Validation: Strips quotes from drag-and-drop paths and verifies file headers.
- 📄 Organized Output: Saves results to a dedicated directory with smart naming.
-
Clone the repository
git clone https://github.com/zis3c/Polyglot-File.git cd Polyglot-File -
Install dependencies
pip install -r requirements.txt
Polyglot-File/
├── polyglot_tool.py # Main script to create polyglot files
├── requirements.txt # Python dependencies
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE # MIT License file
├── README.md # Project documentation
├── polyglot.png # UI preview image
├── input_files/ # Place your source image and PDF files here
└── polyglot_results/ # Generated polyglot files are saved here
Simply run the script without arguments:
python polyglot_tool.pyFollow the prompts to drag-and-drop your image and PDF files. The tool handles the rest automatically.
To see all available options:
python polyglot_tool.py --helpExample:
python polyglot_tool.py --image "input.jpg" --pdf "hidden.pdf" --output result.jpg| Argument | Description | Required |
|---|---|---|
--image |
Path to the source JPEG or PNG image | Yes |
--pdf |
Path to the source PDF document | Yes |
--output |
Desired output filename | No |
--help |
Show the help message and exit | — |
- Parsing: Validates the input image structure — PNG chunks or JPEG markers.
- Injection:
- PNG: Injects a custom
pDfHchunk containing the PDF header and stream start. - JPG: Embeds the PDF header inside a crafted
COM(comment) segment.
- PNG: Injects a custom
- Appending: Appends the full PDF body after the image data, wrapped in a PDF stream.
- Result: The output file is simultaneously a valid image (opened by image viewers) and a valid PDF (parsed from the injected header).
Contributions are welcome! Please see CONTRIBUTING.md for guidelines on reporting bugs, suggesting enhancements, and submitting pull requests.
This project is licensed under the MIT License — see the LICENSE file for details.
