foremost
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "foremost":https://skillpi.com/zh/skills/deepskill-a125c27ff8402c7a4dc923dd4be8b481d3ec69f2b92451c9a6b6dd5c8671e799。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
使用 Foremost 恢复已删除文件并从磁盘镜像和内存转储中进行数据雕刻。适用于从原始磁盘镜像提取文件、恢复意外删除的照片、从 CTF 数据块中提取嵌入文件,或从未分配空间中雕刻数据等场景。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 输入和输出
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: foremost
description: >-
Recover deleted files and carve artifacts from disk images and memory
dumps with Foremost. Use when a user asks to extract files from a raw
disk image, recover accidentally deleted photos, pull embedded files out
of a CTF blob, or carve artifacts from unallocated space.
license: Apache-2.0
compatibility: 'Foremost 1.5.7, Linux/macOS'
metadata:
author: terminal-skills
version: 1.0.0
category: devops
tags:
- foremost
- file-carving
- digital-forensics
- data-recovery
- ctfForemost
Overview
Foremost is a file carving tool: it scans raw disk images, memory dumps, or any blob byte-by-byte for magic headers and footers, then writes out the recovered files into neat per-type directories. It doesn't care about filesystem metadata — it looks for the on-disk bytes that identify a JPEG, PNG, PDF, ZIP, Office document, MP3, and so on. That makes it the right tool for recovering files the filesystem has forgotten or for CTF challenges where a blob hides multiple embedded files.
Instructions
Step 1: Create a Disk Image (Never Carve the Live Device)
# Always work from an image, never the source device
sudo dd if=/dev/sdb of=disk.img bs=4M status=progress conv=noerror,sync
# Or use dcfldd (forensic fork of dd with hashing)
sudo dcfldd if=/dev/sdb of=disk.img bs=4M hash=sha256 hashlog=disk.sha256
# Verify integrity before working
sha256sum disk.img
cat disk.sha256
Step 2: Run Foremost
# Default run — uses built-in config, all supported types
foremost -i disk.img -o recovered/
# Specific types only (jpg, png, pdf, zip, doc, mp3, ...)
foremost -t jpg,png,pdf -i disk.img -o recovered/
# Verbose + quick mode (scan only file headers, faster)
foremost -v -q -t all -i disk.img -o recovered/
# Output tree
tree -L 2 recovered/
# recovered/
# ├── audit.txt
# ├── jpg/
# │ ├── 00000001.jpg
# │ └── 00000125.jpg
# ├── pdf/
# │ └── 00000007.pdf
# └── zip/
# └── 00000042.zip
Step 3: Review the Audit File
# Summary of what was carved
cat recovered/audit.txt
# Foremost version 1.5.7 by Jesse Kornblum ...
# Num Name (bs=512) Size File Offset Comment
# 0: 00000001.jpg 185 KB 16384
# 1: 00000007.pdf 1 MB 67108864
# Count files by type
find recovered -type f -not -name audit.txt | awk -F/ '{print $(NF-1)}' | sort | uniq -c
Step 4: Custom File Types with foremost.conf
# Copy the default config
cp /etc/foremost.conf ./foremost.conf
# Add a signature: extension case max-size header footer
# Example: a custom "FLAG" binary starting with 'CTFFLAG' and ending with 'END'
cat >> foremost.conf <<'EOF'
flag y 5000 CTFFLAG END
EOF
# Run with the custom config
foremost -c ./foremost.conf -i challenge.bin -o out/
ls out/flag/
Step 5: Combine with Other Carvers
# scalpel is foremost's faster fork; use it when foremost is too slow
sudo apt install scalpel
scalpel -c /etc/scalpel/scalpel.conf -o scalpel-out disk.img
# binwalk — better for firmware and embedded filesystems
binwalk -e firmware.bin
# photorec — interactive, stronger for photo/video recovery
sudo photorec /dev/sdb
# strings + file — first-pass triage
strings -a disk.img | less
file recovered/jpg/00000001.jpg
Examples
Example 1: Recover Photos from a Formatted SD Card
# Plug in the SD card — DO NOT mount and DO NOT write anything to it
lsblk
# sdb 1 29.8G 0 disk
# └─sdb1 1 29.8G 0 part
# Image the card
sudo dd if=/dev/sdb of=sdcard.img bs=4M status=progress
sudo sha256sum sdcard.img > sdcard.sha256
# Unplug the card and work from the image only
foremost -t jpg,png,raw,mov,mp4 -i sdcard.img -o photos/
ls photos/jpg | wc -l
# 842
# Sort by size to spot real photos vs thumbnails
find photos/jpg -type f -printf '%s %p\n' | sort -nr | head
Example 2: CTF — Files Hidden Inside a PNG
# The challenge: "Something is hidden inside this harmless image."
file challenge.png
# challenge.png: PNG image data, 1920 x 1080, ...
# Foremost scans through the whole blob, not just the top PNG
foremost -t all -i challenge.png -o carved/
cat carved/audit.txt
# 0: 00000000.png 2 MB 0
# 1: 00000001.zip 45 KB 2097664
# 2: 00000002.pdf 1 MB 2143000
# Inspect the carved ZIP
unzip -l carved/zip/00000001.zip
# flag.txt
unzip -p carved/zip/00000001.zip flag.txt
# flag{foremost_carves_everything}
Guidelines
- Never run Foremost against a live mounted device. Always image first, hash the image, then carve.
- Write-block the source media (physical write blocker, or at minimum mount read-only) to preserve chain of custody.
- Carving is signature-based — it cannot recover file names or directory structure. Metadata is lost.
- Overlapping or fragmented files are reconstructed poorly. For heavily fragmented disks, try
photorecor a filesystem-aware tool likeextundelete/testdiskfirst. - The output directory must NOT exist beforehand — Foremost refuses to overwrite it.
- Foremost is single-threaded and slow on big images.
scalpelis a faster fork for the same job. - For CTFs, always try
foremost -t all -i challenge.blobas a reflex — it finds embedded ZIPs, PDFs, and images thatbinwalksometimes misses. - Pair with
exiftool,strings, andfileon the recovered artifacts to pull metadata and hidden content.
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Foremost 文件雕刻工具的完整使用指南,适用于数字取证、数据恢复、CTF 挑战等高频刚需场景
- 涵盖从磁盘镜像创建到文件恢复的完整流程,具有显著的实际应用价值
亮点
- 触发描述精准覆盖多种典型使用场景(提取磁盘镜像文件、恢复误删照片、CTF 数据块雕刻)
- 边界清晰,不易与其他 Skill 混淆
亮点
- 文档结构完整,包含清晰的步骤划分、端到端示例和最佳实践指南
- frontmatter 信息完整,单文件长度合理
亮点
- 强调关键安全实践(从不直接操作 live device,必须先创建镜像)
- 覆盖主要异常情况并提供替代工具建议,确保执行可靠性
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 104 行 -
管理员或提升权限
确认确有必要再提升权限;不要关闭防护、绕过证书验证或扩大整个系统的访问权限。
主文档提及 · 第 34, 37, 104, 111, 129 行
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。