Safe Penetration Testing Labs · intermediate · ~15 min
Render the 8.3 short name out of a FAT directory entry, including the deleted-entry case.
Copy 8 bytes (base) + 3 bytes (ext) out of the entry, swap leading byte for _ on deleted entries, trim spaces, join with . when ext is non-empty.
Recognising the 0xE5 trick is how every FAT forensic tool lists deleted files.
On FAT12 / FAT16 / FAT32, a file is deleted by rewriting the first byte of its directory entry to 0xE5. The rest of the name bytes remain on disk. Forensic tools can list deleted files because of this property.
offset size field
0 8 name (space-padded, ASCII; byte 0 == 0xE5 → deleted)
8 3 extension (space-padded, ASCII)
11 1 attributes
...
So the 8.3 short name is reconstructed from bytes [0..11].
Implement int recover_8_3(const uint8_t *entry, char *out).
entry must be non-NULL; out must be non-NULL.8 + 1 + 3 + 1 = 13 bytes including NUL.entry[0] == 0xE5, substitute '_' for the first character
(the original byte is gone; the leading _ is our convention).Fixed 8+3 layout, leading-byte rule, trim, optional dot.