diff --git a/flags.py b/flags.py index f7a1187..bc3cb85 100644 --- a/flags.py +++ b/flags.py @@ -1,8 +1,8 @@ +from CTFd.models import db from CTFd.plugins.flags import BaseFlag from CTFd.utils.user import get_current_user -from CTFd.models import db -from .models import CheaterTeams +from .models import CheaterTeams def report_cheater(challenge_id: int, cheater_id: int, helper_id: int, flag_id: int): @@ -34,13 +34,12 @@ class PersonalFlag(BaseFlag): # If the flag is correct, we need to check if the team is the one associated with the flag curr_user_id = get_current_user().id - if int(user_id) == int(curr_user_id): - # User is correct - return True + if int(user_id) != int(curr_user_id): + # Caught a cheater! + report_cheater( + chal_key_obj.challenge_id, curr_user_id, user_id, chal_key_obj.id + ) - # Caught a cheater! - report_cheater( - chal_key_obj.challenge_id, curr_user_id, user_id, chal_key_obj.id - ) + return True return False