2
0

blacklist.pl 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/perl
  2. #
  3. # Add this to acl.conf.xml
  4. #
  5. # <X-PRE-PROCESS cmd="exec" data="$${base_dir}/bin/blacklist.pl"/>
  6. #
  7. use Data::Dumper;
  8. use LWP::Simple;
  9. # http://www.infiltrated.net/voipabuse/addresses.txt
  10. # http://www.infiltrated.net/voipabuse/netblocks.txt
  11. my @addresses = split(/\n/, get("http://www.infiltrated.net/voipabuse/addresses.txt"));
  12. my @netblocks = split(/\n/, get("http://www.infiltrated.net/voipabuse/netblocks.txt"));
  13. print "<list name=\"voip-abuse-addresses\" default=\"deny\">\n";
  14. foreach $addr (@addresses) {
  15. $addr =~ s/\s//g; # strip whitespace
  16. next unless $addr =~ m/\d+\.\d+\.\d+\.\d+/; # imperfect but useful IP addr check
  17. print " <node type=\"allow\" cidr=\"$addr/32\"/>\n";
  18. }
  19. print "</list>\n";
  20. print "<list name=\"voip-abuse-netblocks\" default=\"deny\">\n";
  21. foreach $netb (@netblocks) {
  22. $netb =~ s/\s//g; # strip whitespace
  23. next unless $netb =~ m/\d+\.\d+\.\d+\.\d+/; # imperfect but useful IP addr check
  24. print " <node type=\"allow\" cidr=\"$netb\"/>\n";
  25. }
  26. print "</list>\n";