picoGym Exclusive General Skills: Big Zip
Here is a another walk through of one of the easier file crawling CTF challenges
First thoughts: I will need to find the flag as a single string inside a bunch of text files. Lets go.
First I download and extract the big-zip-files.zip file then get nauseated at the 3,109 KB file size....knowing ill be dealing with tiny *.txt files
Of course every folder contains a folder and a million text files(I think the number is closer to 9000+ files).
So, the goal of this challenge, per the hint is to work smarter, not harder. Create a script that will crawl through each folder and file looking for our flag. We know our flag starts with "pico", so we need to find a way to search for that.
ChatGPT to the rescue. The hint mentioned grep, but I'm using Windows right now, so I asked about a batch file. In most cases, even if I know a thing is possible, I will ask ChatGPT if it's possible.
In the explanation, it says that the script only looks for our string in the filename, so I wanted CGPT to fix this:
With our string in-hand we pop open notepad, paste it in, change our values(change 'your_search_word_here' to 'pico'; change the searchDir to the path where the tons of files are located) and run the batch file: Note, I added a 'pause' before 'endlocal' to keep the script from closing the console window automatically after completion.
With our string in-hand we pop open notepad, paste it in, change our values(change 'your_search_word_here' to 'pico'; change the searchDir to the path where the tons of files are located) and run the batch file:
BOOM! The script has found our flag in a single file among many. Lets go to that file
Flag found. ChatGPT is here and is the future whether we like it or not and I am here for it.