frithnanth / Raku-Net-Whois

An interface to the WHOIS protocol
Artistic License 2.0
0 stars 1 forks source link

Multi value support #3

Closed Zer0-Tolerance closed 11 months ago

Zer0-Tolerance commented 11 months ago

Hi, thanks for your quick fix, I've discovered a new one :

[0] > use Net::Whois
Nil
[1] > my Net::Whois $w .= new;
Net::Whois.new
[2] > $w.query: '185.87.179.52','whois.ripe.net';
{address => Germany, admin-c => AWEN1-RIPE, country => DE, created => 2023-09-13T06:34:34Z, descr => 48712 Gescher, inetnum => 185.87.179.52 - 185.87.179.59, last-modified => 2023-09-13T06:34:34Z, mnt-by => ITBS-TEC-MNT, netname => dv-customer-vrbank, nic-hdl => IA3817-RIPE, origin => AS200846, role => d.velop-noc, route => 185.87.179.0/24, source => RIPE, status => ASSIGNED PA, tech-c => SBEN1-RIPE}

as opposed to this output from the whois cmd , only the last value of descr is kept where it should be an array or a string concat of all values:

# whois.ripe.net

inetnum:        185.87.179.52 - 185.87.179.59
netname:        dv-customer-vrbank
country:        DE
descr:          VR-Bank Westm�nsterland eG
descr:          Am Campus 7
descr:          48712 Gescher
admin-c:        IA3817-RIPE
tech-c:         IA3817-RIPE
status:         ASSIGNED PA
mnt-by:         ITBS-DOMAIN-MNT
mnt-by:         ITBS-TEC-MNT
created:        2022-06-17T12:44:39Z
last-modified:  2022-06-17T12:44:39Z
source:         RIPE

role:           d.velop-noc
address:        Schildarpstrasse 6-8
address:        48712 Gescher
address:        Germany
admin-c:        AWEN1-RIPE
tech-c:         SOCH1-RIPE
tech-c:         SBEN1-RIPE
nic-hdl:        IA3817-RIPE
mnt-by:         ITBS-TEC-MNT
created:        2015-02-10T13:38:38Z
last-modified:  2015-05-07T13:55:49Z
source:         RIPE # Filtered

Hope this one will be also a quick fix.

frithnanth commented 11 months ago

Hello, the Net::Whois module doesn't pretend to be a full blown replacement for the whois command. The whois command does much more than that my module's simple interface does: when one uses that command line tool one doesn't provide a list of servers to query, it's that program that finds out the best server (just take a look at the whois man page to find out how clever it is). My module limits itself to query a single server. Any further logic should be added by the user as they might find convenient. I don't want to slow down the communication process trying to be too clever: sometimes one just wants to know where that particular IP one found in their logs comes from.

Zer0-Tolerance commented 11 months ago

this is not my point, my point was to handle a multi value field like descr and others to convert them to an array and not just keep the last value.

frithnanth commented 11 months ago

Then IIUC I think you missed the :multiple adverb of the .query method. Try modifying this call:

$w.query: '185.87.179.52','whois.ripe.net';

into this:

$w.query: '185.87.179.52','whois.ripe.net', :multiple;