git-pkgs/cwe

GitHub: git-pkgs/cwe

一个将 MITRE CWE 目录嵌入二进制文件的 Go 库,提供离线 ID 查询和分类检索功能。

Stars: 1 | Forks: 0

# cwe 用于通过 ID 查询 MITRE CWE (Common Weakness Enumeration) 条目的 Go 库。 该目录在构建时被嵌入,涵盖了所有未弃用的弱点及其名称、简短描述和 [View-1400](https://cwe.mitre.org/data/definitions/1400.html) 分类。每月一次的工作流会从 `cwec_latest.xml.zip` 重新生成它,并在发生更改时提交一个 PR。 ## 安装说明 ``` go get github.com/git-pkgs/cwe ``` ## 用法 ``` import "github.com/git-pkgs/cwe" id, e, ok := cwe.Lookup("79") // id = "CWE-79" // e.Name = "Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')" // e.Category = "Injection" for _, label := range cwe.Categories() { fmt.Println(cwe.CategoryID(label), label, len(cwe.InCategory(label))) } // CWE-1396 Access Control 60 // CWE-1397 Comparison 13 // ... cwe.CategoryOf("CWE-352") // "CWE-1411" ``` `Lookup` 接受 `"CWE-79"`、`"cwe-79"` 或 `"79"`,并返回规范的 `CWE-` 格式。 ## 重新生成目录 ``` go generate ./... ``` 从 cwe.mitre.org 获取最新的 XML 并重写 `cwe.json`。输出是确定性的(已对键进行排序,无空格),因此在 XML 未更改的情况下重新运行不会产生任何 diff。 ## 许可证 MIT。CWE 目录归 © The MITRE Corporation 所有,并根据其[使用条款](https://cwe.mitre.org/about/termsofuse.html)进行使用。
标签:EVTX分析, Go, Ruby工具, 开发库, 日志审计, 漏洞字典, 静态数据