挖洞过程中收集了站点后,我一般习惯查看站点的百度权重值,为了方便,写了一个简单的脚本,
至于结果如何显示,看个人需求吧,我这里只是简单的列一下,脚本如下:
#coding:utf-8
import re
import sys
import urllib2
import linecache
url="https://www.aizhan.com/cha/%s/"
headers={"user-agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"}
try:
file=sys.argv[1]
for line in linecache.getlines(file):
line1=line.replace('https://','')
lines=line1.replace('http://','').split('/')[0]
#print lines
urls= url % lines
req=urllib2.Request(urls,headers=headers)
resp=urllib2.urlopen(req,timeout=5).read()
#print resp
regex=re.compile(r'/br/.+\.png').findall(resp)
#print regex
br=regex[0].strip('/br/').strip('.png')
#print br
print lines+'的百度权重为: '+br
with open('data.txt','a') as fw:
fw.write(lines+' 的百度权重为: '+br+'\n')
except Exception,e:
print e
执行结果截图: