South African Subnets in CIDR notation

fixx

Well-Known Member
Joined
Feb 13, 2006
Messages
278
Hey guys

I am looking for an up to date list of all South African IP blocks (having it in CIDR notation would be much appreciated) in a text format.

A while (probably 6 years) ago there was Linux shell script doing the rounds that pulled them off one of Internet Solutions' public routers. Even if that script is still available somewhere I would appreciate that too.

Thanks in advance.
 

Anthro

Expert Member
Joined
Jun 13, 2006
Messages
3,560
Code:
#!/bin/bash

###COMMA SEPARATED LIST OF COUNTRY CODE###
COUNTRIES="ZA"
WORKDIR="/home/someuser"
#######################################
  
cd $WORKDIR
wget -c --output-document=iptables-blocklist.txt http://iplocationtools.com/country_query.php?country=$COUNTRIES

if [ -f iptables-blocklist.txt ]; then
   iptables -F
   BLOCKDB="iptables-blocklist.txt"
   IPS=$(grep -Ev "^#" $BLOCKDB)
   for i in $IPS
   do
      iptables -A INPUT -s $i -j DROP
      iptables -A OUTPUT -d $i -j DROP
   done
fi

rm -f $WORKDIR/iptables-blocklist.txt


or additionally
http://www.ipdeny.com/ipblocks/data/aggregated/za-aggregated.zone
 
Last edited:
Top