
軽量でコンテンツ駆動型のWebサーバー。インタラクティブなチートシートやリファレンス資料をホスティングするために設計されています。CTF(Capture The Flag)チャレンジ、リバースエンジニアリング、技術文書に最適です。外部トラフィックを制限または排除したいラボ環境で、役立つ資料にアクセスできるようにするのに最適です。
*** スクリプトはある程度堅牢化していますが、使用前および/またはラボ環境にデプロイする前に確認してください。 ***
このリポジトリをクローンまたはダウンロードします:
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リストを返しますチートシートは pages/ ディレクトリ内のJSONファイルとして保存されます。各ファイルは以下の構造で1つのページを定義します:
{
"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 を編集このプロジェクトはオープンソースです。自由に使用、変更、配布してください。