Shell 与数据处理¶
以下示例只处理本地测试数据。
JSON 格式化¶
计算证据哈希¶
提取并排序主机名¶
python3 - <<'PY'
from pathlib import Path
hosts = {line.strip().lower() for line in Path("hosts.txt").read_text().splitlines() if line.strip()}
print("\n".join(sorted(hosts)))
PY
安全习惯¶
- 对含空格的变量使用双引号;
- 解析不可信文本时避免
eval; - 临时文件使用
mktemp并设置清理 trap; - 在分享终端输出前搜索密钥、Cookie、邮箱和真实域名。