Foremost : récupérer des données supprimées
foremost is a forensics application to recover files based on their headers, footers, and internal data structures. Foremost can work on image files, such as those generated by dd, Safeback, Encase, etc, or directly on a drive. This short article shows how you can use foremost to recover deleted files.
I do not issue any guarantee that this will work for you!
Currently foremost can recover the following file types:
- jpg - Support for the JFIF and Exif formats including implementations used in modern digital cameras.
- bmp - Support for windows bmp format.
- exe - Support for Windows PE binaries, will extract DLL and EXE files along with their compile times.
- mpg - Support for most MPEG files (must begin with 0x000001BA)
- riff - This will extract AVI and RIFF since they use the same file format (RIFF). note faster than running each separately.
- wmv - Note may also extract -wma files as they have similar format.
- ole - This will grab any file using the OLE file structure. This includes PowerPoint, Word, Excel, Access, and StarWriter
- doc - Note it is more efficient to run OLE as you get more bang for your buck. If you wish to ignore all other ole files then use this.
- zip - Note is will extract .jar files as well because they use a similar format. Open Office docs are just zipâd XML files so they are extracted as well. These include SXW, SXC, SXI, and SX? for undetermined OpenOffice files.
- cpp - C source code detection, note this is primitive and may generate documents other than C code.
You can tweak /etc/foremost.conf to add support for more file types.
Please note that there's no guarantee that foremost will succeed in recovering your files, but at least there's a chance.
Install first Foremost :
apt-get install foremost
Take a look at
to learn how to use foremost.
In this example I delete a jpg file:
server1:/home/administrator# ls -l total 324 -rw-r--r-- 1 root root 324383 2008-02-19 01:25 k-p1170003_13_20080217_1058163689.jpg server1:/home/administrator# rm -f k-p1170003_13_20080217_1058163689.jpg
foremost can be used as follows to try to recover the file:
foremost -t jpeg -i /dev/sda1
(If you don't know what partition to search, take a look at
After foremost has finished, you will find a folder called output in the directory from where you called foremost:
The audit.txt contains a summary of what foremost has done:
And the jpg/ subdirectory contains the jpg files that foremost has recovered:
server1:~# ls -l output/jpg/ total 660 -rw-r--r-- 1 root root 328479 2009-03-12 17:55 11157504.jpg -rw-r--r-- 1 root root 332575 2009-03-12 17:57 29556752.jpg server1:~#
Before you run foremost the next time from the same directory, you must either delete/rename the current output/ directory (because foremost will not start if there's already an output/ directory) or use the -T switch (time stamp the output directory so you don't have to delete the output/ dir when running multiple times):
foremost -t pdf -T -i /dev/sda1