Remember though that domain resolution is only as good as the domain system - Some IP addresses may not have been set up with PTR records back to fully-qualified domain names.

Indeed. Most of the odd hits in my server logs can't be backtraced to valid domain names, though there is often enough information available to find out what "neighborhood" they're in (e.g., who an IP addr's provider is).

To dig up what info I could on suspect IP addresses, I whipped up the following script, which front-ends dig(1) on FreeBSD.

#!/usr/bin/perl -w # # simple frontend for dig(1) # use strict; my $tracing = 1; sub usage { print <<EOM; usage: $0 ipaddr EOM exit(1); } my $ipaddr = shift @ARGV || usage(); my @ipaddr = split(/\./ , $ipaddr); # work our way through the parts of the ip address, stopping # when we're down to 1. do { dig_on(@ipaddr); pop @ipaddr; } until ( @ipaddr == 1 ); sub dig_on { my @addr = @_; my $subaddr = join('.', @addr); my $revaddr = join('.', reverse @ipaddr); print "going after $subaddr ...\n" if $tracing; open(IN, "dig -x $subaddr | grep $revaddr | ") or die "open(): $!"; while ( <IN> ) { next if /^;/; print; } close(IN); }
Suggestions on how to improve this are welcome.


In reply to Re: Re: Domain name from ip. by dws
in thread Domain name from ip. by blax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.