Professional Web Applications Themes

Net-Whois-IP-0.35 returning incorrect responses? - PERL Miscellaneous

I'm trying to write a Perl script which will (among other things) look up the Whois information, based on an IP address it encounters, but the responses I'm getting from Net-Whois-IP-0.35 are not what I'm expecting, (though I suppose they're technically correct). Please consider the following test case: cat -n src/whois_test.pl 1 #!/local/pkg/perl/root-perl-5.8.0/bin/perl -wT 2 # 3 # For looking up Whois info: 4 use Net::Whois::IP qw(whoisip_query); 5 6 my $whois_response = whoisip_query("132.205.7.51", "true"); 7 foreach (keys(%{$whois_response}) ) { 8 print "$_:"; 9 foreach ( {$whois_response->{$_}} ) { 10 print " $_\n"; 11 } 12 } 13 Now I run ...

  1. #1

    Default Net-Whois-IP-0.35 returning incorrect responses?

    I'm trying to write a Perl script which will (among other things) look
    up the Whois information, based on an IP address it encounters, but the
    responses I'm getting from Net-Whois-IP-0.35 are not what I'm expecting,
    (though I suppose they're technically correct).

    Please consider the following test case:

    cat -n src/whois_test.pl
    1 #!/local/pkg/perl/root-perl-5.8.0/bin/perl -wT
    2 #
    3 # For looking up Whois info:
    4 use Net::Whois::IP qw(whoisip_query);
    5
    6 my $whois_response = whoisip_query("132.205.7.51", "true");
    7 foreach (keys(%{$whois_response}) ) {
    8 print "$_:";
    9 foreach ( {$whois_response->{$_}} ) {
    10 print " $_\n";
    11 }
    12 }
    13

    Now I run the test program:
    src/whois_test.pl
    OrgID: VR-ARIN
    NetName: NET132
    PostalCode: 20151
    NetType: Early Registrations, Maintained by ARIN
    NetHandle: NET-132-0-0-0-0
    Address: 3635 Concord Parkway, Suite 200
    RegDate: 1993-05-01
    Comment:
    City: Chantilly
    CIDR: 132.0.0.0/8
    StateProv: VA
    Updated: 2002-08-23
    Parent:
    OrgName: Various Registries (Maintained by ARIN)
    Country: US
    NameServer: ARROWROOT.ARIN.NET
    BUCHU.ARIN.NET
    CHIA.ARIN.NET
    DILL.ARIN.NET
    EPAZOTE.ARIN.NET
    FIGWORT.ARIN.NET
    GINSENG.ARIN.NET
    HENNA.ARIN.NET
    INDIGO.ARIN.NET
    NetRange: 132.0.0.0 - 132.255.255.255

    However, if I run whois (whois-4.5.29) at the command line, to look up
    the same IP address, I get the following response (which is what I
    expect to see):

    whois 132.205.7.51

    OrgName: Concordia University
    OrgID: CONCOR-15
    Address: 1455 de Maisonneuve ouest
    City: Montreal
    StateProv: QC
    PostalCode: H3G 1M8
    Country: CA

    NetRange: 132.205.0.0 - 132.205.255.255
    CIDR: 132.205.0.0/16
    NetName: CONCORDIA
    NetHandle: NET-132-205-0-0-1
    Parent: NET-132-0-0-0-0
    NetType: Direct Assignment
    NameServer: CLYDE.CONCORDIA.CA
    NameServer: ALCOR.CONCORDIA.CA
    NameServer: ZAURAK.CC.UMANITOBA.CA
    NameServer: NS4.SRV.CIS.PITT.EDU
    Comment:
    RegDate: 1989-06-14
    Updated: 2003-03-04

    AbuseHandle: ABUSE217-ARIN
    AbuseName: Abuse
    AbusePhone: +1-514-848-7600
    AbuseEmail: [email]abuseconcordia.ca[/email]

    # ARIN WHOIS database, last updated 2003-08-05 19:15
    # Enter ? for additional hints on searching ARIN's WHOIS database.

    Does anyone know how to get Net::Whois::IP to send back the response I'm
    expecting, or should I simply call my command-line whois from the script
    I'm writing? (it would of course be much cleaner to use a Perl module
    for this ...)

    --
    ----------------------------------------------------------------------
    Sylvain Robitaille [email]sylalcor.concordia.ca[/email]

    Systems yst Concordia University
    Instructional & Information Technology Montreal, Quebec, Canada
    ----------------------------------------------------------------------
    Sylvain Robitaille Guest

  2. #2

    Default Re: Net-Whois-IP-0.35 returning incorrect responses?

    In article <slrnbj2sal.4o7v.sylalcor.concordia.ca>,
    Sylvain Robitaille <sylalcor.concordia.ca> writes:
    >I'm trying to write a Perl script which will (among other things) look
    >up the Whois information, based on an IP address it encounters, but the
    >responses I'm getting from Net-Whois-IP-0.35 are not what I'm expecting,
    >(though I suppose they're technically correct).
    >
    >Please consider the following test case:
    [snip program; can be replaced by
    perl -MData::Dumper -MNet::Whois::IP=whoisip_query \
    -e 'print Dumper whoisip_query("132.205.7.51")'
    ]
    >Now I run the test program:
    >src/whois_test.pl
    [snip result for NET-132-0-0-0-0]
    >However, if I run whois (whois-4.5.29) at the command line, to look up
    >the same IP address, I get the following response (which is what I
    >expect to see):
    [snip result for NET-132-205-0-0-1]

    First let me thank you for posing a perfectly formed question; all the
    information needed (most of which I cut out :-) and a clear question.

    I ran this under the debugger and found that the problem is a bug in
    Net::Whois::IP. It thinks that if the result does not include a
    TechPhone or an OrgTechPhone attribute then it should try a whois
    query for the parent handle. This is at odds with its doentation
    which says it keeps going until it gets an OrgName or CustName. I
    have submitted a bug report. (The NET-132-0-0-0-0 result doesn't
    have a *TechPhone attribute either, but its Parent is blank, so the
    module gives up there.)
    >Does anyone know how to get Net::Whois::IP to send back the response I'm
    >expecting, or should I simply call my command-line whois from the script
    >I'm writing? (it would of course be much cleaner to use a Perl module
    >for this ...)
    Unless and until the module is improved, you'll need to make a copy of
    it to go somewhere earlier in your INC and modify it. I suggest you
    look for the line

    }elsif(/Parent:\s+(\S+)/) {

    and on the next (long) line, change TechPhone to NetName and change
    OrgTechPhone to OrgName.

    --
    Peter Scott
    [url]http://www.perldebugged.com[/url]
    Peter Scott Guest

  3. #3

    Default Re: Net-Whois-IP-0.35 returning incorrect responses?

    Peter Scott wrote:
    > [snip program; can be replaced by
    > perl -MData::Dumper -MNet::Whois::IP=whoisip_query \
    > -e 'print Dumper whoisip_query("132.205.7.51")'
    > ]
    Yikes! I'm pretty fond of creating one-liners myself, but it just goes
    to show that I still have *lots* to learn!
    > First let me thank you for posing a perfectly formed question; all the
    > information needed (most of which I cut out :-) and a clear question.
    Well, thank you, and J. Gleixner, for taking the time to read it and to
    propose a solution. In fact, thanks to anyone who's read my original
    post, even if a solution didn't come to mind...

    (thanks especially to Peter, for taking the extra time to debug the
    Net-Whois-IP module, submit a bug report, and propose a solution that
    will likely work -- I'll give it a try and report back if I still have
    problems.)
    > I ran this under the debugger and found that the problem is a bug in
    > Net::Whois::IP. It thinks that if the result does not include a
    > TechPhone or an OrgTechPhone attribute then it should try a whois
    > query for the parent handle.
    Bingo! I should have thought to trace it myself!
    > This is at odds with its doentation which says it keeps going until
    > it gets an OrgName or CustName.
    Right. I would have expected to stop on those as well.

    Perhaps I need to have our Whois info modified to include a Tech phone
    number, though (it would be the same as the listed AbusePhone number
    anyway...)
    > I have submitted a bug report.
    Wow! Thank you, both for fing the problem, and for going the extra
    distance to submit the bug-report.
    > Unless and until the module is improved, you'll need to make a copy of
    > it to go somewhere earlier in your INC and modify it.
    Or, I can just patch and re-install the module itself, but the idea is
    the same ...
    > I suggest you look for the line
    >
    > }elsif(/Parent:\s+(\S+)/) {
    >
    > and on the next (long) line, change TechPhone to NetName and change
    > OrgTechPhone to OrgName.
    Will do. Thanks a whole bunch!

    --
    ----------------------------------------------------------------------
    Sylvain Robitaille [email]sylalcor.concordia.ca[/email]

    Systems yst Concordia University
    Instructional & Information Technology Montreal, Quebec, Canada
    ----------------------------------------------------------------------
    Sylvain Robitaille Guest

  4. #4

    Default Re: Net-Whois-IP-0.35 returning incorrect responses?

    J. Gleixner wrote:
    > Try Net::Whois::Raw
    Thanks. I appreciate the response. If I can't get Peter Scott's solution
    to work, I'll give that a try.

    --
    ----------------------------------------------------------------------
    Sylvain Robitaille [email]sylalcor.concordia.ca[/email]

    Systems yst Concordia University
    Instructional & Information Technology Montreal, Quebec, Canada
    ----------------------------------------------------------------------
    Sylvain Robitaille Guest

Similar Threads

  1. Whois ASP look up
    By skinner in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: May 19th, 09:35 PM
  2. #39921 [NEW]: pspell_check returning incorrect results
    By dansoftaus at yahoo dot com dot au in forum PHP Bugs
    Replies: 2
    Last Post: December 21st, 03:16 PM
  3. WHOIS expiry date ...
    By elyob in forum PHP Development
    Replies: 5
    Last Post: December 3rd, 07:59 AM
  4. store whois requests
    By Is in forum PHP Development
    Replies: 1
    Last Post: September 16th, 10:58 PM
  5. Select Intermittently Returning Incorrect Number of Rows
    By Karsten Farrell in forum Oracle Server
    Replies: 0
    Last Post: January 13th, 06:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139