diff --git a/__init__.py b/__init__.py index 448ea60..28c91d2 100644 --- a/__init__.py +++ b/__init__.py @@ -8,7 +8,7 @@ from CTFd.models import Flags, db from flask import Blueprint, render_template, request from .models import CheaterTeams -from .flags import PersonalFlag +from .flags import PersonalFlag, report_cheater PLUGIN_PATH = os.path.dirname(__file__) @@ -17,12 +17,6 @@ directory_name = PLUGIN_PATH.split(os.sep)[-1] # Get the directory name of this bp = Blueprint(directory_name, __name__, template_folder="templates") -def report_cheater(challenge_id: int, cheater_id: int, helper_id: int, flag_id: int): - cheater = CheaterTeams(challenge_id, cheater_id, helper_id, flag_id) - db.session.add(cheater) - db.session.commit() - - def create_flag_if_missing(challenge_id: int, user_id: int, flag_content: str): flags = Flags.query.filter_by(id=challenge_id, data=user_id).all() diff --git a/flags.py b/flags.py index 2da7b94..f7a1187 100644 --- a/flags.py +++ b/flags.py @@ -1,7 +1,14 @@ from CTFd.plugins.flags import BaseFlag from CTFd.utils.user import get_current_user +from CTFd.models import db +from .models import CheaterTeams -from . import report_cheater + + +def report_cheater(challenge_id: int, cheater_id: int, helper_id: int, flag_id: int): + cheater = CheaterTeams(challenge_id, cheater_id, helper_id, flag_id) + db.session.add(cheater) + db.session.commit() class PersonalFlag(BaseFlag):