Editorial for DMOJ Capture The Flag '20 G4 - All the folders in the world


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Ninjaclasher

The idea for this problem was to automate the process of extracting compressed files. The folders are nested to a depth of 10, so there could be up to 1023 folders (too much to do manually). On top of this, the compressed files are given arbitrary extensions, so you will need to figure out what the file's actual type is. We can do this with the file command. However, there is one file type where file simply returns data, so we will need another method of determining the type. Turns out, if you open the file in a text editor, the first few bytes will contain the string RPA, hinting you to look into the RPA file type. Downloading an extractor for this file type would have been enough to decompress this file type.

Now, we will need to script the extracting of the files. This can be done with a simple recursive script (in a language of your choice). Finally, once all the files are extracted, we can run a grep for ctf{, since those characters are guaranteed in the flag. This would have revealed the flag to you.


Comments

There are no comments at the moment.