Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attack/Defence: CTF Problems #53 #76

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tripathiji1312
Copy link

feat: Add AttackDefProblem model and update CTF routes

  • Create AttackDefProblem model with foreign keys to the team and Problem models
    (Note: Currently importing the team model directly since the dedicated AttackDefTeam model is pending)
  • Update the underlying Problem model by adding the following fields:
    • difficulty_level – for selecting and upgrading AttackDefProblems via powerups
    • problem_type – to distinguish between attack/def CTFs and jeopardy-style CTFs
  • Modify ctf.py to include new fields: attackdef_teams and problem
  • Routes clarification needed:
    The original requirements mention modifying all existing CTF routes to reject attack/def submissions and creating new routes for attack/def CTFs that incorporate powerup logic. Could you please clarify whether:
    • We need to duplicate the existing CTF routes with adjustments for attack/def logic, or
    • Integrate a conditional handling within the current routes?
      Additional guidance on how the powerup logic should affect the route behavior would be appreciated.

Closes #53

@tripathiji1312 tripathiji1312 marked this pull request as draft February 23, 2025 07:48
@tripathiji1312 tripathiji1312 marked this pull request as ready for review February 24, 2025 09:59
@@ -39,7 +39,8 @@ class Problem(BaseProblem):
ma = fields.IntField(default=500)
visible = fields.BooleanField(default=True)
tags = fields.SmallIntField(default=1) # by default misc, 16 tag limit

difficulty_level = fields.SmallIntField(default=1)
problem_type = fields.TextField(default="jeopardy") #Can use enum too

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SmallIntField


class AttackDefProblem(Model):
id = fields.IntField(pk=True)
team: fields.ForeignKeyRelation[Team] = fields.ForeignKeyField(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attack_def_team: fields.ForeignKeyRelation[AttackDefTeam] = fields.ForeignKeyField(
  "models.AttackDefTeam", related_name="assigned_attack_def_problem"
)

@ThEditor
Copy link

ThEditor commented Feb 25, 2025

Do different endpoints for the different modes. One route should always only do one thing so move to a separate router for round 2. The round 2 router should be called FFA and the round 1 router should be jeopardy. These should be the prefixes for the two modes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attack/Defence: CTF Problems
2 participants