Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

geoff (2013)

geoff
  reversethis-{gro ... om} {ta} {ffoeg}
http://www.modperlcookbook.org/

see http://www.modperlcookbook.org/~geoff/ [modperlcookbook.org] for personal information, links to presentations, GPG key, and so on.

Journal of geoff (2013)

Friday November 08, 2002
02:05 PM

from the archives

[ #8847 ]
here's something I found today in my home directory from a very long time ago...

#!/usr/bin/perl

use strict;

use Math::BigInt;

my $binstring = join '', map { sprintf "%08b", $_ } split /\./, $ARGV[0];
my $decstring = Math::BigInt->new(0);

my $exp = length($binstring);

foreach my $i (1 .. $exp) {
  $decstring += substr($binstring, $i-1, 1) * (2 ** ($exp - $i));
}

(my $result = `nslookup $decstring`) =~ m/Name: *(.*)/;
print "http://$decstring would bring you to $1\n";


I think I got the idea from a LISP program in 2600 but it was so long ago that I can't remember. I do remember that, based on this program, one of my friends wrote a visual C app that accepted a normal URL and opened a browser to the translated URL. it didn't work with name-based vhosting, but was an interesting excercise anyway...
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.