域名转IP-py脚本
#coding:utf-8
#build by LandGrey
#2018-06-22
import socket
def URL2IP():
for oneurl in urllist.readlines():
url=str(oneurl.strip())[7:]
print (url)
try:
ip =socket.gethostbyname(url)
print (ip)
iplist.writelines(str(ip)+"\n")
except:
print ("this URL 2 IP ERROR ")
try:
urllist=open("D:\\urllist.txt","r")
iplist=open("D:\\iplist.txt","w")
URL2IP()
urllist.close()
iplist.close()
print ("complete !")
except:
print ("ERROR !")
评论