kmsec-uk/dochunt

GitHub: kmsec-uk/dochunt

Dochunt 是一个基于 CommonCrawl 归档数据大规模挖掘和解析公开 Google Docs 文档的工具集,帮助安全研究人员从历史网页快照中发现和检索被意外暴露的敏感文档内容。

Stars: 0 | Forks: 0

# Google Docs 挖掘数据集 本仓库包含支持 [dochunt](https://dochunt.kmsec.uk) 的代码。 在阅读代码之前,你可能想先[阅读这篇博客文章](https://kmsec.uk/blog/parsing-google-docs),其中介绍了问题的 陈述以及我的解决方法。 这里的核心代码用于从 HTML 中解析 Google Docs 内容。它非常简单, 托管在 `/gdoc/` 中。 其余的所有内容都是为了支持在 [dochunt](https://dochunt.kmsec.uk) 上可查看的数据集。 * `/db/` - 作为 sqlite 数据库基础的数据库写入器实现 * `/commoncrawl/` - 在 `/cmd/get/` 中使用的基础 search+retrieve commoncrawl 客户端 * `/warc/ - 专门针对我的用例定制的非常具体的 WARC 文件解析器(非常具体!) `/cmd/view` 包含用于 [dochunt](https://dochunt.kmsec.uk) 的 Web 服务器、模板等, 以及一个独立的数据库读取器实现。 ## 示例程序 如果你想从 HTML 中解析 Google Docs 内容,这里有一个最简方法: ``` func main() { // open a file for reading f, err := os.Open("example.html") if err != nil { panic(err) } // create a blank Doc - sometimes it's better to pass in a // known Google Docs ID in advance to the NewDoc parameter g := gdoc.NewDoc("") // the Google Docs struct has an optional Provenance field, // which is useful for documenting *where* you found a DOM. g = g.WithProvenance("example.html") // parse the html from the file stream if err := g.ParseHtml(f); err != nil { panic(err) } b, err := json.MarshalIndent(g, "", " ") if err != nil { panic(err) } fmt.Println(string(b)) /* Outputs: { "id": "1J1YwL0a94brFB8v_-zh8WVGlNxtZmjmRiRP5Gbpv9YI", "revision": 751, "provenance": "example.html", "timestamp": "2026-02-04T23:19:13Z", "page_title": "Test Requirement - Google Docs", "og_title": "Test Requirement", "og_description": "※ You can find another test in the left tab of this document Blockchain developer test This is the test project: https://bitbucket.org/workspace052/testing/src/dev/ * You should perform tests on this project and send a PR to BitBucket after completing the tests.* T...", "og_image": "https://lh7-us.googleusercontent.com/docs/AHkbwyJgNSeUYHVi1oly1xonvHrffHjtmDLl8boILmc_jDO3AnEa8IgLDBiFcSdnhxwMFt1nuz88ycGsuPW9dB9W2AV_0fRc53LvbvE4kAm0BchlfQ89qZVC=w1200-h630-p", "created": "2025-04-23T16:24:56.629+01:00", "content": "※ You can find another test....", "links": [ "https://bitbucket.org/workspace052/testing/src/dev/" ], "image_urls": [ "https://lh7-rt.googleusercontent.com/docsz/AD_4nXcbQk6SOuUh3HgJihU_kuy03T9ff67viXO7_1VVmD4fk2_DqiXDsFXrUp2_moGkf0kmlc7clKsrk3PFrVWZVJPSXUopbe-zp8VQ89jQ5k3-GuYONkxZwum227-ip_GmmnuqKiAAQi9_N4BZZTFWHQ?key=MvlX0wMJ8MA3FUQmKoAwlita" ] } */ } ``` 上面的示例展示在 `/cmd/example/main.go` 中。 仅供参考,上面示例中的文档现已被下架,这就是为什么能够从存档快照中解析 HTML 如此有用。太棒了!
标签:BSD, Dochunt, ESC4, Google Docs, Go语言, KmsecUK, OSINT, SQLite, URL抓取, WARC, 互联网暴露面, 公开语料库, 后端开发, 多模态安全, 实时处理, 情报收集, 数据抓取, 数据挖掘, 文档解析, 日志审计, 漏洞研究, 程序破解