Find by name
User rung3
ssh -p 2222 rung3@play.ctf.wail.ly
Goal
Under the warehouse directory there are hundreds of files. Only one of them has a name ending in .key: it holds the password for the next level.
Commands that may help
findcat
Reading
man find: the test-name.man 7 glob: what*matches in a pattern.
Prerequisite: not tied to a lecture chapter.
Hints
Hint 1
Opening the directories one by one with
cd and ls would take a long time. find walks a whole tree for you: find warehouse on its own lists every file and directory under warehouse.Hint 2
find can keep only the entries whose name matches a pattern, with the test -name followed by the pattern. In a pattern, * stands for any run of characters. Put the pattern between quotes, as for the awkward name of an earlier level, so that the shell passes the * to find instead of using it itself. Single quotes ' are the safest: the shell changes nothing between them.Hint 3
Write one
find command with three pieces, separated by spaces: first the directory to search, warehouse; then the test -name; then the pattern, between single quotes, made of a * followed by the end of the name you are looking for. It prints the path of the file. Then print that file with cat followed by the path find gave you.