Thursday, April 11, 2013

block china CIDR please!

for too many days i have been dealing with china as spammer as the get some info of our users so block this ip's have been annoying i have set up a persiste file with this guys but i have just found a web page with CIDR of china so i uploaded this on pf

pfctl -tdammed-hosts -Tadd ==myscrypt==

i use simple perl to get rid of all of the useless information as the file format it is:

#chinese net blocks CIDR
#send comments, corrections, and additions to:
#last updated 2013.03.27 0858 PST (UTC -8)  China  China  China  China

so with the scrypt i eliminate all but this goes to screen so i just used $(scrypt) to populate pf table

here is the web:

here is the scrypt:
dont blame me am not a programmer }:)

use strict;
use warnings;

open(myFH, $ARGV[0]);
foreach my $line (<myFH>){
 my @val = split(' ', $line);
 print "$val[0]\n";
of course no secury added to the scrypt as it is for my personal and for this situation but it works i have populated 2638 blocks for the pf table 

No comments:

Post a Comment