scalpel

File carver pour la récupération forensique. Extrait des fichiers depuis des images disque, des partitions brutes et des dumps mémoire à partir des en-têtes et pieds de page de fichiers : récupère des fichiers supprimés quel que soit le système de fichiers. File carver for forensic recovery. Extracts files from disk images, raw partitions, and memory dumps based on file headers and footers — recovers deleted files regardless of filesystem.

↗ https://github.com/sleuthkit/scalpel

Overview

scalpel is a filesystem-independent file carver that recovers files from disk images and raw media by searching for file type signatures (magic bytes). It works even when the filesystem is corrupted, deleted, or encrypted — as long as the file data is still present.

Basic Usage

Carve files from disk image

scalpel disk.img -o ./output/

Carve from block device

scalpel /dev/sdb -o ./output/

Carve from memory dump

scalpel memory.dmp -o ./output/

Specify config file

scalpel -c /etc/scalpel/scalpel.conf disk.img -o ./output/

Configuration

# Config file: /etc/scalpel/scalpel.conf
# Uncomment file types to recover

# Enable JPEG recovery
# jpg   y   200000000  \xff\xd8\xff\xe0\x00\x10   \xff\xd9

# Enable PDF recovery
# pdf   y   5000000    %PDF   %%EOF

# Enable DOCX recovery (ZIP-based)
# docx  y   10000000   PK\x03\x04

Edit config to add custom file types:

echo "ext y 1000000 HEADER_HEX FOOTER_HEX" >> /etc/scalpel/scalpel.conf

Common File Types

# Edit /etc/scalpel/scalpel.conf and uncomment:
# jpg, gif, png    — images
# pdf              — PDF documents
# docx, xlsx, pptx — Office docs (ZIP)
# zip, gz          — archives
# avi, mpg, mp3    — media
# exe, dll         — Windows executables (PE)
# sqlite           — SQLite databases

# For forensic focus — enable jpg, pdf, docx, sqlite, zip

Analyzing Output

# Output directory structure:
# output/
#   audit.txt      — carving log
#   jpg-0/         — recovered JPEGs
#   pdf-0/         — recovered PDFs
#   docx-0/        — recovered DOCX files

Check audit.txt for what was found

cat output/audit.txt | head -50

Count recovered files

find output/ -type f | wc -l
# Sort by type
ls output/jpg-0/ | wc -l
ls output/pdf-0/ | wc -l

Creating Disk Images

Create image from device (before carving)

dd if=/dev/sdb of=disk.img bs=4M status=progress

Or with dcfldd (with hashing)

dcfldd if=/dev/sdb of=disk.img hash=md5 md5log=hash.txt

Compressed image

dd if=/dev/sdb | gzip > disk.img.gz

Tips

  • Enable only needed file types in config — carving all types is slow and produces false positives
  • Run on a copy/image of the target media — never on original evidence
  • scalpel finds file data even without a filesystem — useful on formatted or encrypted drives
  • Large output directories are normal — many false positives occur, especially with JPEG
  • Use Autopsy for a GUI workflow that integrates scalpel-style carving
Help / Man page
scalpel [options] IMAGE

-c FILE     Config file (default: /etc/scalpel/scalpel.conf)
-o DIR      Output directory (must not exist or use -O)
-O          Allow output dir to exist
-b          Carve files from entire block device
-d          Use GPU-accelerated carving
-v          Verbose
-V          Show version

Config file format:
  ext  y/n  maxsize  header  footer
  (n = no case, y = case-sensitive)

Vue d’ensemble

scalpel est un file carver indépendant du système de fichiers qui récupère des fichiers depuis des images disque et des supports bruts en recherchant les signatures de type de fichier (magic bytes). Il fonctionne même quand le système de fichiers est corrompu, supprimé ou chiffré, tant que les données du fichier sont encore présentes.

Utilisation de base

# Carver des fichiers depuis une image disque
scalpel disk.img -o ./output/

# Carver depuis un périphérique bloc
scalpel /dev/sdb -o ./output/

# Carver depuis un dump mémoire
scalpel memory.dmp -o ./output/

# Spécifier un fichier de configuration
scalpel -c /etc/scalpel/scalpel.conf disk.img -o ./output/

Configuration

# Fichier de configuration : /etc/scalpel/scalpel.conf
# Décommenter les types de fichiers à récupérer

# Activer la récupération de JPEG
# jpg   y   200000000  \xff\xd8\xff\xe0\x00\x10   \xff\xd9

# Activer la récupération de PDF
# pdf   y   5000000    %PDF   %%EOF

# Activer la récupération de DOCX (basé sur ZIP)
# docx  y   10000000   PK\x03\x04

Éditer la config pour ajouter des types de fichiers personnalisés :

echo "ext y 1000000 HEADER_HEX FOOTER_HEX" >> /etc/scalpel/scalpel.conf

Types de fichiers courants

# Éditer /etc/scalpel/scalpel.conf et décommenter :
# jpg, gif, png    : images
# pdf              : documents PDF
# docx, xlsx, pptx : documents Office (ZIP)
# zip, gz          : archives
# avi, mpg, mp3    : médias
# exe, dll         : exécutables Windows (PE)
# sqlite           : bases de données SQLite

# Pour un focus forensique : activer jpg, pdf, docx, sqlite, zip

Analyser la sortie

# Structure du répertoire de sortie :
# output/
#   audit.txt      : journal du carving
#   jpg-0/         : JPEG récupérés
#   pdf-0/         : PDF récupérés
#   docx-0/        : fichiers DOCX récupérés

# Vérifier audit.txt pour voir ce qui a été trouvé
cat output/audit.txt | head -50

# Compter les fichiers récupérés
find output/ -type f | wc -l

# Trier par type
ls output/jpg-0/ | wc -l
ls output/pdf-0/ | wc -l

Créer des images disque

# Créer une image depuis un périphérique (avant le carving)
dd if=/dev/sdb of=disk.img bs=4M status=progress

# Ou avec dcfldd (avec hashing)
dcfldd if=/dev/sdb of=disk.img hash=md5 md5log=hash.txt

# Image compressée
dd if=/dev/sdb | gzip > disk.img.gz

Conseils

  • N’activer que les types de fichiers nécessaires dans la config : carver tous les types est lent et produit des faux positifs
  • Lancer sur une copie/image du support cible, jamais sur la preuve originale
  • scalpel retrouve les données de fichiers même sans système de fichiers : utile sur des disques formatés ou chiffrés
  • De gros répertoires de sortie sont normaux : beaucoup de faux positifs surviennent, en particulier avec JPEG
  • Utiliser Autopsy pour un flux de travail en interface graphique qui intègre le carving façon scalpel
Aide / Page de manuel
scalpel [options] IMAGE

-c FILE     Config file (default: /etc/scalpel/scalpel.conf)
-o DIR      Output directory (must not exist or use -O)
-O          Allow output dir to exist
-b          Carve files from entire block device
-d          Use GPU-accelerated carving
-v          Verbose
-V          Show version

Config file format:
  ext  y/n  maxsize  header  footer
  (n = no case, y = case-sensitive)