【发布时间】:2016-03-09 13:24:36
【问题描述】:
我正在尝试查找与 URL 关联的所有 IP。我一直在使用“socket”包,但对不同功能返回的不同数量的 IP 感到困惑。例如见下文。有没有返回所有IP的功能?
socket.gethostbyname('google.com')
#returns 1 ip
socket.gethostbyname_ex('google.com')
#returns 6 ips
socket.getaddrinfo('google.com', 80)
#returns 12 ips
有没有返回所有IP的函数?
【问题讨论】:
-
您需要查看 DNS 库而不是套接字库。类似dnspython.org
标签: python