Viewing TCP connections with netstat
netstat -tpn shows TCP connections on your current machine.
Start a TCP server with
nc -l 127.0.0.2 -p 12345,
then connect to it with
nc 127.0.0.2 12345.
After this, we can see the connection:
$ sudo netstat -tpn Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.2:12345 127.0.0.1:39548 ESTABLISHED 5441/nc tcp 0 0 127.0.0.1:39548 127.0.0.2:12345 ESTABLISHED 5445/nc
Notice our one TCP connection is listed twice!
We can see why by running
it traverses every process in
More by Jim
- Smear phishing: a new Android vulnerability
- A probabilistic pub quiz for nerds
- Time is running out to catch COVID-19
- The inception bar: a new phishing method
- The hacker hype cycle
- Project C-43: the lost origins of asymmetric crypto
- How Hacker News stays interesting
- My parents are Flat-Earthers
- The dots do matter: how to scam a Gmail user
- The sorry state of OpenSSL usability
- I hate telephones
- The Three Ts of Time, Thought and Typing: measuring cost on the web
- Granddad died today
- Your syntax highlighter is wrong
Tagged . All content copyright James Fisher 2018. This post is not associated with my employer. Found an error? Edit this page.