likexian / whois-parser

Whois parser for domain whois information parsing in Go(Golang).
Apache License 2.0
284 stars 86 forks source link

(bug-fix): properly parse co.jp domains #72

Closed mdn1023 closed 11 months ago

mdn1023 commented 11 months ago

Currently, the whois_parser produces the following response for google.com.jp:

❯ whois -h whois.jprs.jp google.jp/e | go run main.go | jq
{
  "domain": {
    "name": "google.co",
    "extension": "jp",
    "status": [
      "connected"
    ],
    "created_date": "2001/03/22",
    "updated_date": "2023/04/01 01:05:57 (JST)"
  }
}

There are a few missing fields from the response. With this change, co.jp domains will be parsed correctly:

{
  "domain": {
    "domain": "google.co.jp",
    "punycode": "google.co.jp",
    "name": "google.co",
    "extension": "jp",
    "status": [
      "connected"
    ],
    "name_servers": [
      "ns1.google.com",
      "ns2.google.com",
      "ns3.google.com",
      "ns4.google.com"
    ],
    "created_date": "2001/03/22",
    "updated_date": "2023/04/01 01:05:57 (JST)"
  },
  "administrative": {
    "name": "YN47525JP"
  },
  "technical": {
    "name": "SH36113JP"
  }
}
likexian commented 11 months ago

Hello @mdn1023 Thanks for your works!


If you think this repository is helpful, please share it with friends, thanks.

hodge1997 commented 11 months ago

Pls send a new release tag. Tks. @likexian

hodge1997 commented 11 months ago

@likexian Pls send a new release tag. Tks.

likexian commented 11 months ago

@hodge1997 please try the latest tag.


If you think this repository is helpful, please share it with friends, thanks.

hodge1997 commented 11 months ago

Hello, This PR change not working. Can you text your main.go? This is my code, and it's not working in ".jp".

func main() {
    result, err := whois.Whois("www.goo.ne.jp")
    if err != nil {
        fmt.Println(err)
    }
    results, err := whoisparser.Parse(result)
    fmt.Println(err, results)
}

@mdn1023 @likexian

likexian commented 11 months ago
result, err := whois.Whois("www.goo.ne.jp/e")

If you think this repository is helpful, please share it with friends, thanks.

hodge1997 commented 10 months ago
func main() {
    result, err := whois.Whois("www.goo.ne.jp/e")
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println("whois_result", result)
    parseResult, err := whoisparser.Parse(result)
    fmt.Println(err)
    fmt.Println("whoisparser_result", parseResult)
} 
whois_result 
[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]
[                                                                             ]
[ Notice -------------------------------------------------------------------- ]
[ JPRS will add the [Lock Status] element to the response format of JP domain ]
[ name on November 12, 2023.                                                  ]
[ For further information, please see the following webpage.                  ]
[ https://jprs.jp/whatsnew/notice/2023/231112.html (only in Japanese)         ]
[ --------------------------------------------------------------------------- ]
No match!!

With JPRS WHOIS, you can query the following domain name information
sponsored by JPRS.
    - All of registered JP domain name
    - gTLD domain name of which sponsoring registrar is JPRS
Detail: https://jprs.jp/about/dom-search/jprs-whois/ (only in Japanese)

For IP address information, please refer to the following WHOIS servers:
    - JPNIC WHOIS (whois.nic.ad.jp)
    - APNIC WHOIS (whois.apnic.net)
    - ARIN WHOIS (whois.arin.net)
    - RIPE WHOIS (whois.ripe.net)
    - LACNIC WHOIS (whois.lacnic.net)
    - AfriNIC WHOIS (whois.afrinic.net)

% Query time: 945 msec
% WHEN: Tue Dec 05 11:23:55 CST 2023

whoisparser_result
{<nil> <nil> <nil> <nil> <nil> <nil>}
whoisparser: 
domain is not found

Pls show me your code result. Tks. @likexian @mdn1023

davidpenn commented 9 months ago

www.goo.ne.jp is not a valid apex domain, but goo.ne.jp is and works with this change

whois -h whois.jprs.jp goo.ne.jp/e
[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]
[                                                                             ]
[ Notice -------------------------------------------------------------------- ]
[ JPRS will add the [Lock Status] element to the response format of JP domain ]
[ name on November 12, 2023.                                                  ]
[ For further information, please see the following webpage.                  ]
[ https://jprs.jp/whatsnew/notice/2023/231112.html (only in Japanese)         ]
[ --------------------------------------------------------------------------- ]
Domain Information:
a. [Domain Name]                GOO.NE.JP
d. [Network Service Name]       GOO
l. [Organization Type]          Network Service
m. [Administrative Contact]     MS57072JP
n. [Technical Contact]          TH53991JP
p. [Name Server]                ns1.goo.ne.jp
p. [Name Server]                ns2.goo.ne.jp
p. [Name Server]                ns.intervia.ad.jp
p. [Name Server]                ns.via.or.jp
s. [Signing Key]
[State]                         Connected (2024/06/30)
[Registered Date]               2004/06/15
[Connected Date]                2004/06/15
[Last Update]                   2023/07/31 12:30:39 (JST)

whois -h whois.jprs.jp www.goo.ne.jp/e
[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]
[                                                                             ]
[ Notice -------------------------------------------------------------------- ]
[ JPRS will add the [Lock Status] element to the response format of JP domain ]
[ name on November 12, 2023.                                                  ]
[ For further information, please see the following webpage.                  ]
[ https://jprs.jp/whatsnew/notice/2023/231112.html (only in Japanese)         ]
[ --------------------------------------------------------------------------- ]
No match!!

With JPRS WHOIS, you can query the following domain name information
sponsored by JPRS.
    - All of registered JP domain name
    - gTLD domain name of which sponsoring registrar is JPRS
Detail: https://jprs.jp/about/dom-search/jprs-whois/ (only in Japanese)

For IP address information, please refer to the following WHOIS servers:
    - JPNIC WHOIS (whois.nic.ad.jp)
    - APNIC WHOIS (whois.apnic.net)
    - ARIN WHOIS (whois.arin.net)
    - RIPE WHOIS (whois.ripe.net)
    - LACNIC WHOIS (whois.lacnic.net)
    - AfriNIC WHOIS (whois.afrinic.net)
❯ whois -h whois.jprs.jp goo.ne.jp/e | go run cmd/whois-parser/main.go | jq
{
  "domain": {
    "domain": "goo.ne.jp",
    "punycode": "goo.ne.jp",
    "name": "goo.ne",
    "extension": "jp",
    "status": [
      "connected"
    ],
    "name_servers": [
      "ns1.goo.ne.jp",
      "ns2.goo.ne.jp",
      "ns.intervia.ad.jp",
      "ns.via.or.jp"
    ],
    "created_date": "2004/06/15",
    "updated_date": "2023/07/31 12:30:39 (JST)"
  },
  "administrative": {
    "name": "MS57072JP"
  },
  "technical": {
    "name": "TH53991JP"
  }
}
hodge1997 commented 7 months ago

@davidpenn Got it. Thank you.