ctf.wail.ly Version française

Search inside a file

User rung5

ssh -p 2222 rung5@play.ctf.wail.ly

Goal

ledger.txt has ten thousand lines of the form name: value. The password for the next level is the value on the line whose name is summit.

Commands that may help

Reading

Prerequisite: not tied to a lecture chapter.

Hints

Hint 1
Do not scroll through ten thousand lines. grep prints only the lines of a file that contain a given text: type the text first, then the file name.
Hint 2
The line you get has two words, and the password is the second. cut keeps one field of each line it reads: -d' ' says that fields are separated by a space, and -f2 keeps the second. The sign |, called a pipe, sends what one command prints into the next command instead of to the screen.
Hint 3
Give grep two pieces: first the pattern, between single quotes, made of ^ (which means "at the start of the line"), the name you are looking for and the colon that follows it; then the file name. That prints the line. To keep only the password, put a pipe | after it, then cut with the two options of hint 2. Reading the line and copying the value by hand works too.