跳到正文
Skillpedia
部署与云(DevOps)35k · #8070

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-log-integrity-with-blockchain/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Install dependencies: pip install requests
  2. Ingest log entries from syslog, JSON, or plain text files.
  3. For each entry, compute SHA-256 hash of: previous_hash + timestamp + log_content.
  4. Store the chain as a JSON ledger with entry index, timestamp, content hash, previous hash, and chain hash.
  5. Verify chain integrity by recomputing all hashes and detecting breaks.
  6. 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

repo: mukul975/Anthropic-Cybersecurity-Skills

热度

GitHub 星标
35k
排名
#8070
许可证
Apache-2.0
更新时间
2026/8/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能