{"id":13843741,"url":"https://github.com/glzjin/CTFd-Whale","last_synced_at":"2025-07-11T19:33:28.970Z","repository":{"id":52054261,"uuid":"202660076","full_name":"glzjin/CTFd-Whale","owner":"glzjin","description":"A plugin for CTFd which allow your users to deploy a standalone instance for challenges.","archived":true,"fork":false,"pushed_at":"2024-04-13T14:03:19.000Z","size":72,"stargazers_count":227,"open_issues_count":6,"forks_count":70,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-05T17:39:07.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glzjin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2019-08-16T04:47:56.000Z","updated_at":"2024-08-03T17:31:51.000Z","dependencies_parsed_at":"2023-01-30T20:15:27.352Z","dependency_job_id":"3be1c15a-3866-4d45-b022-0f97b57d8eef","html_url":"https://github.com/glzjin/CTFd-Whale","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glzjin%2FCTFd-Whale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glzjin%2FCTFd-Whale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glzjin%2FCTFd-Whale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glzjin%2FCTFd-Whale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glzjin","download_url":"https://codeload.github.com/glzjin/CTFd-Whale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225755125,"owners_count":17519206,"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":[],"created_at":"2024-08-04T17:02:25.867Z","updated_at":"2024-11-21T15:31:28.118Z","avatar_url":"https://github.com/glzjin.png","language":"Python","funding_links":[],"categories":["Python (1887)","Python"],"sub_categories":[],"readme":"此分支已不再维护，如需继续使用请参考 [https://github.com/frankli0324/ctfd-whale](https://github.com/frankli0324/ctfd-whale) 。\n\n此分支已不再维护，如需继续使用请参考 [https://github.com/frankli0324/ctfd-whale](https://github.com/frankli0324/ctfd-whale) 。\n\n此分支已不再维护，如需继续使用请参考 [https://github.com/frankli0324/ctfd-whale](https://github.com/frankli0324/ctfd-whale) 。\n\n:)\n\n# CTFd-Whale\nA plugin for CTFd which allow your users to launch a standalone instance for challenges.\n\n![https://www.zhaoj.in/wp-content/uploads/2019/08/1565947849bb2f3ed7912fb85afbbf3e6135cb89ca.png](https://www.zhaoj.in/wp-content/uploads/2019/08/1565947849bb2f3ed7912fb85afbbf3e6135cb89ca.png)\n\n![https://www.zhaoj.in/wp-content/uploads/2019/08/15659478989e90e7a3437b1bdd5b9e617d7071a79f.png](https://www.zhaoj.in/wp-content/uploads/2019/08/15659478989e90e7a3437b1bdd5b9e617d7071a79f.png)\n\n![https://www.zhaoj.in/wp-content/uploads/2019/08/15659479342f5f6d33e2eeaedb313facd77b2bbccb.png](https://www.zhaoj.in/wp-content/uploads/2019/08/15659479342f5f6d33e2eeaedb313facd77b2bbccb.png)\n\n![https://www.zhaoj.in/wp-content/uploads/2019/08/1565923903609e6c236759a5663be8e0fb57904482.png](https://www.zhaoj.in/wp-content/uploads/2019/08/1565923903609e6c236759a5663be8e0fb57904482.png)\n\n## Features\n- Provide a new challenge type - dynamic_docker.\n- The player can launch an instance for these challenge on the challenge board by one click.\n- Every instance has a unique flag.\n- Admin can manage the instance at the admin panel.\n\n## Usage\n0. You should init docker swarm, and add your node to it. And name them with following command:\n\n```\ndocker node update --label-add name=windows-1 ****\ndocker node update --label-add name=linux-1 ****\n```\n\nName of them should begin with windows- or linux-.\n\n1. Copy this folder to your ctfd plugins folder. *Make sure the folder name is 'ctfd-whale'.*\n2. Deploy [frp](https://github.com/fatedier/frp/) on your servers, and you should make sure CTFd can access frpc admin API directly.\n3. And also make sure docker API is accessible to CTFd, you should create a network in docker called 'ctfd_frp-containers' which allow frp redirect traffic to challenge instances.\n4. Configure this plugin on the admin panel.\n5. Now you may create a challenge, choose the challenge type - dynamic_docker and fill the form.\n6. Click the preview button, then you can launch an instance for this challenge.\n7. Enjoy it:)\n\n## Some configuration file\n\n1. docker-compose.yml for CTFd I used.\n\n```\nversion: '2.2'\n\nservices:\n  ctfd-nginx:\n    build: ./nginx\n    user: root\n    restart: always\n    ports:\n      - \"80:80\"\n      - \"443:443\"\n    networks:\n        default:\n        internal:\n    depends_on:\n      - ctfd\n    cpus: '2.50'\n    mem_limit: 150M\n  ctfd:\n    build: .\n    user: root\n    restart: always\n    environment:\n      - UPLOAD_FOLDER=/var/uploads\n      - DATABASE_URL=mysql+pymysql://root:ctfd@db/ctfd\n      - REDIS_URL=redis://cache:6379\n      - WORKERS=1\n      - LOG_FOLDER=/var/log/CTFd\n      - ACCESS_LOG=-\n      - ERROR_LOG=-\n      - REVERSE_PROXY=true\n    volumes:\n      - .data/CTFd/logs:/var/log/CTFd\n      - .data/CTFd/uploads:/var/uploads\n      - .:/opt/CTFd:ro\n      - /var/run/docker.sock:/var/run/docker.sock\n    depends_on:\n      - db\n    networks:\n        default:\n        internal:\n        frp:\n            ipv4_address: 172.1.0.2\n    cpus: '2.50'\n    mem_limit: 450M\n\n  db:\n    image: mariadb:10.4\n    restart: always\n    environment:\n      - MYSQL_ROOT_PASSWORD=ctfd\n      - MYSQL_USER=ctfd\n      - MYSQL_PASSWORD=ctfd\n    volumes:\n      - .data/mysql:/var/lib/mysql\n    networks:\n        internal:\n    # This command is required to set important mariadb defaults\n    command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --wait_timeout=28800, --log-warnings=0]\n    cpus: '2.50'\n    mem_limit: 750M\n\n  cache:\n    image: redis:4\n    restart: always\n    volumes:\n      - .data/redis:/data\n    networks:\n        internal:\n    cpus: '2.50'\n    mem_limit: 450M\n\n  frpc:\n    image: glzjin/frp:latest\n    restart: always\n    volumes:\n      - ./frpc:/conf/\n    entrypoint:\n        - /usr/local/bin/frpc\n        - -c\n        - /conf/frpc.ini\n    networks:\n        frp:\n            ipv4_address: 172.1.0.3\n        frp-containers:\n    cpus: '1.50'\n    mem_limit: 250M\n\nnetworks:\n    default:\n    internal:\n        internal: true\n    frp:\n        driver: bridge\n        ipam:\n            config:\n                - subnet: 172.1.0.0/16\n    frp-containers:\n        driver: overlay\n        internal: true\n        ipam:\n            config:\n                - subnet: 172.2.0.0/16\n```\n\nInternet --\u003e frps1 --\u003e frpc1 --\u003e nginx --\u003e ctfd\n\nInternet --\u003e frps2 --\u003e frps2 --\u003e chanllenge_instance\n\n2. frpc config tamplate\n\n```\n[common]\ntoken = ***************\nserver_addr = *******\nserver_port = ****\npool_count = 200\ntls_enable = true\n\n# Make sure it's only exposed the port to the network that only has ctfd and frp, not the frp and challenge instance one.\nadmin_addr = 172.1.0.3\nadmin_port = 7400\n```\n\n3. Some challenge image you can use.\n\n[https://github.com/CTFTraining/CTFTraining](https://github.com/CTFTraining/CTFTraining)\n\n4. Challenge image requirement\n- Support set flag by setting docker environment \"FLAG\".\n\n5. The configuration I have set on the CTFd admin panel.\n![https://www.zhaoj.in/wp-content/uploads/2019/08/1565931400faa3a335e9a8531e8e34cdb1e5ede899.png](https://www.zhaoj.in/wp-content/uploads/2019/08/1565931400faa3a335e9a8531e8e34cdb1e5ede899.png)\n\n## Demo\n[BUUCTF](https://buuoj.cn)\n\n## Third-Party Introduction\n- [CTFd-Whale 推荐部署实践](https://www.zhaoj.in/read-6333.html)\n- [手把手教你如何建立一个支持ctf动态独立靶机的靶场（ctfd+ctfd-whale)](https://blog.csdn.net/fjh1997/article/details/100850756)\n\n## Twins\n\n- [CTFd-Owl](https://raw.githubusercontent.com/D0g3-Lab/H1ve/master/CTFd/plugins/ctfd-owl) (Support docker-compose)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglzjin%2FCTFd-Whale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglzjin%2FCTFd-Whale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglzjin%2FCTFd-Whale/lists"}