[AusNOG] Viewing RBL's on entire /24
Ross Wheeler
ausnog at rossw.net
Wed Oct 16 10:46:37 EST 2013
> Gday Guys
>
> I was wondering if anybody might be able to recommend a way for me to do
> a RBL lookup on an entire /24 rather then looking up each IP separately
>
> Looking forward to your response.
FUGLY and SLOW... one-line PoC:
$ echo "103.18.207.0" | awk -F. '{for(ip=1; ip<255; ip++) { q=sprintf("dig
+short %d.%d.%d.%d.zen.spamhaus.org A",ip,$3,$2,$1); q|getline; close(q)}
if($NF>0) print "BAD"; else print "CLEAN"}'
CLEAN
$ echo "200.50.3.0" | awk -F. '{for(ip=1; ip<255; ip++) { q=sprintf("dig
+short %d.%d.%d.%d.zen.spamhaus.org A",ip,$3,$2,$1); q|getline; close(q)}
if($NF>0) print "BAD"; else print "CLEAN"}'
BAD
More information about the AusNOG
mailing list