【问题标题】:Get IP provider with Python [closed]使用 Python 获取 IP 提供程序 [关闭]
【发布时间】:2022-01-25 14:32:33
【问题描述】:

我如何使用 Python 代码判断特定 IP (ipv4) 是否属于亚马逊、阿里巴巴或 AWS?

以 AWS 为例,如果 IP 有数百万。

我没有找到任何简单的方法来做到这一点。

【问题讨论】:

  • 尝试反向 dns 查找。

标签: python python-3.x ip amazon ipv4


【解决方案1】:

这是我所知道的最简单的方法:

from bs4 import BeautifulSoup
import requests


def check(ip):
    get_ip_info = requests.post(f'https://who.is/whois-ip/ip-address/{ip}').content
    soup = BeautifulSoup(get_ip_info, 'html.parser')
    result = soup.findAll('pre')
    print(result)
    
    
check("IP address what you want to check as string")

您将获得一个对象,其中将包含有关组织名称的数据,如屏幕截图所示:

【讨论】:

    猜你喜欢
    • 2012-10-27
    • 2020-01-30
    • 1970-01-01
    • 1970-01-01
    • 2021-01-19
    • 2023-03-28
    • 2011-01-07
    • 2021-02-24
    • 1970-01-01
    相关资源
    最近更新 更多