Intermediate · 4 missions
SOC: read a server log — Linux terminal practice
Defensive SOC analyst work: read auth.log, spot repeated failed logins, find the noisiest IP and write a short report.
Missions in this track
SOC analyst ki tarah logs padh kar failed logins aur sabse zyada try karne wala IP pakdo.
-
1
The alert
An alert says "many failed SSH logins". Look at the last 10 lines of
/var/log/auth.log.Show the command
tail /var/log/auth.logWithout -n, tail shows 10 lines.
-
2
Pull out the IPs
Print only the IP addresses from the Failed password lines.
Show the command
grep "Failed password" /var/log/auth.log | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"-oprints only the matching part,-Eturns on extended regex. -
3
Top attacker
Count attempts per IP (sort | uniq -c | sort -nr) and
submitthe IP with the most attempts.Show the command
grep "Failed password" /var/log/auth.log | grep -oE "[0-9.]{7,}" | sort | uniq -c | sort -nrThis one-liner is in every SOC analyst's toolbox.
-
4
Write the report
Save your finding:
echo "many failed logins from 185.220.101.7" > ~/incident.txt.Show the command
echo "many failed logins from 185.220.101.7" > ~/incident.txtTypical fixes: block the IP in the firewall, set PermitRootLogin no, use SSH keys and fail2ban.