-
Notifications
You must be signed in to change notification settings - Fork 68
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
Challenge cloning #141
Challenge cloning #141
Conversation
@TPGamesNL Could you possibly adapt this PR to work on top of the mirror command? Maybe something like |
@MilyMilo I had a need for this capability and I assumed the mirror command would do it. What do you think would be a good way to combine this |
I just noticed this didn't pull flags from the remote CTFd instance as well. |
Overall I had a hard time coming up with a rationale for this, because I don't think we should reinforce a pattern for using CTFd to manage the ctfcli project - because that defeats the purpose of using ctfcli from the beginning. Mirror was meant for quick fixes during the event which you'd like to reflect in the project. However I think this could be useful for converting challenges to ctfcli format, a case where you've run an event, it was a success, and now you want to convert it to a reproducible format. There would be still manual labor involved as you'd need to manually create repositories for challenges, or just throw the code inside the challenge subdirectory, but I agree this would provide a nice starting point. So, I agree with @ColdHeat, I'd see this more as a switch to the mirror command, perhaps something like |
Has this been implemented in one way or another? I've just installed CTFCLI for the first time and attempting to clone or mirror my CTFd hosted instance to a local structure on my laptop and 'ctf challenge mirror' doesn't seem to mirror any challenges or create a folder structure even though it says 'Success! All Challenges mirrored!'. |
I believe the implementation of mirror only copies challenges which exist on both the remote and the local. I think I like the idea of |
@TPGamesNL Looks like I don't have access to modify your fork so I'll have to continue in a new branch here. If you want credit for the PR just allow collaborator access on the PR and I'll be able to update this to merge it in. |
@ColdHeat sorry first of all for my lack of response, I wanted to update the PR but haven't found the time to do so. As I have opened the PR from an organisation's fork, I cannot allow you collaborator access. Feel free to continue this on a new branch and close this PR. Thank you for taking the time for this feature! |
Implements challenge cloning functionality: allows you to pull challenges from a CTFd instance that are possibly not on your local environment yet. Will either create & add them if they don't exist locally, or update (mirror) them if they do exist locally.
The name of the directory where the challenge will be saved is formed with the challenge's category and name, with slugify (e.g.
pwn/stuff
). However, there is an option to instead prompt the user for the name of the directory. It will then ask the user for input on where to store the challenge (with the generated name as the default).Some concerns regarding current implementation:
Challenge
object without the files, so I can just mirror it directly with that. However, I don't think it's possible: if it is, let me know how.Challenge
class, but it has IO interaction (e.g. asking for user input for the directory name), which would be more appropriate for the CLI file. I could go for a middleground, and pass a function for getting the directory name of a challenge as a parameter to the function in theChallenge
class. If that's more appropriate let me know and I'll implement it.Closes #6