├── bulk-whois.sh └── README /bulk-whois.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # usage 4 | if [ $# -ne 1 ] ; then 5 | echo "" 6 | echo 'Usage: bulk-whois.sh ' 7 | echo 'Example: bulk-whois.sh infile' 8 | echo 'Output will be in infile.whois' 9 | echo "" 10 | exit 11 | fi 12 | 13 | # varable 14 | INFILE=$1 15 | 16 | # check for netcat 17 | if [ -n "$NETCAT" ] ; then 18 | alias NETCAT="$NETCAT" 19 | elif which netcat &> /dev/null ; then 20 | alias NETCAT='netcat' 21 | else 22 | echo 'You need netcat to run this!' 23 | fi 24 | 25 | # format the input file 26 | sed -e '1ibegin' -e '1icountrycode' $INFILE > $INFILE.f 27 | echo 'end' >> $INFILE.f 28 | 29 | # query cymru whois 30 | `netcat whois.cymru.com 43 < $INFILE.f > $INFILE.whois` 31 | 32 | # clean up files 33 | rm $INFILE.f 34 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | A shell script that uses Team Cymru's (http://www.team-cymru.org/) bulk whois service. The input file should be a list of IP addresses, one per line. The whois query results will be in a newly created file - infile.whois. 2 | 3 | Dependencies: 4 | 5 | netcat (http://netcat.sourceforge.net/) 6 | 7 | Usage: 8 | 9 | $ ./bulk-whois.sh infile 10 | 11 | Example: 12 | 13 | $ ./bulk-whois.sh infile 14 | $ more infile.whois 15 | Bulk mode; whois.cymru.com [2012-01-08 13:59:44 +0000] 16 | 8048 | 200.84.77.12 | VE | CANTV Servicios, Venezuela 17 | 9070 | 84.21.222.91 | BG | ITD ITD Network Bulgarian ISP 18 | 9121 | 78.189.61.194 | TR | TTNET Turk Telekomunikasyon Anonim Sirketi 19 | 8737 | 86.89.38.108 | NL | PT KPN Internet Solutions 20 | 16232 | 2.198.11.17 | IT | ASN-TIM TIM (Telecom Italia Mobile) 21 | 7738 | 201.79.227.111 | BR | Telecomunicacoes da Bahia S.A. 22 | 17676 | 126.117.42.10 | JP | GIGAINFRA Softbank BB Corp. 23 | 26599 | 189.96.231.205 | BR | Telesp Celular S.A. 24 | --------------------------------------------------------------------------------