12/34
Sign inSign up free

1029. Read a Connection Dump During an Incident

medium 20 XP ~12 minHands-on lab

During last night's slowdown, someone saved ss -tan from a web server to /home/student/incident/ss-capture.txt. The team wants the same short summary every time.

Task

Create the executable script /home/student/bin/ss-report.sh FILE that prints:

  1. one line <STATE> <count> per TCP state in the file, sorted by count (highest first), ties by state name,
  2. syn-recv-top: <ip> <count>: the remote IP address with the most SYN-RECV connections (ties: the smaller address as text). Leave the line out if there are none,
  3. established-443: <count>: ESTAB connections whose local port is 443.

Addresses may be IPv4 (10.0.0.5:443), IPv6 ([2001:db8::5]:443) or IPv4-mapped ([::ffff:203.0.113.9]:51514). Report an IPv4-mapped address as plain IPv4 (203.0.113.9). The header line isn't a connection.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.