diff options
author | James Meyer <james.meyer@operamail.com> | 2010-10-23 18:17:40 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2010-10-23 18:19:39 (GMT) |
commit | adbcf19958300e9b6598990184c8815b945ba0ee (patch) | |
tree | f4283c850ac0ac202c17e78a637ee7ca8147621b /abs/core-testing/tweaker/bin/LocalIPCheck.pl | |
parent | 61a68250df10d29b624650948484898334ff22d0 (diff) | |
download | linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.zip linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.gz linhes_pkgbuild-adbcf19958300e9b6598990184c8815b945ba0ee.tar.bz2 |
Removed old core and extra from repo. Renamed -testing to core/extra. This will setup the base for the testing branch.
Diffstat (limited to 'abs/core-testing/tweaker/bin/LocalIPCheck.pl')
-rwxr-xr-x | abs/core-testing/tweaker/bin/LocalIPCheck.pl | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/abs/core-testing/tweaker/bin/LocalIPCheck.pl b/abs/core-testing/tweaker/bin/LocalIPCheck.pl deleted file mode 100755 index b744fb6..0000000 --- a/abs/core-testing/tweaker/bin/LocalIPCheck.pl +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl - -# Valid private IP ranges - -my @LOCAL_IP_RANGES = ("10.0.0.0", "10.255.255.255", - "172.16.0.0", "172.31.255.255", - "192.168.0.0", "192.168.255.255"); - -# input: A dotted quad IP address. - -# output: 0 if a public (internet) address -# : 8 if a class A private (LAN) address -# : 12 if a class B private (LAN) address -# : 16 if a class C private (LAN) address - -sub get_IP_number () { - my ($dotted_quad) = @_; - my $IP_number=0; - - split(/\./, $dotted_quad); - - for (my $i=0; $i < 4; $i++) { - $IP_number=$IP_number+@_[3-$i]*(2**(8*$i)); - } - return $IP_number; -} - -while(<>) { - chop; - my $IPnumber=&get_IP_number($_); - my $class=16; - - while (@LOCAL_IP_RANGES) { - my $highIPnumber = &get_IP_number(pop(@LOCAL_IP_RANGES)); - my $lowIPnumber = &get_IP_number(pop(@LOCAL_IP_RANGES)); - - if (($lowIPnumber <= $IPnumber) && ($highIPnumber >= $IPnumber)) { - exit($class); # PRIVATE IP - } else { - $class += 4; - } - } -} - -exit(0); # PUBLIC IP - - |