We’re going to do some port scanning!
NOTE: We’re only going to run this on localhost to avoid any legal trouble.
To make this happen, we need to install the nmap too.
MacOS:
brew install nmapWindows WSL:
sudo apt-get update
sudo apt-get install nmapPortscan All Common Ports
This command will portscan 1000 of the most common ports:
nmap localhostWhat’s the output?
Portscan All Ports
This will scan all the ports–starting from 0 on:
nmap -p0- localhostWhat’s the output?
Run a Server and Portscan
Run any TCP server program that you wrote this quarter on some port.
Run the all-port scan again (above).
Notice your server’s port in the output!
Does your server crash with a “Connection reset” error? If so, why? If not, speculate on why this might happen even if you didn’t see it from your server. (See the Port Scanning chapter for this!)