CTF 用的 nc 範例
topic/ #自行更改名稱
├── bin/
│ ├── run.sh # 執行檔,修改此檔案來設定要執行的指令
│ └── 題目 #自行上傳
├── start.sh # 若 flag 檔名或路徑有修改 須在此設定
├── Dockerfile # 基本上不會動,可自行更改
├── docker-compose.yml # 若要自訂 flag 在此修改,不需自行建立,路徑為 /home/ctf/flag
└── ctf.xinetd # 不要動!!
- 將您的題目檔案放在
topic/bin/
目錄下 - 修改
topic/bin/run.sh
:- 將
pwd
替換為您要執行的指令 - 確保指令路徑正確(預設工作目錄為
/home/ctf
) - 例如:
timeout 60 ./your_program
- 將
- 可以將整個
topic
資料夾壓縮成 zip 檔案後上傳到 ctfd 的 owl plugins,或是上傳到 server 後 build image
有兩種方式可以構建映像檔:
- 將所有題目資料夾解壓縮到當前目錄,並且只有一層資料夾
- 執行:
chmod +x build_all.sh ./build_all.sh
- 執行:
chmod +x build_image.sh ./build_image.sh <dockerfile_directory> <image_name> # <dockerfile_directory> <image_name> 皆相同即可
- 例如:
./build_image.sh topic topic
- 請直接將題目資料夾壓縮成 zip 檔,不要再多一層資料夾
- 確保題目檔案具有執行權限
- 預設工作目錄為
/home/ctf
- 執行時間限制為 60 秒