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

Unable to install challenges with the same name (but different category) #35

Open
tieknimmers opened this issue Dec 12, 2020 · 1 comment

Comments

@tieknimmers
Copy link

tieknimmers commented Dec 12, 2020

The function install() in ctfcli/cli/challenge.py implements a check to see if there is already a challenge with the same name. This check does this as follows:

if c["name"] == challenge["name"]:
    click.secho(
        "Already found existing challenge with same name. Perhaps you meant sync instead of install?",
        fg="red",
    )

As a result, ctfcli refuses to install challenges with the same name regardless of the category.

I have been using a modified variant of ctfcli that determines if a challenge is already present based on the challenge name and challenge category.

if c["name"] == challenge["name"] and c["category"] == challenge["category"]:
    click.secho(
        "Already found existing challenge with same name. Perhaps you meant sync instead of install?",
        fg="red",
    )

The same check is also present in the function sync_challenge() in ctfcli/utils/challenge.py and should be changed in similar fashion to sync the correct challenge.

I guess this is the intended/expected behaviour?

@tieknimmers tieknimmers changed the title unable to install challenges with the same name (even if they are in different categories) Unable to install challenges with the same name (even if they are in different categories) Dec 12, 2020
@tieknimmers tieknimmers changed the title Unable to install challenges with the same name (even if they are in different categories) Unable to install challenges with the same name (but different category) Dec 12, 2020
@ColdHeat
Copy link
Member

Yes the behavior is as intended but there are definitely better ways to determine if a challenge is already installed.

However Im not sure if category is a good additional check b/c what if you were to change the category of a challenge? You would end up with two challenges instead of one.

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

No branches or pull requests

2 participants