Created
October 14, 2020 14:47
-
-
Save marc-hanheide/0777c0d97d7795949d7edf14a8d5844c to your computer and use it in GitHub Desktop.
Revisions
-
marc-hanheide created this gist
Oct 14, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ #!/bin/bash SUBNET="10.5.42.0/24 # compare the output to your ~/.ssh/known_hosts list for ip in `nmap -p 22 --open -oG - $SUBNET | grep '22/open' | cut -f2 -d" " `; do key="`ssh-keyscan -H -t rsa $ip 2>&1| grep -v '^# '`"; if [ "$key" ]; then echo "$ip $key"; fi ; done