Collects volatile forensic evidence from compromised hosts in volatility order: memory dumps with WinPmem/LiME, network connections, processes, system state. For incident response before isolation.
npx claudepluginhub killvxk/cybersecurity-skills-zhThis skill uses the workspace's default tool permissions.
- 安全事件已确认且受攻陷主机已识别
Collects volatile forensic evidence from compromised hosts following order of volatility: memory dumps, network connections, processes, system state. For incident response.
Collects volatile forensic evidence from compromised hosts following order of volatility: memory dumps via WinPmem/LiME, network connections with netstat/ss, processes, and system state.
Performs digital forensics on compromised endpoints: memory acquisition with WinPMEM/FTK, disk imaging, Volatility 3 analysis, Windows artifacts like Prefetch/Shimcache. For incident investigations and evidence collection.
Share bugs, ideas, or general feedback.
# 挂载取证 USB 工具包(不要在受攻陷系统上安装工具)
# 验证工具包完整性
sha256sum /mnt/forensic_usb/tools/* > /tmp/toolkit_hashes.txt
diff /mnt/forensic_usb/tools/known_good_hashes.txt /tmp/toolkit_hashes.txt
# 创建带时间戳的证据输出目录
EVIDENCE_DIR="/mnt/evidence/$(hostname)_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$EVIDENCE_DIR"
echo "Collection started: $(date -u)" > "$EVIDENCE_DIR/collection_log.txt"
echo "Collector: $(whoami)" >> "$EVIDENCE_DIR/collection_log.txt"
echo "System: $(hostname)" >> "$EVIDENCE_DIR/collection_log.txt"
# Windows - WinPmem 内存采集
winpmem_mini_x64.exe "$EVIDENCE_DIR\memdump_$(hostname).raw"
# Linux - LiME 内核模块内存采集
insmod /mnt/forensic_usb/lime.ko "path=$EVIDENCE_DIR/memdump_$(hostname).lime format=lime"
# Linux - 通过 /proc/kcore 替代方案
dd if=/proc/kcore of="$EVIDENCE_DIR/kcore_dump.raw" bs=1M
# macOS - osxpmem
osxpmem -o "$EVIDENCE_DIR/memdump_$(hostname).aff4"
# 立即对内存转储文件计算哈希
sha256sum "$EVIDENCE_DIR/memdump_"* > "$EVIDENCE_DIR/memory_hash.sha256"
# 活跃网络连接
# Windows
netstat -anob > "$EVIDENCE_DIR/netstat_connections.txt" 2>&1
Get-NetTCPConnection | Export-Csv "$EVIDENCE_DIR/tcp_connections.csv" -NoTypeInformation
Get-NetUDPEndpoint | Export-Csv "$EVIDENCE_DIR/udp_endpoints.csv" -NoTypeInformation
# Linux
ss -tulnp > "$EVIDENCE_DIR/socket_stats.txt"
netstat -anp > "$EVIDENCE_DIR/netstat_all.txt" 2>/dev/null
cat /proc/net/tcp > "$EVIDENCE_DIR/proc_net_tcp.txt"
cat /proc/net/udp > "$EVIDENCE_DIR/proc_net_udp.txt"
# ARP 缓存
arp -a > "$EVIDENCE_DIR/arp_cache.txt"
# 路由表
route print > "$EVIDENCE_DIR/routing_table.txt" # Windows
ip route show > "$EVIDENCE_DIR/routing_table.txt" # Linux
# DNS 缓存
ipconfig /displaydns > "$EVIDENCE_DIR/dns_cache.txt" # Windows
# Linux:因解析器不同而异,检查 systemd-resolve 或 nscd
systemd-resolve --statistics > "$EVIDENCE_DIR/dns_stats.txt" 2>/dev/null
# 活跃防火墙规则
netsh advfirewall show allprofiles > "$EVIDENCE_DIR/firewall_rules.txt" # Windows
iptables -L -n -v > "$EVIDENCE_DIR/iptables_rules.txt" # Linux
# Windows - 详细进程列表
tasklist /V /FO CSV > "$EVIDENCE_DIR/process_list_verbose.csv"
wmic process list full > "$EVIDENCE_DIR/wmic_process_full.txt"
Get-Process | Select-Object Id,ProcessName,Path,StartTime,CPU,WorkingSet |
Export-Csv "$EVIDENCE_DIR/ps_processes.csv" -NoTypeInformation
# Windows - 带命令行和父进程的进程信息
wmic process get ProcessId,Name,CommandLine,ParentProcessId,ExecutablePath /FORMAT:CSV > \
"$EVIDENCE_DIR/process_commandlines.csv"
# Linux - 完整进程树
ps auxwwf > "$EVIDENCE_DIR/process_tree.txt"
ps -eo pid,ppid,user,args --forest > "$EVIDENCE_DIR/process_forest.txt"
cat /proc/*/cmdline 2>/dev/null | tr '\0' ' ' > "$EVIDENCE_DIR/proc_cmdline_all.txt"
# 已加载的进程模块/DLL
# Windows
listdlls.exe -accepteula > "$EVIDENCE_DIR/loaded_dlls.txt"
# Linux
for pid in $(ls /proc/ | grep -E '^[0-9]+$'); do
echo "=== PID $pid ===" >> "$EVIDENCE_DIR/proc_maps.txt"
cat "/proc/$pid/maps" 2>/dev/null >> "$EVIDENCE_DIR/proc_maps.txt"
done
# 打开的文件句柄
handle.exe -accepteula > "$EVIDENCE_DIR/open_handles.txt" # Windows (Sysinternals)
lsof > "$EVIDENCE_DIR/open_files.txt" # Linux
# Windows
query user > "$EVIDENCE_DIR/logged_in_users.txt"
query session > "$EVIDENCE_DIR/active_sessions.txt"
net session > "$EVIDENCE_DIR/net_sessions.txt" 2>&1
net use > "$EVIDENCE_DIR/mapped_drives.txt" 2>&1
# Linux
who > "$EVIDENCE_DIR/who_output.txt"
w > "$EVIDENCE_DIR/w_output.txt"
last -50 > "$EVIDENCE_DIR/last_logins.txt"
lastlog > "$EVIDENCE_DIR/lastlog.txt"
cat /var/log/auth.log | tail -200 > "$EVIDENCE_DIR/recent_auth.txt" 2>/dev/null
# 系统时间(对时间线至关重要)
date -u > "$EVIDENCE_DIR/system_time_utc.txt"
w32tm /query /status > "$EVIDENCE_DIR/ntp_status.txt" # Windows
ntpq -p > "$EVIDENCE_DIR/ntp_status.txt" # Linux
# 环境变量
set > "$EVIDENCE_DIR/environment_vars.txt" # Windows
env > "$EVIDENCE_DIR/environment_vars.txt" # Linux
# 计划任务 / Cron 作业
schtasks /query /fo CSV /v > "$EVIDENCE_DIR/scheduled_tasks.csv" # Windows
crontab -l > "$EVIDENCE_DIR/crontab_current.txt" 2>/dev/null # Linux
ls -la /etc/cron.* > "$EVIDENCE_DIR/cron_dirs.txt" 2>/dev/null
# 服务
sc queryex type=service state=all > "$EVIDENCE_DIR/services_all.txt" # Windows
systemctl list-units --type=service --all > "$EVIDENCE_DIR/systemd_services.txt" # Linux
# Windows 注册表 - 关键自启动位置
reg export "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "$EVIDENCE_DIR/reg_run_hklm.reg" /y
reg export "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "$EVIDENCE_DIR/reg_run_hkcu.reg" /y
reg export "HKLM\SYSTEM\CurrentControlSet\Services" "$EVIDENCE_DIR/reg_services.reg" /y
# 为所有已采集证据生成 SHA256 哈希
cd "$EVIDENCE_DIR"
sha256sum * > evidence_manifest.sha256
# 创建证据监管链记录
cat > "$EVIDENCE_DIR/chain_of_custody.txt" << EOF
证据监管链记录(CHAIN OF CUSTODY RECORD)
========================
案例 ID: IR-YYYY-NNN
采集日期: $(date -u)
采集人: $(whoami)
系统: $(hostname)
系统 IP: $(hostname -I 2>/dev/null || ipconfig | grep IPv4)
采集方式: 通过可信 USB 工具包进行实时取证采集
证据项目:
$(ls -la "$EVIDENCE_DIR/" | grep -v chain_of_custody)
SHA256 清单: evidence_manifest.sha256
转移记录: [待填写]
存储位置: [待填写]
EOF
| 概念 | 说明 |
|---|---|
| 易失性顺序(Order of Volatility) | RFC 3227 - 优先采集最易失数据:寄存器 > 缓存 > 内存 > 磁盘 |
| 实时取证(Live Forensics) | 在系统关闭前从运行中的系统采集证据 |
| 证据监管链(Chain of Custody) | 跟踪证据从采集到法庭全程处理过程的文档 |
| 取证可靠性(Forensic Soundness) | 确保证据采集过程不改变原始证据 |
| 可信工具(Trusted Tools) | 从外部介质使用已验证工具,而非受攻陷系统上的工具 |
| 证据完整性(Evidence Integrity) | 采集后立即对所有证据计算 SHA256 哈希 |
| 洛卡德交换原则(Locard's Exchange Principle) | 每次接触都留下痕迹 - 尽量减少调查人员的操作痕迹 |
| 工具 | 用途 |
|---|---|
| WinPmem | Windows 内存采集 |
| LiME(Linux Memory Extractor) | Linux 内核内存采集 |
| Sysinternals Suite | 进程、句柄和 DLL 分析(Windows) |
| Velociraptor | 大规模远程取证采集 |
| KAPE(Kroll Artifact Parser) | Windows 自动化产物采集 |
| CyLR | 跨平台实时响应采集 |
| GRR Rapid Response | 远程实时取证框架 |