{"id":19605102,"url":"https://github.com/gztimewalker/ctf-nc-docker","last_synced_at":"2025-06-12T21:38:31.569Z","repository":{"id":44649524,"uuid":"369542717","full_name":"GZTimeWalker/CTF-nc-docker","owner":"GZTimeWalker","description":"Run CTF challenges with netcat in one docker container.","archived":false,"fork":false,"pushed_at":"2023-08-05T09:39:30.000Z","size":1769,"stargazers_count":41,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-21T10:17:58.325Z","etag":null,"topics":["ctf","ctf-challenges","ctf-tools","docker","netcat","nodejs-server","python3","react","xinetd","xterm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GZTimeWalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-21T13:22:26.000Z","updated_at":"2025-03-17T16:26:12.000Z","dependencies_parsed_at":"2024-11-11T09:52:10.138Z","dependency_job_id":null,"html_url":"https://github.com/GZTimeWalker/CTF-nc-docker","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GZTimeWalker%2FCTF-nc-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GZTimeWalker%2FCTF-nc-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GZTimeWalker%2FCTF-nc-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GZTimeWalker%2FCTF-nc-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GZTimeWalker","download_url":"https://codeload.github.com/GZTimeWalker/CTF-nc-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251196114,"owners_count":21550904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ctf","ctf-challenges","ctf-tools","docker","netcat","nodejs-server","python3","react","xinetd","xterm"],"created_at":"2024-11-11T09:41:11.116Z","updated_at":"2025-04-27T19:32:43.923Z","avatar_url":"https://github.com/GZTimeWalker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CTF-nc-docker\n\n[English](https://github.com/GZTimeWalker/CTF-nc-docker/blob/master/README.md) | [中文文档](https://github.com/GZTimeWalker/CTF-nc-docker/blob/master/README.zh_cn.md)\n\n## Build and run\n\nAfter installing docker, clone this repository and run `python generate.py` or `python3 generate.py` in it.\n\nThe logs generated during the running can be got from `/var/log/ctf/*.log` and `/var/log/server.log` inside the container. If the attached files download service is enabled, you can view all the challenges and their corresponding ports via `http://{hostname}:{download_port}`. If the web netcat service is enabled, you can connect to it via `http://{hostname}:{download_port}/wnc`. When running the script for the first time, `global.json` will be generated in the current folder, and please operate following the prompts in the script.\n\nThe environment includes `python` and `nodejs`, so challenges based on them and binary challenges are supported.\n## Configuration\n\nEdit `global.json` for global configuration, and `config.json` in each challenge directory for challenge specific configuration.\n\n### global.json\n\n```json\n{\n    \"mirrors_base_url\": \"mirrors.tuna.tsinghua.edu.cn\",\n    \"pypi_index_url\": \"https://pypi.tuna.tsinghua.edu.cn/simple\",\n    \"npm_mirror_url\": \"http://registry.npmmirror.com/\",\n    \"port_range_start\": 65100,\n    \"show_download_host\": true,\n    \"download_url\": \"http://localhost:65199\",\n    \"download_server\": true,\n    \"web_netcat_server\": true,\n    \"server_port\": 65199,\n    \"show_echo_msg\": true,\n    \"show_warn_msg\": true,\n    \"resource_limit\": {\n        \"enable\": true,\n        \"max_memory\": \"512M\",\n        \"max_cpu\": \"0.5\"\n    }\n}\n```\n\n- `mirrors_base_url`: Debian mirror source (domain)\n- `pypi_index_url`: PyPI package source\n- `npm_mirror_url`: NPM package source\n- `port_range_start`: The start port for the range of ports for challenges\n- `show_download_host`: Show the download host in the challenge echo message\n- `download_url`: The download url shown in the challenge echo message\n- `download_server`: Whether to enable the download server\n- `web_netcat_server`: Whether to enable the web netcat server\n- `server_port`: The port of the download server\n- `show_echo_msg`: Whether to show the echo message\n- `show_warn_msg`: Whether to show the warning message\n- `resource_limit`: Configuration for resource limit\n  - `enable`: Whether to enable resource limit\n  - `max_memory`: The maximum memory usage\n  - `max_cpu`: The maximum CPU usage\n### config.json\n\n```json\n{\n    \"enable\": true,\n    \"pip_requirements\": [],\n    \"apt_requirements\": [],\n    \"all_copy\": true,\n    \"launch\": \"python3\",\n    \"args\": [\"-u\", \"./src.py\"],\n    \"extra_cmd\": [],\n    \"copy_files\": [],\n    \"echo_msg\": [\"Write some descr here.\"],\n    \"download_file_name\": \"\",\n    \"order\": 10\n}\n```\n\n- `enable`: Whether to enable this challenge\n- `pip_requirements`: The requirements for pip packages\n- `apt_requirements`: Extra apt packages\n- `all_copy`: Whether to copy all files in the challenge directory (`config.json` is not included)\n- `launch`: The launch command\n- `args`: The arguments for the launch command\n- `extra_cmd`: The extra commands to run when build the challenge\n- `copy_files`: The files to copy to the container (when `all_copy` is false)\n- `echo_msg`: The echo message\n- `download_file_name`: The file name of the challenge file\n- `order`: Specific the order of the challenge (port order)\n\n## Notice\n\nDo not put the dictionary with the same name as the challenge in the same directory!\n\nFor more information, please refer to the [CTF-nc-docker 配置指南](https://blog.gztime.cc/posts/2022/ac35dae6) (chinese only).\n\n## Examples\n\n- `tictactoe`\n\n  A pwn challenge from Hackergame 2020.\n\n- `calculator_never_overflow`\n\n  A math challenge from Hackergame 2020.\n\n- `unboxing_simulator`\n\n  A math challenge from Hackergame 2020.\n\n- `cosmic_ray_simulator`\n\n  A pwn challenge from Hackergame 2020.\n\n- `self_repeating_repeater`\n\n  A misc challenge from Hackergame 2020.\n\n## Images\n\n![](https://github.com/GZTimeWalker/CTF-nc-docker/blob/master/images/problems.jpg)\n\n![](https://github.com/GZTimeWalker/CTF-nc-docker/blob/master/images/webnc_portal.jpg)\n\n![](https://github.com/GZTimeWalker/CTF-nc-docker/blob/master/images/webnc.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgztimewalker%2Fctf-nc-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgztimewalker%2Fctf-nc-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgztimewalker%2Fctf-nc-docker/lists"}