Skip to content

Instantly share code, notes, and snippets.

@barce
Created April 4, 2010 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barce/355185 to your computer and use it in GitHub Desktop.
Save barce/355185 to your computer and use it in GitHub Desktop.
sub isPrivate {
my $ip = shift;
my @a_ip = split /\./, $ip;
my $i_secret = 0;
if ($a_ip[0] == 10)
{
$i_secret = 1;
}
if ( ($a_ip[0] == 172) && ($a_ip[1] >= 16) && ($a_ip[1] <= 31) )
{
$i_secret = 1;
}
if ( ($a_ip[0] == 192) && ($a_ip[1] == 168) )
{
$i_secret = 1;
}
return $i_secret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment