seq 1 254 | xargs -P255 -I{} bash -c 'ip="192.168.1.{}"; ping -c 1 -W 1 $ip >/dev/null 2>&1 && { nc -z -w 1 $ip 22 2>/dev/null && echo "$ip: Port 22 is open" || echo "$ip: Port 22 is closed"; }' | sort -n -t . -k 4,4
Last active
August 6, 2024 17:11
-
-
Save sainak/017fdb00c6b0f69bbd7125e96ef2adea to your computer and use it in GitHub Desktop.
bash oneliner to quicly scan lan for open ssh servers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment