4

Is there a way with nmap or anything else to do a continuous port scan, say on port 22, until the service comes up and the port is coming back as open?

Kind of like you may have an infinite ping going, timing out, to see when a host comes back up...but with port scanning?

TryTryAgain
  • 1,152
  • 5
  • 22
  • 41

1 Answers1

9

If you're on Linux, you can try a small script with netcat:

while true;do nc -zv 192.168.100.1 22;sleep 5;done

What this does is check if you can open a TCP connection to the SSH port every 5 seconds. If it does, you'll see this in the stdout:

Connection to 192.168.100.1 22 port [tcp/ssh] succeeded!
Mariano
  • 106
  • 6