Skip to content

Instantly share code, notes, and snippets.

@smhr
Created September 6, 2020 11:23
Show Gist options
  • Save smhr/5796879699fe055339fe4bfa6690fd79 to your computer and use it in GitHub Desktop.
Save smhr/5796879699fe055339fe4bfa6690fd79 to your computer and use it in GitHub Desktop.
find all available ssh in a network
#!/bin/bash
LOGFILE="has_ssh.txt"
for i in {0..225}
do
IP_ADDRESS="172.21.99."$i
echo $IP_ADDRESS
ssh-keyscan $IP_ADDRESS | grep -v "^$" &> /dev/null > /dev/null
[ $? == 0 ] && echo $IP_ADDRESS "has ssh" >> $LOGFILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment