如何通过 whois ARIN 获取 IP 范围?

网络工程 阿林
2021-07-14 23:46:17

我想知道如何使用命令行 whois 获取分配给特定组织的所有 IP 范围(即 NET 对象)。

例如,考虑这家公司:http://whois.arin.net/rest/org/HT-136 ...如果你点击链接“相关网络”,它会带给你HTTP://whois.arin。 net/rest/org/HT-136/nets显示分配给它的网络。

我发现很难弄清楚如何使用命令行 whois 获取相同的信息。

任何帮助将不胜感激!

1个回答
$ whois -a "o ! >  HT-136"

通过做man whois发现whois -a ?

  • -一个

    使用美国互联网号码注册 (ARIN) 数据库。它包含世界上那些既未被 APNIC、AfriNIC、LACNIC 也未被 RIPE 覆盖的地区使用的网络号码。

  • 按记录类型查询:o 组织

  • 按属性查询:!按句柄或 ID 搜索匹配项

  • >

    记录层次结构:显示层次结构中相关的记录。对于组织或客户,以列表格式显示注册到该组织或客户的资源。

结果是:

#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
# If you see inaccuracies in the results, please report at
# http://www.arin.net/public/whoisinaccuracy/index.xhtml
#


#
# The following results may also be obtained via:
# http://whois.arin.net/rest/orgs;handle=HT-136?showDetails=true&ext=netref2
#

OrgName:        HAProxy Technologies, Inc.
OrgId:          HT-136
Address:        1013 Centre Road, Suite 403S
City:           Wilmington
StateProv:      DE
PostalCode:     19805
Country:        US
RegDate:        2014-04-02
Updated:        2014-07-18
Ref:            http://whois.arin.net/rest/org/HT-136

TechHandle: SCARP14-ARIN
TechName:   Scarpa, John
TechPhone:  +1-857-366-5050
TechEmail:  john.scarpa@haproxy.com
TechRef:    http://whois.arin.net/rest/poc/SCARP14-ARIN

TechHandle: BRKIC2-ARIN
TechName:   Brkic, andrej
TechPhone:  +19547320642
TechEmail:  abrkic@haproxy.com
TechRef:    http://whois.arin.net/rest/poc/BRKIC2-ARIN

NOCHandle: NETWO6774-ARIN
NOCName:   Network Operations
NOCPhone:  +1-857-366-5050
NOCEmail:  noc@haproxy.com
NOCRef:    http://whois.arin.net/rest/poc/NETWO6774-ARIN

AdminHandle: SCARP14-ARIN
AdminName:   Scarpa, John
AdminPhone:  +1-857-366-5050
AdminEmail:  john.scarpa@haproxy.com
AdminRef:    http://whois.arin.net/rest/poc/SCARP14-ARIN

AbuseHandle: NETWO6775-ARIN
AbuseName:   Network Abuse
AbusePhone:  +1-857-366-5050
AbuseEmail:  abuse@haproxy.com
AbuseRef:    http://whois.arin.net/rest/poc/NETWO6775-ARIN
HAProxy Technologies, Inc. SCNET-205-234-170-0-1 (NET-205-234-170-0-1) 205.234.170.0 - 205.234.170.255
HAProxy Technologies, Inc. SCNET-205-234-181-0-1 (NET-205-234-181-0-1) 205.234.181.0 - 205.234.181.255
HAProxy Technologies, Inc. SCNET-205-234-165-0-1 (NET-205-234-165-0-1) 205.234.165.0 - 205.234.165.255
HAProxy Technologies, Inc. SCNET-205-234-166-0-1 (NET-205-234-166-0-2) 205.234.166.0 - 205.234.166.255
HAProxy Technologies, Inc. HAPNET-1 (NET-104-152-112-0-1) 104.152.112.0 - 104.152.119.255
HAProxy Technologies, Inc. (AS11019) HAPROXY-TECHNOLOGIES 11019



#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
# If you see inaccuracies in the results, please report at
# http://www.arin.net/public/whoisinaccuracy/index.xhtml
#

作为替代答案,在我看来,通过 RWHOIS 使用 CURL 或任何 REST 客户端更容易解析。

curl http://whois.arin.net/rest/org/HT-136/nets

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='http://whois.arin.net/xsl/website.xsl' ?>
<nets xmlns="http://www.arin.net/whoisrws/core/v1" xmlns:ns2="http://www.arin.net/whoisrws/rdns/v1" xmlns:ns3="http://www.arin.net/whoisrws/netref/v2" termsOfUse="https://www.arin.net/whois_tou.html" inaccuracyReportUrl="http://www.arin.net/public/whoisinaccuracy/index.xhtml">
   <limitExceeded limit="256">false</limitExceeded>
   <netRef startAddress="205.234.170.0" endAddress="205.234.170.255" name="SCNET-205-234-170-0-1" handle="NET-205-234-170-0-1">http://whois.arin.net/rest/net/NET-205-234-170-0-1</netRef>
   <netRef startAddress="205.234.181.0" endAddress="205.234.181.255" name="SCNET-205-234-181-0-1" handle="NET-205-234-181-0-1">http://whois.arin.net/rest/net/NET-205-234-181-0-1</netRef>
   <netRef startAddress="205.234.165.0" endAddress="205.234.165.255" name="SCNET-205-234-165-0-1" handle="NET-205-234-165-0-1">http://whois.arin.net/rest/net/NET-205-234-165-0-1</netRef>
   <netRef startAddress="205.234.166.0" endAddress="205.234.166.255" name="SCNET-205-234-166-0-1" handle="NET-205-234-166-0-2">http://whois.arin.net/rest/net/NET-205-234-166-0-2</netRef>
   <netRef startAddress="104.152.112.0" endAddress="104.152.119.255" name="HAPNET-1" handle="NET-104-152-112-0-1">http://whois.arin.net/rest/net/NET-104-152-112-0-1</netRef>
</nets>