Skip to content

Instantly share code, notes, and snippets.

@sennajox
Created August 19, 2014 06:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sennajox/fbd5eb0263d0c08e35ba to your computer and use it in GitHub Desktop.
Save sennajox/fbd5eb0263d0c08e35ba to your computer and use it in GitHub Desktop.
Scan port with nmap, use 11211(memcached) and 6379(redis) as example
#!/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"
@cloudrkt
Copy link

nmap -Pn -sT -p11211,6379 -iL iplist.file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment