Home > Backend Development > PHP Tutorial > Python's method to simply identify website domain name and owner based on whois module

Python's method to simply identify website domain name and owner based on whois module

不言
Release: 2023-03-24 17:22:02
Original
3526 people have browsed it

This article mainly introduces Python's method of simply identifying website domain names and owners based on the whois module, and briefly analyzes the installation and use of Python whois module related operating techniques. Friends in need can refer to this article

The example describes how Python can simply identify the website domain name and owner based on the whois module. Share it with everyone for your reference, the details are as follows:

For some websites, we may care who their owners are. In order to find the owner of the website, we can use the WHOIS protocol to query who the registrant of the domain name is. There is a wrapper library for this protocol in Python. We can install it through pip.

pip install python-whois
Copy after login

Supplement: This machine has two versions of Python2 and Python3 installed. Here, pip2 is used to install the python-whois module, as follows As shown in the picture:

The native Python3 environment is suitable for pip3 installation python-whois The module is shown in the following picture:

Import moduleimport whois

>>> import whois
>>> whois.whois('https://www.cgtz.com/')
{u'updated_date': datetime.datetime(2018, 3, 26, 7, 37, 52), u'status': [u'clientTransferProhibited https://icann.org/epp#clientTransferProhibited', u'clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited'], u'name': u'Nexperian Holding Limited', u'dnssec': u'unsigned', u'city': u'Hangzhou', u'expiration_date': datetime.datetime(2025, 7, 12, 18, 24, 22), u'zipcode': u'311121', u'domain_name': [u'CGTZ.COM', u'cgtz.com'], u'country': u'CN', u'whois_server': u'grs-whois.hichina.com', u'state': u'Zhejiang', u'registrar': u'HiChina Zhicheng Technology Ltd.', u'referral_url': None, u'address': u'Le Jia International No.999 Liang Mu Road Yuhang District', u'name_servers': [u'VIP1.ALIDNS.COM', u'VIP2.ALIDNS.COM'], u'org': u'Nexperian Holding Limited', u'creation_date': datetime.datetime(2008, 7, 12, 18, 24, 22), u'emails': [u'DomainAbuse@service.aliyun.com', u'YuMing@YinSiBaoHu.AliYun.com']}
>>>
Copy after login

Supplement: The screenshot of the Python2 running result is as follows:

The running effect in Python3 environment is as follows:

Related recommendations:

php whois query API production method

whois PHP implements domain name whois query code data source Wanwang, Xinwang

##

The above is the detailed content of Python's method to simply identify website domain name and owner based on whois module. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template