Skip to content

Instantly share code, notes, and snippets.

@hplc
Created April 1, 2017 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hplc/fb74cb442ed4f2c159a68a279049be64 to your computer and use it in GitHub Desktop.
Save hplc/fb74cb442ed4f2c159a68a279049be64 to your computer and use it in GitHub Desktop.
Bash pipe TCP port scanner.
#!/bin/sh
# Worked in CentOS 7.
for ip in 10.1.41.106 10.1.41.158 10.1.41.149 10.1.41.104 10.1.41.145 10.1.41.122 10.1.41.113 10.1.41.223 10.1.41.200; do
timeout 1 bash -c "echo >/dev/tcp/${ip}/22" &&
echo "$ip SSH is OPEN" ||
echo "$ip SSH is $(tput setaf 1)CLOSED$(tput sgr0)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment