]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Strip whitespace from IP addresses in blacklist
authorMichael S Collins <msc@freeswitch.org>
Fri, 19 Nov 2010 19:42:15 +0000 (11:42 -0800)
committerMichael S Collins <msc@freeswitch.org>
Fri, 19 Nov 2010 19:42:15 +0000 (11:42 -0800)
scripts/perl/blacklist.pl

index 92fa55efe2ade10318717f2e10285d5ad710397d..a2834b62bf1db3bb5e7a16968b59f056b390304b 100755 (executable)
@@ -17,7 +17,8 @@ my @netblocks = split(/\n/, get("http://www.infiltrated.net/voipabuse/netblocks.
 
 print "<list name=\"voip-abuse-addresses\" default=\"deny\">\n";
 foreach $addr (@addresses) {
-    next unless $addr =~ m/\d+\.\d+\.\d+\.\d+/;
+    $addr =~ s/\s//g;                            # strip whitespace
+    next unless $addr =~ m/\d+\.\d+\.\d+\.\d+/;  # imperfect but useful IP addr check 
     print "  <node type=\"allow\" cidr=\"$addr/32\"/>\n";
 }
 print "</list>\n";
@@ -25,7 +26,8 @@ print "</list>\n";
 
 print "<list name=\"voip-abuse-netblocks\" default=\"deny\">\n";
 foreach $netb (@netblocks) {
-    next unless $netb =~ m/\d+\.\d+\.\d+\.\d+/;
+    $netb =~ s/\s//g;                            # strip whitespace
+    next unless $netb =~ m/\d+\.\d+\.\d+\.\d+/;  # imperfect but useful IP addr check
     print "  <node type=\"allow\" cidr=\"$netb\"/>\n";
 }
 print "</list>\n";