implementing-log-integrity-with-blockchain
它能做什么
这个工具可以创建一份安全、防篡改的日志。日志中的每条新记录都包含前一条记录的唯一编码(哈希值),因此任何修改都能被轻易发现。
适用场景
- ✓需要可靠地保存安全日志时。
- ✓需要证明某份记录没有被改动时。
- ✓用于审计和取证调查时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-log-integrity-with-blockchain/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“为我的网站服务器日志创建一份安全日志,并检查它们是否被篡改过。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会获取每一条新信息(日志),加上前一条信息的唯一编码和时间戳,生成一个新的编码。如果有人试图修改内容,编码就会对不上,从而暴露篡改行为。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Implementing Log Integrity with Blockchain
When to Use
- When deploying or configuring implementing log integrity with blockchain capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
- Install dependencies:
pip install requests - Ingest log entries from syslog, JSON, or plain text files.
- For each entry, compute SHA-256 hash of: previous_hash + timestamp + log_content.
- Store the chain as a JSON ledger with entry index, timestamp, content hash, previous hash, and chain hash.
- Verify chain integrity by recomputing all hashes and detecting breaks.
- Optionally anchor checkpoint hashes to an external timestamping service.
python scripts/agent.py --log-file /var/log/syslog --chain-file log_chain.json --verify --output integrity_report.json
Examples
Chain Entry Structure
{"index": 42, "timestamp": "2024-01-15T10:30:00Z", "content_hash": "a1b2c3...",
"prev_hash": "d4e5f6...", "chain_hash": "SHA256(prev_hash + timestamp + content_hash)"}
Tamper Detection
If entry 42 is modified, chain_hash[42] will not match SHA256(chain_hash[41] + ...), and all entries from 42 onward will be flagged as invalid.
常见问题
什么是哈希值(hash)?
它就像每条信息独有的指纹。哪怕文字只改动一点点,生成的指纹也会完全不同。
为什么这里要用“区块链”?
这并不是完整的区块链,但它借用了用编码把信息串联起来的思路。这就像一条链条,每个环节都依赖前一个环节,因此很难被篡改。
我怎么知道内容是否被改过?
工具会把计算出的编码和原始编码进行比对。只要链条中任何位置出现不一致,它就会提示:从该位置开始,日志已被篡改。
详情
作者的原始描述
Builds an append-only log integrity chain using SHA-256 hash chaining, where each entry incorporates the previous entry's hash so tampering invalidates all subsequent hashes; covers log ingestion (syslog/JSON/plain text), chain verification, pinpoint tamper detection, and checkpoint anchoring to external timestamping services. Use for tamper-evident log storage for compliance or forensics, or to v
热度
- GitHub 星标
- 35k
- 排名
- #8070
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。