Sunday 20 January 2013

Recover Deleted Files with Foremost, scalpel in Ubuntu, Pandora in Windows

Foremost and Scalpel are not interested in the underlying filesystem. They simply expect the data blocks of the files to reside sequentially in the image under investigation. The tools will find images in dd dumps, RAM dumps, or swap files.Carving will help to identify and reconstruct files on corrupt filesystems, in slack space, or even after installation of a new operating system, as long as the required data blocks still exist.

Forensics application to recover data.Foremost is a console program to recover files based on their headers, footers, and internal data structures. This process is commonly referred to as data carving. Foremost can work on image files, such as those generated by dd, Safeback, Encase, etc, or directly on a drive. The headers and footers can be specified by a configuration file or you can use command line switches to specify built-in file types. These built-in types look at the data structures of a given file format allowing for a more reliable and faster recovery.


Install foremost in Ubuntu
sudo aptitude install foremost
This will complete the installation.
Using Foremost
Foremost Syntax
foremost  [-h][-V][-d][-vqwQT][-b<blocksize>][-o<dir>] [-t<type>][-s<num>][-i<file>]
Available Options
-h     Show a help screen and exit.
-V     Show copyright information and exit.
-d     Turn on indirect block detection, this  works  well  for  Unix file systems.
-T     Time  stamp  the  output  directory so you don't have to delete the output dir when running  multiple   times.
-v     Enables  verbose  mode.  This  causes  more  information regarding  the  current  state of the program to be dis-played on the screen, and is highly recommended.
-q     Enables quick mode. In quick mode,  only  the  start  of each  sector  is searched for matching headers. That is,the header is searched only up  to  the  length  of  the longest  header.  The  rest of the sector, usually about 500 bytes, is ignored. This mode makes foremost run con- siderably  faster,  but  it  may cause you to miss files that are embedded in other  files.  For  example,  using quick  mode  you  will  not  be able to find JPEG images embedded in Microsoft Word documents.

Quick mode should not be used when examining  NTFS  file systems.  Because NTFS will store small files inside the Master File Table, these files  will  be  missed  during quick mode.
-Q    Enables  Quiet  mode.  Most  error messages will be sup-pressed.
-w    Enables  write  audit  only  mode.   No  files  will  be extracted.
-a     Enables write all headers, perform no error detection in terms of corrupted files.
-b    number  Allows you to specify the block size used  in  foremost. This  is  relevant  for  file naming and quick searches. The default is 512. ie.  foremost -b 1024 image.dd

-k   number Allows  you  to specify the chunk size used in foremost.This can improve speed if you have enough RAM to fit the image  in.   It reduces the checking that occurs between chunks of the buffer.  For example if you had > 500MB of  RAM.       ie.  foremost -k 500 image.dd
-i file The file is used as the input file.  If no input file is specified or the input file cannot be read then stdin is  used.
-o directory  Recovered  files are written to the directory directory.
-c file Sets the configuration file to use. If  none  is  speci-fied,  the  file "foremost.conf" from the current direc-tory is used, if that  doesn't  exist  then  "/etc/fore-most.conf"  is  used.  The  format for the configuration file is described  in  the  default  configuration  file included  with  this program. See the CONFIGURATION FILE  section below for more information.
-s number  Skips number blocks in the input file  before  beginning  the  search  for  headers. ie.  foremost -s 512 -t  jpeg -i /dev/hda1
Foremost examples
Search for jpeg format skipping the first 100 blocks
sudo foremost -s 100 -t jpg -i image.dd
Only  generate  an audit file, and print to the screen (verbose mode)
sudo foremost -av image.dd
Search all defined types
sudo foremost -t all -i image.dd
Search for gif and pdf
sudo foremost -t gif,pdf -i image.dd
Search  for office documents and jpeg files in a Unix file sys-tem in verbose mode.
sudo foremost -v -t ole,jpeg -i image.dd
Run the default case
sudo foremost image.dd
image.dd means you need to enter your hardisk mount point i.e /dev/sda1 or /dev/sda2
scalpel
A Frugal, High Performance File CarverA fast file carver that reads a database of header and footer definitions and extracts matching files from a set of image files or raw device files. Scalpel is filesystem-independent and will carve files from FATx, NTFS, ext2/3, or raw partitions. It is useful for both digital forensics investigation and file recovery.
Install scalpel in Ubuntu
sudo aptitude install scalpel
This will complete the installation
Using scalpel

By default, all file types in the database (/etc/scalpel/scalpel.conf) are commented out. To specify which   filetypes  you want to carve, you need to edit the file and uncomment each line.
sudo scalpel FILE -o Directory
Where FILE is the image file (or device) and Directory is the output directory.
source: http://www.ubuntugeek.com

PANDORA free recovery tool

  http://www.pandorarecovery.com/