Module 2 · Linux you will actually use · Lesson 10 of 16
Lab: investigate a log, then automate a sweep
Find who is guessing passwords on Tana Roasters' server, check whether they got in, then run your first script.
In this lesson · about 30 minutes
- Use permissions, grep and pipes on a real-looking log
- Spot a successful login after a burst of failures
- Make a script executable and run it
Your first script
A script is just commands saved in a file. This one pings every address on the lab network at once and prints the ones that answer. Nmap replaces it in Module 5, but writing it once shows you what Nmap does for you.
#!/bin/bash
# sweep.sh: find live hosts on the lab network
for i in $(seq 1 254); do
ping -c 1 -W 1 192.168.56.$i | grep "bytes from" | cut -d " " -f 4 | tr -d ":" &
done
wait
The & runs each ping in the background so all 254 run in parallel, and wait holds until they finish. Before you can run it by name, the file needs execute permission.
Hands-on lab (simulated terminal)
Tana Roasters' SSH log
Tana Roasters' admin has sent you a copy of their SSH log, labs/tana-auth.log, and asked who is guessing passwords. Then you get the sweep script running. You start in /home/kali. Everything is simulated.
Step 1 of 8. Type each command and press Enter. Nothing runs on your computer.
1. Check which folder you are in.
Check your understanding0 of 2 correct
Flashcards
Module 2 flashcards
0 of 9 known
Say the answer out loud, flip the card, then be honest: cards you miss come back at the end.
Practice exam
Module 2 checkpoint
8 questions, 10 minutes. Aim for 80% before you move on.
- 8 questions · 10 minutes
- No feedback until you submit. Flag questions to come back to them.
- Aim for 85% or better before you move on. The real exam's 750 out of 900 is roughly 80–83%.
Quiz score: 0 of 2
For authorized, lab-based learning only. Tana Roasters and every person, address and password in this course are fictional. Every terminal is simulated. "Kali Linux" is a trademark of OffSec; this course is not affiliated with or endorsed by OffSec.