May 16, 2023 by Thibault Debatty | 2093 views
https://cylab.be/blog/269/how-to-detect-filtered-and-opened-outgoing-ports-on-a-network
Sometimes you want to access services running on unusual ports, like a SSH server running on port 2222 for example. If connection fails, how can we detect the outgoing ports that are filtered or open on the network?
Well, there is a solution: http://portquiz.net/
This server listens on all ports for incoming connections. So you can test for filtered outgoing ports using nmap, netcat, wget or curl. And on windows you can use powershell.
To test a single port:
nmap -p 1234 portquiz.net
Test popular ports:
nmap portquiz.net
To test all ports (very slow):
nmap -p- portquiz.net
Netcat:
nc -v portquiz.net 1234
Curl:
curl portquiz.net:1234
Wget:
wget -qO- portquiz.net:1234
PS C:\> Test-NetConnection -InformationLevel detailed -ComputerName portquiz.net -Port 80
On this server, there is actually a single (and simple) web server running on port 80. And there is an iptables rule to redirect other ports to this web server:
iptables -t nat -A PREROUTING -p tcp -j DNAT --to-destination :80
You can find the details on the blog post of the author: http://positon.org/portquiz-net-how-it-works
This blog post is licensed under CC BY-SA 4.0