Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPV6 Lookup Fails #130

Open
Takeda0x64 opened this issue Oct 10, 2024 · 2 comments · May be fixed by #131
Open

IPV6 Lookup Fails #130

Takeda0x64 opened this issue Oct 10, 2024 · 2 comments · May be fixed by #131

Comments

@Takeda0x64
Copy link

Takeda0x64 commented Oct 10, 2024

Explanation

When performing a WHOIS lookup using the whois.lookup() function on an IPv6 address (e.g., 2001:4860:4860::8888), the response is returning No match found. However, when executing the same lookup using the WHOIS command in the CLI, the correct information is displayed, such as the net range, organization details, and relevant WHOIS data.

Expected Behavior: The node-whois module should return complete and accurate WHOIS information for IPv6 addresses, similar to what is received via the CLI.

Actual Behavior: The module returns incomplete or incorrect results when querying IPv6 addresses

Steps to Reproduce:

1- Call the method wiht Ipv6 input (e.g., 2001:4860:4860::8888) :

whois.lookup("2001:4860:4860::8888", (err,data) =>{
    console.log(data);
})    

The output is :



#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2024, American Registry for Internet Numbers, Ltd.
#


No match found for n + .


#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2024, American Registry for Internet Numbers, Ltd.
#

Perform the same lookup using the whois CLI:

whois 2001:4860:4860::8888

CLI response :

#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2024, American Registry for Internet Numbers, Ltd.
#


NetRange:       2001:4860:: - 2001:4860:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF
CIDR:           2001:4860::/32
NetName:        GOOGLE-IPV6
NetHandle:      NET6-2001-4860-1
Parent:         ARIN-004 (NET6-2001-4800-0)
NetType:        Direct Allocation
OriginAS:       AS15169
Organization:   Google LLC (GOGL)
RegDate:        2005-03-14
Updated:        2012-02-24
Ref:            https://rdap.arin.net/registry/ip/2001:4860::



OrgName:        Google LLC
OrgId:          GOGL
Address:        1600 Amphitheatre Parkway
City:           Mountain View
StateProv:      CA
PostalCode:     94043
Country:        US
RegDate:        2000-03-30
Updated:        2019-10-31
Comment:        Please note that the recommended way to file abuse complaints are located in the following links. 
Comment:        
Comment:        To report abuse and illegal activity: https://www.google.com/contact/
Comment:        
Comment:        For legal requests: http://support.google.com/legal 
Comment:        
Comment:        Regards, 
Comment:        The Google Team
Ref:            https://rdap.arin.net/registry/entity/GOGL


OrgAbuseHandle: ABUSE5250-ARIN
OrgAbuseName:   Abuse
OrgAbusePhone:  +1-650-253-0000 
OrgAbuseEmail:  [email protected]
OrgAbuseRef:    https://rdap.arin.net/registry/entity/ABUSE5250-ARIN

OrgTechHandle: ZG39-ARIN
OrgTechName:   Google LLC
OrgTechPhone:  +1-650-253-0000 
OrgTechEmail:  [email protected]
OrgTechRef:    https://rdap.arin.net/registry/entity/ZG39-ARIN

RNOCHandle: ZG39-ARIN
RNOCName:   Google LLC
RNOCPhone:  +1-650-253-0000 
RNOCEmail:  [email protected]
RNOCRef:    https://rdap.arin.net/registry/entity/ZG39-ARIN

RTechHandle: ZG39-ARIN
RTechName:   Google LLC
RTechPhone:  +1-650-253-0000 
RTechEmail:  [email protected]
RTechRef:    https://rdap.arin.net/registry/entity/ZG39-ARIN

RAbuseHandle: ZG39-ARIN
RAbuseName:   Google LLC
RAbusePhone:  +1-650-253-0000 
RAbuseEmail:  [email protected]
RAbuseRef:    https://rdap.arin.net/registry/entity/ZG39-ARIN


#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/resources/registry/whois/tou/
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/registry/whois/inaccuracy_reporting/
#
# Copyright 1997-2024, American Registry for Internet Numbers, Ltd.


@Takeda0x64 Takeda0x64 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2024
@Takeda0x64 Takeda0x64 reopened this Oct 13, 2024
@Takeda0x64
Copy link
Author

I created a patch to resolve the bug, and now everything works as expected. The issue was in the domainToASCII function, which returns an empty string when passed an IPv6 address.

if server.punycode isnt false and options.punycode isnt false
       idn = url.domainToASCII(addr)
if options.encoding
       socket.setEncoding options.encoding
       socket.write server.query.replace '$addr', idn

The patch sets both server.punycode and options.punycode to false, ensuring that they do not pass the condition check so domainToASCII will not be invoked if IPv4 or IPv6 is passed :

when net.isIP(addr) isnt 0
   server = @SERVERS['_']['ip']
   server.punycode = false
   options.punycode = false

@Takeda0x64 Takeda0x64 linked a pull request Oct 13, 2024 that will close this issue
@Takeda0x64
Copy link
Author

Also IPV6 test passes

 ✔ should work with google.com
 ✔ should work with 50.116.8.109
 ✔ should work with 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d
 ✔ should honor specified WHOIS server
 ✔ should honor specified WHOIS server with port override

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant