You found the hidden service by choosing the right ports.
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.
TCP connections start with three steps. Port scans work by playing with this handshake:
A SYN/ACK reply means the port is open. A RST (reset) reply means closed. No reply at all usually means filtered.
| Flag | Type | How it works |
|---|---|---|
-sT | Connect | Finishes the full handshake. Reliable, but easy to log. |
-sS | SYN ("half-open") | Stops after SYN/ACK. Faster and quieter. Default with admin rights. |
-sU | UDP | Finds DNS, SNMP and more. Slow, and results can be open|filtered. |
With no -p flag, nmap checks the 1,000 most popular ports. Services on odd ports slip past it.
192.168.1.20, then find the hidden admin service.-p to scan only ports 21, 22, 80 and 445. Compare their states.-sS) and a connect scan (-sT). Read the first lines of output for the difference.-p 21,22,80,445.-sU and pick UDP ports with -p.-p 8000-9000 is fast. Add -sV to read what is running on any open port you find.| State | Meaning |
|---|---|
| open | A service is listening and replied. |
| closed | Host replied, nothing listening. |
| filtered | No reply. A firewall is likely dropping probes. |
| open|filtered | Common in UDP: nmap cannot tell which. |