Bizarre decimal number to in-addr-arpa mapping......
Farid Hamjavar
hamjavar at unm.edu
Wed Jun 2 18:37:40 UTC 1999
On Wed, 2 Jun 1999, Farid Hamjavar wrote:
> Date: Wed, 2 Jun 1999 12:33:35 -0600
> From: Farid Hamjavar <hamjavar at unm.edu>
> To: Michael Fenton <mfenton at fentonnet.com>
> Cc: comp-protocols-dns-bind at moderators.uu.net,
Ruth Anne Ladue <Ruth_Anne_Ladue at iengines.net>, bind-users at isc.org
> Newsgroups: comp.protocols.dns.bind
> Subject: Re: Bizarre decimal number to in-addr-arpa mapping......
>
> On Wed, 2 Jun 1999, Michael Fenton wrote:
>
> > Date: Wed, 02 Jun 1999 11:33:33 -0500
> > From: Michael Fenton <mfenton at fentonnet.com>
> > To: comp-protocols-dns-bind at moderators.uu.net
> > Newsgroups: comp.protocols.dns.bind
> > Subject: Bizarre decimal number to in-addr-arpa mapping......
> > Resent-Date: Wed, 2 Jun 1999 11:06:42 -0700 (PDT)
> > Resent-From: Ruth Anne Ladue <Ruth_Anne_Ladue at iengines.net>
> > Resent-To: bind-users at isc.org
> >
> > I discovered that people on my network are getting around
> > our web filtering by using decimal number URL's.
> > Check this out:
> > gunk:~$ nslookup 3489040081
> > Server: server.tt.net
> > Address: 209.98.124.2
> >
> > Name: teen-space.com
> > Address: 207.246.134.209
> >
> > How the hell does 3489040081 resolve?
> > I did a little looking and it seems to map somehow
> > to an inaddr-arpa address......
> >
> > Anybody know what's going on here?
> >
> > Thanks,
> > Michael Fenton
> >
>
>
I forgot the script ....
----8<--------------------------CUT------------------------------->8----
#!/usr/local/gnu/bin/perl
#################################################
#created by hamjavar: Fri Feb 5 12:43:59 MST 1999
#
# This script converts dotted format IP addresses
# into their decimal integer representation.
#
# For example these should all function the same:
# http://www.sgi.com/
# http://3626020507/
# http://216.32.174.155/
#
#
#
#
#################################################
use Socket;
#
$[=1;
$all_digit=0;
$dotted=0;
#
#
#################################################
#Decide which way to go:
if ($ARGV[0] =~ /^[0-9]+$/)
{
$input0 = $ARGV[0];
$all_digit=1;
print "#Input is all digits: \"$input0\"\n";
}
elsif ($ARGV[0] =~ /^[0-9]+.*[0-9]+$/)
{
$input0 = $ARGV[0];
$dotted=1;
print "#Input is in dotted notation: \"$input0\"\n";
}
else
{
print "Examples:\n";
$scrloc=`basename $0`;
chop $scrloc;
print "$scrloc 3488253803 \n";
print "$scrloc 207.234.135.107 \n";
exit 1;
}
#################################################
#
#
#
#Process according to format of input:
#
if ($all_digit == 1 )
{
$packed_addy = pack('N', $input0);
$answer = inet_ntoa($packed_addy);
print "#Answer in dotted form: $answer \n";
}
#
#
#
#
elsif ($dotted == 1)
{
@octet_array = split(/\./,$input0);
#
$num_octet=0;
foreach $octet (@octet_array) {$num_octet++;}
#
#print "$num_octet \n";
$octet_index=1;
$this_power=$num_octet;
$sum = 0;
while ($octet_index <= $num_octet)
{
$this_octet = @octet_array[$octet_index] ;
$this_power--;
$x = 256 ** $this_power ;
$y = $this_octet * $x ;
$sum = $sum + $y;
print "#OctetIndex[$octet_index] is $this_octet and $this_octet x $x = $y \n";
$octet_index++;
}
print "#\n#Answer is in decimal $sum \n";
$hexvalue = sprintf("%lx", $sum) ;
print "#Answer is in hex is $hexvalue \n"
}
#
#
#
#
else
{
;
}
#
#
#
#
#
#
#
#
#
#
More information about the bind-users
mailing list