![]()
All the components necessary to run a game of the OOO DC CTF finals.
Authors: adamd, hacopo, Erik Trickel, Zardus, and bboe
This repo contains all the game components necessary to run an Attack-Defense CTF that OOO used from 2018--2021.
The design is based on adamd's experience building the ictf-framework.
There are fundamental tenenats that we try to follow in the design of the system:
The communication design of the components in the system (which you can kind of think of as micro-services) is a "spoke" model, where every component talks to the database (through a RESTish API), and no component directly talks to any other.
In this way, each component can be updated separately and can also be _scaled_ independently using our k8s hosting.
This also made testing of each component easier, as the only dependence on a component is on the state of the database.
The only exception to this is the patchbot (the component that needs to test the patches submitted by the teams).
The database API puts the patchbot testing jobs into an RQ (Redis Queue), which all the patchbot workers pull jobs from.
Fundamentally, a CTF database needs to calculate scores (that's essentially what the teams care about).
Prior design approaches that we've used would have a points or score column in the team table, and when they acquired or lost points, the app code would change this value.
However, many crazy things can happen during a CTF: recalculating scores or missed flags, e the scoring functions itself.
These can be difficult to handle depending on how the system is de.
Therefore, we created a completely append-only database model, where no data in the DB is e or changed.
E like service status (the GOOD, OK, LOW, BAD that we used) is not a column in the services table.
Every change of status would created a new StatusIndicator row, and the services would pull the latest from this table.
Related to the append-only database design, e in the database was represented by events.
The database would store all game events (in our game over the years was SLA_SCRIPT, FLAG_STOLEN, SET_FLAG, KOH_SCORE_FETCH, KOH_RANKING, PCAP_CREATED, PCAP_RELEASED, and STEALTH).
Then, the state of the game is based on these events.
An additional benefit is that these events could be shipped to the teams as part of the game_state.json.
How we ran this is with _two_ k8s clusters: an admin cluster and a game cluster.
The admin cluster ran all of these components.
The game cluster ran all of the CTF challenges.
We used this design to do things like drop flags on the services.
The flagbot used kubectl to drop a flag onto a service running in the other cluster.
This also allowed us to lock down the game cluster so that the services couldn't make external requests, could be scaled separately, etc.
This package is pip installable, and installs all dependencies. Do the following in a :
~~~bash
$ pip install -e .
~~~
NOTE: If you want to connect to a mysql server (such as in prod or when deving against a mysql server), install the mysqlclient dependency like so:
~~~bash
$ pip install -e .[mysql]
~~~
Make sure the tests pass before you commit, and add new test cases in test for new features.
Note the database API now checks that the timezone is in UTC, so you'll need to specify that to run the tests:
~~~bash
$ TZ=UTC nosetests -v
~~~
If you're using tmux, I created a script local_dev.sh
that will run a database-api, database-api frontend, team-interface
backend, team-interface frontend, gamebot, and an ipython session with
a database client created.
Just run the following
~~~bash
$ ./local_dev.sh
~~~
Build and -p push the image to production registry.
~~~bash
$ ./deploy.sh -p
~~~
Won't -r restart the running services, need to do:
~~~bash
$ ./deploy.sh -p -r
~~~
This has the tables for the database, a REST API to access it, and a python client to access the REST API.
See ooogame/database for details.
Responsible for putting new flags into all the services for every game tick.
See ooogame/flagbot for details.
Responsible for putting a new flags into a pod when it first comes up (from a team patching the service).
See ooogame/fresh_flagbot for details.
Responsible for incrementing the game's ticks.
See ooogame/gamebot for details.
Responsible for extracting the King of the Hill (koh) scores from all
the koh pods every tick, and submitting them to the database.
See ooogame/koh_scorebot for details.
Responsible for pro an interface to the teams so that they can
submit flags, get pcaps, upload patches, and get their patch status.
Split into a backend flask REST API, which essentially wraps the
database-api, and a React frontend.
See ooogame/team_interface for details.
Responsible for picking up all the newly generated pcaps, anonymize
them, and if the service is releasing pcaps then release them.
See ooogame/pcapbot for details.
Responsible for creating the game state at every new tick and storing them in the nfs, and release them publicly.
See ooogame/gamestatebot for details.
This is also the component that pushes data to the public scoreboard
开发语言:Python
Star 数:58
该项目属于CTF思路方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕Contains all the components necessary to run a DC finals (attack-defense CTF) game from OOO.展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | dcf-game-infrastructure-public - Contains all the components necessary to run a DC |
| 所属分类 | CTF思路 |
| 发布作者 | admin |
| 发布时间 | 2026-10-06 00:04:53 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 508 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |