Challenge Description

As usual, we begin by downloading the file using wget <link>. For this challenge, the downloaded file is a zip file, so I proceeded to unzip it. This created a directory called big-zip-files.

The overwhelming number of directories and files

I ran tree -f big-zip-files to check the number of files and directories that were present in this folder. As observed. there were 358 directories and 8732 files. I tried to use pipe (“|”) to grep “flag” or “pico” from the contents of the output of the tree command. However, since the .txt files were randomly named for this challenge, this approach was ineffective. An example file name is ireiagcarkzcmosqzqlvrh.txt.

PicoCTF Hint: Can grep be instructed to look at every file in a directory and its subdirectories?

After checking various online sources, I came across this post on StackOverflow: How to perform grep operation on all files in a directory?

With the help of this page, I realised the following command can be used.

grep -r "search-term" *
  • -r: recursive i.e, search all subdirectories within the current directory
  • *: select all files and directories in the current directory

I ran the above command twice, first time with the search term being “flag” and the second time with “pico” as the search term.

There were many files with words containing “flag”, but all of them were not what I was looking for.

Successful grep

After I changed the search term to “pico”, I was able to get the flag instantly.

Flag

picoCTF{gr3p_15_m4g1c_ef8790dc}

References