Created
January 1, 2023 16:54
-
-
Save afreisinger/8db7a768173253ca56e091c80eda1f28 to your computer and use it in GitHub Desktop.
nmap in infinite loop
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 characters
#!/bin/bash | |
if [[ -z $1 ]]; | |
then | |
echo "No parameter passed." | |
else | |
echo "Parameter passed = $1" | |
ip=$1 | |
#nmap ${ip} -PN -p ssh | grep open | |
#If you're interested in the actual state of the ssh-port, you can substitute grep open with egrep 'open|closed|filtered' | |
res=$(nmap ${ip} -PN -p ssh | egrep 'open|closed|filtered') | |
while true | |
do | |
echo $res | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment