{"id":16489538,"url":"https://github.com/nanoy42/git-ctf","last_synced_at":"2026-04-16T19:36:12.996Z","repository":{"id":135999875,"uuid":"600472343","full_name":"nanoy42/git-ctf","owner":"nanoy42","description":"A CTF challenge build on git","archived":false,"fork":false,"pushed_at":"2023-02-11T16:12:16.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T19:13:21.702Z","etag":null,"topics":["challenge","ctf","docker","git"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanoy42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-11T15:50:53.000Z","updated_at":"2023-02-11T16:12:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d24bb87-ace4-4629-a9ca-d9ef0c9d0c3a","html_url":"https://github.com/nanoy42/git-ctf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoy42%2Fgit-ctf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoy42%2Fgit-ctf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoy42%2Fgit-ctf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoy42%2Fgit-ctf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanoy42","download_url":"https://codeload.github.com/nanoy42/git-ctf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241315971,"owners_count":19942962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["challenge","ctf","docker","git"],"created_at":"2024-10-11T13:44:28.802Z","updated_at":"2025-10-24T16:34:53.368Z","avatar_url":"https://github.com/nanoy42.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CTF challenge built on top of the git\n\n## Generate the challenge\n\nTo generate the challenge, edit the different parameters at the beginning of the python file (`LINE`, `N_LINES`, `TOKEN`, `REMOTE`, `PEOPLE_MAIN`, `PEOPLE_END`).\n\n\nIt will generate a `ctf-base` folder containing only a commit saying the player should set up the remote and the `ctf` folder that should be pushed to the remote. Players shouldn't have write access to the remote.\n\n## Solutions to the challenge\n\nThe solution of the challenge goes like this:\n\n1. `git log` will show you to put the remote (as set as in the generation file).\n2. `git remote add origin whatever` will add the remote\n3. `git fetch` to fetch the information\n4. `git branch --set-upstream-to=origin/main main` to set the upstream for the current branch\n5. `git pull` to fetch and merge the latest modification\n6. `git log` to see that you should look at someone's commit (defined in the configuration file). Let's say it's Josh Baker.\n7. `git log --author=\"Josh Baker\"`. Locate previous commit to commit with `Ooops. That was actually a secret` commit message. Let's say id is 197cdd167a73197968bdbb9fc6a5709dc9cbfe07.\n8. `git checkout 197cdd167a73197968bdbb9fc6a5709dc9cbfe07` to checkout to this version of the code.\n9. `cat secrets.txt` to see the content of the file. It will say to look at some line (defined in the script) of the file `text.txt`. Let's say it's line 33.\n10. `git blame -L 33,33` to see the owner of the branch you should see. Let's say it's Fraser Fisher.\n11. `git checkout FraserFisher` to switch branch.\n12. `git log` it will say to look at the difference between two commits (let's say `73c813e` and `e208c2c`).\n13. `git diff 73c813e e208c2c` to find the string.\n\n## Generating the docker image\n\nDon't forger to change the root password in the Dockerfile.\n\nYou should put an ssh key for a user with read access to the remote in the `ssh` folder (`id_rsa` and `id_rsa.pub`).\n\nYou can generate the image with `docker build . -t \u003cusername\u003e/git-ctf`\n\nYou can then generate an archive of your image with `docker save -o dockerctf.tar \u003cusername\u003e/git-ctf`.\n\n## A possible improvement ot the challenge\n\nThe challenge can be finished very fast using the `git grep` command if you know the format of the ctf string.\n\nA possible improvement would be to create decoys in the repo or to not give the format of the ctf string to the players.\n\n## A website for the challenge\n\nYou can check https://github.com/nanoy42/git-ctf-website to have a small website to host the challenge.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoy42%2Fgit-ctf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanoy42%2Fgit-ctf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoy42%2Fgit-ctf/lists"}