Challenge Author:
Difficulty: Easy
Description
I accidentally wrote the flag down. Good thing I deleted it!
Process / Notes
- A lot of files in a .git folder got unzipped
caton a message reads “TOP SECRET”- Recursively grepping
grep -r 'pico' .git/*- a few things pop up, looks like it’ll be in the log file with the initial commit - Using
treeto help navigate around catinto the files doesn’t seem to help. I have a feeling the key has something to do with the commit code in./logs/refs/head/master- The commit code
- There’s a 3d folder in objects, and the rest of the line corresponds to a file in that folder, so I’ll check that out
- The file type is “zlib compressed data” - whatever that means
catproduces jibberishstringsandhexdumpdon’t seem to help- At 17:41 looking up how to access the file. I believe I know which one
- It’s a git-specific command!
- Access the git log with
git log - You can see the commit codes and comments for each commit
- It looks like you need to be in the project root in order to run
git checkout log_code_here
###
You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state wihtout impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git swtich -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at ### create flag
- Now we’re back to the version where the message has the flag!!!
git switch -brought us back to the master branchcaton the message now reads “TOP SECRET” like it did before. Incredible
24 minutes 42 seconds to complete
Hints
- Version control can help you recovery files if you change or lost them!
- Read the chapter on git from the picoPrimer
- You can ‘checkout’ commits to see the files inside them
Core Lessons
- Understanding the version control aspects of git is massive
- Examining the git log with
git logto see commit comments and commit codes - Switching to old commits with
git checkout log_code - Creating a new branch wiht `git switch -c
- Returning to the master branch with
git switch -