I'm using RouterOS. In the firewall rules you can create a rule that if an IP touches a port, it get added to a address list (optional with a time-out). So my FW rules begin like this:
- If source is whitelisted, Accept (avoid being locked out myself)
- If source IP is in the blacklist, drop all
- if source IP tries to connect to port 21,22,25,137-139, 113 (and a bunch of others) add it to the blacklist
- ....
- ....
So using a portscanner will touch ports I'm not running any service on (like telnet) and you'll be blocked. A time-out of one week on the blacklist usually gives me an blacklist of 6500+ addresses.
This too has endless possibilities. t.ex. like port knocking. ('touch' one or more ports in a specified sequence in a specified time to be allowed to access the actual service port)