Searching text
You inherited Marta's notes and mailbox. Somewhere in there is the token for the server room, but nobody remembers which email it is in. Don't read everything: search for the right words with grep.
Lab 5 of 9 in the Linux Fundamentals path. If you get stuck you have 3 hints, from the vaguest to the most precise: they cost 0, 40 and 150 XP.
What you learn
Objectives complete themselves while you work in the terminal; each one is worth experience points:
- Search a word in the notes with grep (100 XP)
- Search the whole archivio_mail folder with grep -r (150 XP)
- Open the right email (150 XP)
Topics: linux, grep.
Commands you will use
The terminal is simulated and understands about forty Linux commands. In this lab you will mostly need these:
ls: lists the files in a folder; with -l it shows permissions and owners, with -a hidden files too. It is the first command on any machine.grep: finds the lines that contain a word, even across whole folders with -r. It is the main tool for analysing text and logs.cat: prints the contents of a file: the most direct way to read configurations, notes and logs.
The simulated environment
You work in a simulated Linux shell, in the home folder of the user runner: invented files and folders, no network target.
The defensive lesson
Once the lab is solved, the write-up explains what went wrong and how to protect yourself:
grep is the Swiss army knife of text analysis: -i ignores case, -n numbers the lines, -r descends into folders. With lots of emails, logs or notes, searching by keyword beats reading everything. Defense: secrets must not be sent by email or left in notes — anyone with access to the mailbox can find them with a single grep; use a secrets manager and short-lived tokens.
Before and after this lab
To unlock it you must have solved:
- Reading in pieces (Linux Fundamentals, easy)
After this lab you can move on to:
- Finding files (Linux Fundamentals, medium)
- Secrets inside an executable (Encodings & secrets, medium)
- The manufacturer's manual (Web Exploitation, medium)
The Linux Fundamentals path
Linux Fundamentals is the starting point. Almost every server, network device and security tool runs on Linux, and anyone who defends a system (or tests it with permission) spends much of their time in a terminal. Here you learn to move around the filesystem, find hidden files, read huge logs piece by piece, search for words with grep, chain commands with pipes and understand permissions, environment variables and history: the basics you will use in every other path.