Identifies file types by reading the first bytes (magic bytes/signatures) of a file, not by trusting the file extension. Supports detection of PNG, JPEG, GIF, WebP, BMP, PDF, ZIP, GZIP, ELF, MP3, MP4, OGG, WAV, TIFF, SVG, XML, and more. Essential for security audits, forensic analysis, and verifying file integrity.
FilesystemSecurityForensicsCLI
Features
- Magic byte detection for 20+ file formats
- Not fooled by incorrect file extensions
- Brief mode: output type only, no filename
- Single TypeScript file with zero npm dependencies
Flags
| Long | Short | Description |
|---|---|---|
| --version | -V | Show version and license |
| --file | -f | File to analyze |
| --brief | -b | Output MIME type only, no filename |
Usage
terminal
$ mdetect -f image.png
$
$ mdetect -f unknown.bin -b
$
$ mdetect -f document.pdf
Dependencies
Bun runtime — uses Bun.file API for reading magic bytes
Install
$ curl -LO https://labs.stech-sol.com/downloads/mdetect/0.1.0/mdetect_linux_amd64
$ chmod +x mdetect_linux_amd64
$ # Requires Bun runtime: bun run ./mdetect_linux_amd64
About
Downloads
Verify integrity
SHA256 checksums