If you’re like me and want to stand up a quick server that can response on all ports, here’s a quick way to do it. You’ll need a ton of memory to pull this off so setup your machine or VM accordingly. This works for nginx but you’ll have to go through some of the same steps for other services.
Check current ulimits, hard limits, and soft limits on your current account:
To check them for the “www-data” user you can log in via:
sudo su -s /bin/bash www-data
This gist has a pretty good summary of possible nginx configuration options you want to choose.
fs.file-max = 999999to /etc/sysctl.conf`
www-data soft nofile 999999and
www-data hard nofile 999999in /etc/security/limits.conf
worker_rlimit_nofile 999999;in /etc/nginx/nginx.conf`
Replace the listening on port 80 and add all of the ports to the /etc/nginx/sites-available/default.
python -c 'for i in range(1,65535): print("\tlisten\t%s;" % i)' > alltheports.txt