How to listen to all ports (UDP and TCP) or make them all appear open (linux)

A simple and passive solution would be to log all incoming connection attempts to syslog, run your scan, and when you get home look at the logs. With iptables, you can log connections like this:

iptables -A INPUT -p tcp -m state --state new -j LOG --log-prefix "New connection: "

That way, you don't need to run a service that answers all connetion attempts.


Simplistic method:

Use your regular application to list on one port. Use iptables to forward all ports to the open port by means of the dnat module.

iptables -A PREROUTING -i interface -p tcp -j DNAT --to-destination your.ip:port
iptables -A PREROUTING -i interface -p tcp -j DNAT --to-destination your.ip:port

Why don't you run a sniffer on the server and make sure it listens only to traffic coming in from a certain IP or network? Then run a tool like ftester and you should be able to tell what ports are allowed.