This repository contains a Markdown table of common file signatures (magic bytes) and their corresponding Python 3 byte strings. This is useful for:
- Crafting polyglot files (e.g., image + script hybrids)
- Bypassing upload filters by mimicking file types
If you'd like to add a file signature (magic bytes) to any file with Python3, here's a generalized example:
# Read the original file content
file_content = open("file.extension", "rb").read()# Define the magic bytes you want to prepend (e.g., for a GIF file)
magic_bytes = b"\x47\x49\x46\x38\x39\x61" # GIF89a# Combine the signature with the original content
file_content = magic_bytes + file_content# Optionally, write it back out
with open("output_with_signature", "wb") as f:
f.write(file_content)You can replace the magic_bytes value with any of the signatures from Python3 Hex Signature Table.
Python3 Hex Signature Table: Complete Markdown table with:- Offset
- File Extension(s)
- Description
- Python 3 byte string (ready to use)
Data was originally extracted and cleaned from Wikipediaโs list of file signatures.
This project is intended for educational, testing, and research purposes only. Use Responsibly