Skip to content

Instantly share code, notes, and snippets.

@afreisinger
Created January 1, 2023 16:54
Show Gist options
  • Save afreisinger/8db7a768173253ca56e091c80eda1f28 to your computer and use it in GitHub Desktop.
Save afreisinger/8db7a768173253ca56e091c80eda1f28 to your computer and use it in GitHub Desktop.
nmap in infinite loop
#!/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