aboutsummaryrefslogtreecommitdiffstats
path: root/config/ipblocklist
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-09-24 11:57:54 -0400
committerjim-p <jimp@pfsense.org>2010-09-24 11:57:54 -0400
commita6ae250626448753ec25daa5b8bf84fdcc431871 (patch)
tree9cc55d9e615422874153c1ab10dd91ef89737a6c /config/ipblocklist
parent29e2a67d74b0db151ba2df6a17f98b192e987421 (diff)
downloadpfsense-packages-a6ae250626448753ec25daa5b8bf84fdcc431871.tar.gz
pfsense-packages-a6ae250626448753ec25daa5b8bf84fdcc431871.tar.bz2
pfsense-packages-a6ae250626448753ec25daa5b8bf84fdcc431871.zip
More DOS line endings fixes.
Diffstat (limited to 'config/ipblocklist')
-rwxr-xr-xconfig/ipblocklist/convert.pl134
1 files changed, 67 insertions, 67 deletions
diff --git a/config/ipblocklist/convert.pl b/config/ipblocklist/convert.pl
index 44b4add2..f3e9db12 100755
--- a/config/ipblocklist/convert.pl
+++ b/config/ipblocklist/convert.pl
@@ -1,67 +1,67 @@
-#!/usr/bin/perl -w
-use strict;
-
-if($#ARGV != 1) {
- print("Usage: $0 <input file> <output file>\n");
- exit(1);
-}
-
-my ($line,$title,$iprange,$cidr);
-my $i = 30000;
-
-open(INFILE,'<',$ARGV[0]) or die("Could not open input file $ARGV[0]");
-open(OUTFILE,'>>',$ARGV[1]) or die("Could not open output file $ARGV[1]");
-
-foreach $line (<INFILE>) {
- chomp($line);
- $line =~ s/:((\d{1,3}[-\.]*){8})//;
- $iprange = $1;
- print OUTFILE "#$line\n";
- foreach $cidr (split(/\n/,range($iprange))) {
- print OUTFILE "$cidr\n";
- #print OUTFILE "ipfw -q add 1000 drop ip from any to $cidr\n"; (version 0.1.4)
- #$i++;
- #print OUTFILE "ipfw -q add 1001 drop ip from $cidr to any\n"; (version 0.1.4)
- #$i++;
- }
-}
-
-close(INFILE);
-close(OUTFILE);
-
-sub ntoa {
- return join ".",unpack("CCCC",pack("N",shift));
-}
-sub aton {
- return unpack 'N', pack 'C4', split/\./, shift;
-}
-sub deaggregate {
- my $thirtytwobits = 4294967295;
- my $start = shift;
- my $end = shift;
- my $base = $start;
- my ($step,$output);
- while ($base <= $end) {
- $step = 0;
- while (($base | (1 << $step)) != $base) {
- if (($base | (((~0) & $thirtytwobits) >> (31-$step))) > $end) {
- last;
- }
- $step++;
- }
- if($step == 0) {
- $output .= ntoa($base);
- }else{
- $output .= ntoa($base)."/" .(32-$step);
- }
- $output .= "\n";
- $base += 1 << $step;
- }
- return $output;
-}
-sub range {
- my ($address,$address2) = split /-/, shift;
- $address = aton($address);
- $address2 = aton($address2);
- return deaggregate($address,$address2);
-} \ No newline at end of file
+#!/usr/bin/perl -w
+use strict;
+
+if($#ARGV != 1) {
+ print("Usage: $0 <input file> <output file>\n");
+ exit(1);
+}
+
+my ($line,$title,$iprange,$cidr);
+my $i = 30000;
+
+open(INFILE,'<',$ARGV[0]) or die("Could not open input file $ARGV[0]");
+open(OUTFILE,'>>',$ARGV[1]) or die("Could not open output file $ARGV[1]");
+
+foreach $line (<INFILE>) {
+ chomp($line);
+ $line =~ s/:((\d{1,3}[-\.]*){8})//;
+ $iprange = $1;
+ print OUTFILE "#$line\n";
+ foreach $cidr (split(/\n/,range($iprange))) {
+ print OUTFILE "$cidr\n";
+ #print OUTFILE "ipfw -q add 1000 drop ip from any to $cidr\n"; (version 0.1.4)
+ #$i++;
+ #print OUTFILE "ipfw -q add 1001 drop ip from $cidr to any\n"; (version 0.1.4)
+ #$i++;
+ }
+}
+
+close(INFILE);
+close(OUTFILE);
+
+sub ntoa {
+ return join ".",unpack("CCCC",pack("N",shift));
+}
+sub aton {
+ return unpack 'N', pack 'C4', split/\./, shift;
+}
+sub deaggregate {
+ my $thirtytwobits = 4294967295;
+ my $start = shift;
+ my $end = shift;
+ my $base = $start;
+ my ($step,$output);
+ while ($base <= $end) {
+ $step = 0;
+ while (($base | (1 << $step)) != $base) {
+ if (($base | (((~0) & $thirtytwobits) >> (31-$step))) > $end) {
+ last;
+ }
+ $step++;
+ }
+ if($step == 0) {
+ $output .= ntoa($base);
+ }else{
+ $output .= ntoa($base)."/" .(32-$step);
+ }
+ $output .= "\n";
+ $base += 1 << $step;
+ }
+ return $output;
+}
+sub range {
+ my ($address,$address2) = split /-/, shift;
+ $address = aton($address);
+ $address2 = aton($address2);
+ return deaggregate($address,$address2);
+}