Reading in pieces
The build server left a huge log. You don't need to read it all: learn to look only at the beginning and the end, to measure how long it is, and find the release code.
Lab 4 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, 30 and 100 XP.
What you learn
Objectives complete themselves while you work in the terminal; each one is worth experience points:
- Count the lines of the log with wc -l (60 XP)
- Read only the beginning with head (60 XP)
- Read only the end with tail (60 XP)
Topics: linux, log.
Commands you will use
The terminal is simulated and understands about forty Linux commands. In this lab you will mostly need these:
cat: prints the contents of a file: the most direct way to read configurations, notes and logs.wc: counts lines, words and characters: it tells you how big a file is before you open it.head: shows only the first lines of a file, handy for understanding a log format without reading all of it.tail: shows the last lines of a file, that is the most recent events in a log.
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:
A log is read from its ends: head to understand the format, tail to see what happened last (and tail -f to follow it live); wc -l tells you how long it is before it drowns you. Defense: logs are the first source for understanding an incident, so keep them with rotation, and never write secrets (like this release code) in them: they end up where everyone can read them.
Before and after this lab
To unlock it you must have solved:
- Hidden files (Linux Fundamentals, easy)
After this lab you can move on to:
- Searching text (Linux Fundamentals, medium)
- Base64 is not a secret (Encodings & secrets, easy)
- Reading an access log (Blue Team / Defense, easy)
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.