Lab Complete!

You found the hidden service by choosing the right ports.

LABS / port scanning
BEGINNER+
Tasks
What is port scanning?

A computer has 65,535 numbered ports for TCP and another 65,535 for UDP. Each service uses one: web on 80, secure web on 443, remote login on 22. Port scanning means knocking on ports to see which ones answer.

Think of a hotel: Each room number is a port. A scan walks the hallway and knocks. A guest answers (open), nobody is inside (closed), or security stands in the way and says nothing (filtered).
The TCP handshake

TCP connections start with three steps. Port scans work by playing with this handshake:

NORMAL TCP CONNECTION
SYN
SYN/ACK
ACK
Connected

A SYN/ACK reply means the port is open. A RST (reset) reply means closed. No reply at all usually means filtered.

Scan types
FlagTypeHow it works
-sTConnectFinishes the full handshake. Reliable, but easy to log.
-sSSYN ("half-open")Stops after SYN/ACK. Faster and quieter. Default with admin rights.
-sUUDPFinds DNS, SNMP and more. Slow, and results can be open|filtered.
Choosing ports
nmap -p 22,80,443 TARGET # specific ports nmap -p 1-1000 TARGET # a range nmap -p- TARGET # all 65,535 nmap -F TARGET # fast: common ports nmap -sV TARGET # add version info

With no -p flag, nmap checks the 1,000 most popular ports. Services on odd ports slip past it.

Permission first: Only scan systems you own or are authorized to test. This lab uses a fake simulated target.
Mission: Practice the main port scanning techniques on 192.168.1.20, then find the hidden admin service.
1
Scan chosen ports
Use -p to scan only ports 21, 22, 80 and 445. Compare their states.
2
Try TCP scan types
Run a SYN scan (-sS) and a connect scan (-sT). Read the first lines of output for the difference.
3
Scan UDP
Scan UDP ports 53 and 161. Notice the open|filtered state.
4
Find the hidden service
The server runs an admin panel somewhere between ports 8000 and 9000. Find it, identify its version, and submit the flag.
Try first, then peek. Hints guide you without giving the answer.
Separate ports with commas and no spaces: -p 21,22,80,445.
Default scans are TCP. Add -sU and pick UDP ports with -p.
You do not have to scan every port. A range like -p 8000-9000 is fast. Add -sV to read what is running on any open port you find.
Stuck after trying? Reveal the walkthrough.
lab@recon ~ port-scan
$
Live Command Breakdown
Start typing a command to see what each part does...
Waiting for input
Reading port states
StateMeaning
openA service is listening and replied.
closedHost replied, nothing listening.
filteredNo reply. A firewall is likely dropping probes.
open|filteredCommon in UDP: nmap cannot tell which.