Lightweight file type detector for reverse engineering, DFIR, and malware analysis.
file_detector.py is a lightweight Python tool that identifies the true file type of a file by analyzing its magic bytes (binary signatures), rather than relying on file extensions.
This makes it especially useful in DFIR, malware analysis, and reverse engineering, where file extensions are often misleading or intentionally manipulated.
- ✅ Detects common file types: EXE, ELF, ZIP, and PDF files
- ✅ Uses magic byte signature analysis (not file extensions)
- ✅ Color-coded terminal output using
termcolor - ✅ Safe for malware triage and static analysis
- ✅ Easily extendable with additional file signatures
git clone https://github.com/0x0allenace/file-detector.git
cd file-detector
pip install termcolorpython3 file_detector.pyEnter file name: invoice.exe.zip
Found file type: ZIPIf unknown:
File type could not be identified
Files contain unique identifiers called magic bytes at the beginning of their binary structure.
| File Type | Signature (Hex) |
|---|---|
| EXE | 4D 5A (MZ) |
| ELF | 7F 45 4C 46 |
| ZIP | 50 4B 03 04 |
25 50 44 46 2D |
Perfect for:
- Malware triage and safe file inspection
- Digital forensics investigations
- Reverse engineering workflows
- Suspicious file verification
- Security lab environments
file-detector/
│
├── file_detector.py
├── README.md
├── .gitignore
└── LICENSE
- Add more file signatures (PNG, JPG, DOCX, etc.)
- Generate file hashes (SHA256, MD5)
- Integrate into a DFIR automation pipeline
- Build a GUI version (drag & drop support)
Allen Ace
Cybersecurity Enthusiast | Reverse Engineering & DFIR | Machine Learning
📍 LinkedIn: linkedin.com/in/allen-ace-soc-analyst
🐙 GitHub: github.com/0x0allenace
🕊️ X (Twitter): x.com/allen_acee
Cybersecurity · Reverse Engineering · DFIR · Malware Analysis · Python · Magic Bytes · Forensics