First, get familiar with the FAT file system. There are some things specific to this FS in the way the files are created and deleted. We basically need to follow the file deletion steps in the reversed order.
0xE5 values in the directory entry set0x00000000)int clusters = file_size / cluster_size). Keep in mind, that file size for folders is always 00 00 00 00. So, don’t confuse a file with a folder.🔎 Intrestingly enough, this method worked on a FAT32 formatted flash drive. Why?
NTFS Data Recovery
Steps
To get familiar with NTFS file creation and deletion, see here. In general, there are resident and non-resident files. Resident files are small and have their contents in the MFT record itself. Non-resident files are bigger and their contents is stored elsewhere on the disk.
⚠️ Since MFT records get reused once they are deallocated on the first-free basis, resident files get overwritten sooner.
For resident files, use a regular expression for finding
FILE0records:\x46\x49\x4C\x45.{18}[\x00\x02][2]. This will find all theFILErecords that are not newly created. Remember, once a file is created its sequence number is01. Whenever theFILErecord is deleted (deallocated, it’s never actually deleted), the sequence number gets incremented. So, if this record was deallocated once, its sequence number will be0x02. But! This record can be reused multiple times! When I did the lab, one poor record was reused over and over again, and its sequence number got as big as0x08, imagine that! So, I would fix the regular expression above to address these cases:\x46\x49\x4C\x45.{18}^[\x00\x01](todo).