|
6 | 6 | from tortoise.transactions import atomic, in_transaction |
7 | 7 |
|
8 | 8 | import pwncore.containerASD as containerASD |
9 | | -from pwncore.config import config |
| 9 | +from pwncore.config import config, PowerUpType |
10 | 10 | from pwncore.models import ( |
11 | 11 | Hint, |
12 | 12 | PreEventProblem, |
13 | 13 | PreEventSolvedProblem, |
14 | 14 | Problem, |
15 | 15 | Team, |
16 | 16 | User, |
| 17 | + AttackDefTeam, |
| 18 | + AttackDefProblem, |
| 19 | + ActivatedPowerups |
17 | 20 | ) |
18 | 21 | from pwncore.models.ctf import SolvedProblem |
19 | 22 | from pwncore.models.pre_event import PreEventUser |
@@ -146,10 +149,37 @@ async def init_db( |
146 | 149 | image_name="reg.lugvitc.net/key:latest", |
147 | 150 | image_config={"PortBindings": {"22/tcp": [{}]}}, |
148 | 151 | ) |
| 152 | + await Problem.create( |
| 153 | + name="GitGood2", |
| 154 | + description="How to master the art of solving CTFs? Git good nub.", |
| 155 | + author="Aadivishnu and Shoubhit", |
| 156 | + points=300, |
| 157 | + image_name="reg.lugvitc.net/key:latest", |
| 158 | + image_config={"PortBindings": {"22/tcp": [{}]}}, |
| 159 | + ) |
149 | 160 | await Team.create(name="CID Squad", secret_hash=bcrypt.hash("veryverysecret")) |
150 | | - await Team.create( |
| 161 | + triple_a_battery = await Team.create( |
151 | 162 | name="Triple A battery", secret_hash=bcrypt.hash("chotiwali"), coins=20 |
152 | 163 | ) |
| 164 | + triple_b_battery = await Team.create( |
| 165 | + name="Triple B battery", secret_hash=bcrypt.hash("chotiwali2"), coins=20 |
| 166 | + ) |
| 167 | + await AttackDefTeam.create( |
| 168 | + team_id=(await Team.get(name="Triple A battery")).id |
| 169 | + ) |
| 170 | + await AttackDefTeam.create( |
| 171 | + team_id=(await Team.get(name="Triple B battery")).id |
| 172 | + ) |
| 173 | + await AttackDefProblem.create( |
| 174 | + problem_id=(await Problem.get(name="GitGood2")).id, |
| 175 | + attack_def_team_id=(await AttackDefTeam.get(team_id=triple_b_battery.id)).id |
| 176 | + ) |
| 177 | + await ActivatedPowerups.create( |
| 178 | + used_by_id=(await AttackDefTeam.get(team_id=triple_b_battery.id)).id, |
| 179 | + used_on_id = (await AttackDefTeam.get(team_id=triple_a_battery.id)).id, |
| 180 | + powerup_type = PowerUpType.SABOTAGE |
| 181 | + ) |
| 182 | + |
153 | 183 | await PreEventUser. create( tag="23BCE1000", email="[email protected]") |
154 | 184 | await PreEventUser. create( tag="23BRS1000", email="[email protected]") |
155 | 185 | await PreEventSolvedProblem.create(user_id="23BCE1000", problem_id="1") |
|
0 commit comments