The @benjarobin bash script for testing the sequence of ports did not work for me, so I created this minimal example with a non-really single line (command line) that writes the output of the open ports from the sequence 1-65535 (all applicable communication ports) to the local file and suppress all other output:
for p in $(seq 1 65535); do curl -s --connect-timeout 1 portquiz.net:$p >> ports.txt; done
Unfortunately, it takes 18.2 hours to start, since the minimum connection timeout allowed an integer number of seconds with my old version of curl: 1. If you have a version of curl> = 7.32.0 (type "curl -V"), you can try decreasing decimal values, depending on how quickly you can connect to the service. Or try a smaller port range to minimize the duration.
In addition, it will be added to the ports.txt output file, so if you run it several times, you can delete the file first.
Jona
source share