一个轻量级的、内容驱动的 Web 服务器,用于托管交互式速查表和参考资料。非常适合 CTF(夺旗赛)挑战、逆向工程和技术文档。当您希望在实验室环境中限制或避免外部流量,同时仍能访问有用资料时,这是最佳选择。
*** 我已对脚本进行了一些加固,但您在使用前应进行审查,并/或在实验室环境中部署 ***
克隆或下载此仓库:
git clone https://github.com/JimmyAder/CheatSheetHost.git
cd CheatSheetHost
运行服务器:
python3 host_content_site.py
在浏览器中打开 http://127.0.0.1:8766
服务器会自动创建默认文件(如果它们不存在)。
http://127.0.0.1:8766http://[your-local-ip]:8766(启动时会显示)GET /api/pages:返回可用页面别名的 JSON 列表速查表以 JSON 文件形式存储在 pages/ 目录中。每个文件定义一个页面,结构如下:
{
"slug": "my-cheatsheet",
"title": "My Custom Cheatsheet",
"subtitle": "A brief description of this cheatsheet",
"sections": [
{
"type": "table",
"title": "Section Title",
"items": [
{"key": "Command", "value": "Description"},
{"key": "Another", "value": "Command"}
]
},
{
"type": "text",
"title": "Notes",
"text": "Some explanatory text here."
},
{
"type": "code",
"title": "Example Code",
"language": "python",
"code": "print('Hello, World!')"
}
],
"ascii": {
"title": "ASCII Table",
"blocks_across": 6,
"min_width_px": 920
}
}
gdb-cheatsheet.json)slug 字段确定 URL 路径(如果省略,则从文件名自动生成)编辑 site_template.html 以修改外观:
:root 中的 CSS 变量用于颜色和布局命令行选项:
python3 host_content_site.py --host 0.0.0.0 --port 8080
--host:绑定的 IP 地址(默认:0.0.0.0)--port:端口号(默认:8766)CheatSheetHost/
├── host_content_site.py # 主服务器脚本
├── site_template.html # HTML 模板和 CSS
├── pages/ # 速查表 JSON 文件
│ ├── ctf-cheatsheet.json
│ ├── gdb-cheatsheet.json
│ └── ...
└── README.md # 本文件
pages/ 目录中创建一个新的 JSON 文件http.server 模块构建python3 host_content_site.py
site_template.html 以更改样式本项目是开源的。欢迎使用、修改和分发。