首頁  >  文章  >  後端開發  >  Python基於whois模組簡單識別網站網域及所有者的方法

Python基於whois模組簡單識別網站網域及所有者的方法

不言
不言原創
2018-04-23 13:38:033388瀏覽

這篇文章主要介紹了Python基於whois模組簡單識別網站域名及所​​有者的方法,簡單分析了Python whois模組的安裝及使用相關操作技巧,需要的朋友可以參考下

本文實例講述了Python基於whois模組簡單識別網站域名及所​​有者的方法。分享給大家供大家參考,具體如下:

對於某些網站,我們可能會關心其所有者是誰。為了找到網站的擁有者,我們可以使用WHOIS協議查詢網域的註冊者是誰。 Python中有一個對該協定的封裝庫。我們可以透過pip進行安裝。

pip install python-whois

補充:本機安裝了Python2與Python3兩個版本,這裡就使用了pip2安裝python-whois模組,如下圖所示:

本機Python3環境下適用pip3安裝python-whois模組如下圖所示:

#導入模組import 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']}
>>>

補充:Python2運行結果截圖如下:

#Python3環境下運作效果如下:

#相關建議:

##php whois查詢API製作方法

whois PHP實作網域whois查詢的程式碼資料來源萬網、新網

##

以上是Python基於whois模組簡單識別網站網域及所有者的方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn