簡體   English   中英

whois命令和whois REST API給出IP地址的不同結果

[英]whois command and whois REST API giving different results for IP address

在筆記本電腦上運行whois 74.93.16.177會返回我信息,並告訴我IP屬於Comcast。

但是,調用Whois REST API會告訴我該IP不由RIPE管理。 通過在在線公共RIPE鏡像上進行搜索,我還可以獲得與本地whois查詢相同的結果。

參見: https : //rest.db.ripe.net/search.json?query-string=74.93.16.177

這使

  "attribute" : [ {
    "name" : "inetnum",
    "value" : "74.0.0.0 - 74.255.255.255"
  }, {
    "name" : "netname",
    "value" : "NON-RIPE-NCC-MANAGED-ADDRESS-BLOCK"
  }, {
    "name" : "descr",
    "value" : "IPv4 address block not managed by the RIPE NCC"
  }, {
    "name" : "remarks",
    "value" : "------------------------------------------------------"
  }, {

而在命令行上, whois 74.93.16.177給出了

NetRange:       74.93.16.0 - 74.93.19.255
CIDR:           74.93.16.0/22
NetName:        CBC-CONNECTICUT-7
NetHandle:      NET-74-93-16-0-1
Parent:         CBC-CM-4 (NET-74-92-0-0-1)
NetType:        Reallocated
OriginAS:       
Organization:   Comcast Cable Communications, LLC (CCCS)
RegDate:        2007-11-13
Updated:        2017-11-01
Ref:            https://whois.arin.net/rest/net/NET-74-93-16-0-1



OrgName:        Comcast Cable Communications, LLC
OrgId:          CCCS
Address:        1800 Bishops Gate Blvd
City:           Mt Laurel
StateProv:      NJ
PostalCode:     08054
Country:        US
RegDate:        2001-09-17
Updated:        2017-01-28
Ref:            https://whois.arin.net/rest/org/CCCS

我如何對REST API進行正確的調用,以獲取與命令行相同的響應(除了JSON)?

在兩種情況下,您不會看到相同的“對象”。 在RIR上,IP對象不僅是IP地址,實際上是IP地址塊,因為RIR將地址塊分配給LIR。

如你看到的:

  • 在第一種情況下,結果約為74.0.0.0 - 74.255.255.255又名74.0.0.0/8
  • 在第二種情況下,大約是74.93.16.0 - 74.93.19.255 aka 74.93.16.0/22

第二個塊包含在第一個塊中,但是每個塊具有不同的所有者和元數據。

您可以在https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml中看到2005年74.0.0.0/8已分配給ARIN。因此,您需要查詢ARIN服務要獲得有關此塊(及其內部塊)的信息,這就是為什么RIPE在第一個答復中告訴您“未由RIPE NCC管理的IPv4地址塊”的原因。

您在此處擁有ARIN文檔: https : //www.arin.net/resources/whoisrws/whois_api.html

因此,在您的情況下,您需要使用http://whois.arin.net/rest/ip/74.93.16.177.json ,其結果為:

{
"net": {
"@xmlns": {
  "ns3": "http://www.arin.net/whoisrws/netref/v2",
  "ns2": "http://www.arin.net/whoisrws/rdns/v1",
  "$": "http://www.arin.net/whoisrws/core/v1"
},
"@inaccuracyReportUrl": "https://www.arin.net/public/whoisinaccuracy/index.xhtml",
"@termsOfUse": "https://www.arin.net/whois_tou.html",
"registrationDate": {
  "$": "2007-11-19T17:26:42-05:00"
},
"ref": {
  "$": "https://whois.arin.net/rest/net/NET-74-93-16-176-1"
},
"customerRef": {
  "@handle": "C01782735",
  "@name": "HOYLE TANNER AND ASSOC",
  "$": "https://whois.arin.net/rest/customer/C01782735"
},
"endAddress": {
  "$": "74.93.16.183"
},
"handle": {
  "$": "NET-74-93-16-176-1"
},
"name": {
  "$": "HOYLETANNERANDASSOC"
},
etc.

請注意,結果是74.93.16.176/29的結果甚至比74.93.16.176/22更具體

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM