Created
August 19, 2014 06:29
-
-
Save sennajox/fbd5eb0263d0c08e35ba to your computer and use it in GitHub Desktop.
Scan port with nmap, use 11211(memcached) and 6379(redis) as example
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 [ $# -lt 1 ];then | |
echo "usage:$0 iplist" | |
exit 1 | |
fi | |
iplist=$1 | |
i=0 | |
while read line | |
do | |
if [ -z "$line" ];then | |
continue; | |
fi | |
echo $line | |
# each line is a single ip | |
#nmap -Pn -sT -p23-65535 $line | grep 'open' | |
nmap -Pn -sT -p11211,6379 $line | grep 'open' | |
let i+=1 | |
# sleep seconds to control the rate | |
k=$(($i%20)) | |
if [ $k -eq 0 ];then | |
echo "" | |
echo "sleep..." | |
sleep 3 | |
fi | |
done < "$iplist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nmap -Pn -sT -p11211,6379 -iL iplist.file