x-glacier/kali-pentest / kali-pentest-zh
kali-pentest-zh
Flagged通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。
references/forensics/tools/ddrescue.md
View on GitHub# ddrescue
- **Category**: Forensics / Data Recovery
- **Risk Level**: 🟡 Medium
---
## 描述
GNU ddrescue 是一款从损坏介质(故障硬盘、划伤的 CD/DVD、损坏的闪存驱动器)复制数据的数据恢复工具。与 dd 不同,它在遇到错误时不会截断输出文件,使用映射文件跟踪恢复进度,并通过多次传递执行逐步激进的重试策略。在多次运行之间保留所有已恢复的数据。对于标准成像工具失败时的损坏证据驱动器取证成像至关重要。
## 安装
```bash
sudo apt install gddrescue
```
## 参数说明
| 参数 | 说明 |
|------|------|
| `infile` | 输入设备或文件(位置参数,第一个参数) |
| `outfile` | 输出文件或设备(位置参数,第二个参数) |
| `mapfile` | 恢复进度映射文件(位置参数,第三个参数) |
| `-f` | 强制;允许覆盖现有输出文件 |
| `-n` | 无刮擦;首次传递跳过刮擦阶段以提高速度 |
| `-r <n>` | 坏扇区的最大重试次数(默认:0) |
| `-d` | 使用直接 I/O(绕过内核缓存)读取输入 |
| `-R` | 反向方向;从末尾向开头读取 |
| `-i <pos>` | 起始输入位置(如 `1M`、`500K`) |
| `-o <pos>` | 起始输出位置 |
| `-s <size>` | 从输入复制的最大字节数 |
| `-c <n>` | 簇大小(每次读取尝试的扇区数) |
| `-b <size>` | 扇区大小(字节,默认:512) |
| `-v` | 详细模式;增加输出详细程度 |
| `--log-events <file>` | 将重要事件记录到文件 |
## 常用命令
```bash
# 从故障驱动器进行基本恢复
sudo ddrescue /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
# 第一次传递:快速复制,跳过坏扇区(无刮擦)
sudo ddrescue -n /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
# 第二次传递:重试第一次传递中的坏扇区
sudo ddrescue -r 3 /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
# 反向恢复(当驱动器在特定区域故障时有用)
sudo ddrescue -R -r 3 /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
# 使用直接 I/O 绕过内核缓存
sudo ddrescue -d -n /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
# 带详细输出和事件日志的恢复
sudo ddrescue -v --log-events /mnt/output/events.log /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
# 仅复制设备的前 1GB
sudo ddrescue -s 1G /dev/sdb /mnt/output/partial.img /mnt/output/partial.map
# 为非标准介质设置扇区大小(如 4K 扇区)
sudo ddrescue -b 4096 /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
# 强制覆盖现有输出文件
sudo ddrescue -f /dev/sdb /mnt/output/disk.img /mnt/output/disk.map
```
## 注意事项
1. 始终使用映射文件(第三个位置参数)——它跟踪哪些扇区已复制,允许在中断后恢复而无需重新读取成功的扇区。
2. 使用两次传递策略:第一次传递使用 `-n`(无刮擦)快速恢复所有良好数据,然后第二次传递使用 `-r 3` 重试坏扇区。
3. 切勿将输出写入正在恢复的同一设备——使用单独的健康驱动器或网络存储。
4. 软件包名称是 `gddrescue`(GNU ddrescue),而非 `ddrescue`(后者是一个不同的旧工具)。命令仍然是 `ddrescue`。
5. 对故障驱动器使用 `-d`(直接 I/O)以避免内核预读在坏区域触发额外读取。
6. `-R`(反向)标志可以恢复从一端逐渐故障的驱动器数据——交替使用正向和反向传递。
7. 监控映射文件以跟踪恢复进度:它显示已恢复、未尝试、未修剪、未刮擦、坏扇区和失败的计数。
---
## 官方参考
- [GNU ddrescue (Official)](https://www.gnu.org/software/ddrescue/)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |