++++++++++++++++++++++
pls,input your domain like: http://111.com
#coding:utf8 #encoding=utf8 import requests import sys import re reload(sys) sys.setdefaultencoding( "utf-8" ) def getjs2(html): reg=r'src="(.*?)"' listre=re.compile(reg) mylist=re.findall(listre,html.strip()) return mylist def getdomain(url): reg=r'://(.*?)/' listre=re.compile(reg) mylist=re.findall(listre,url) #print mylist[0] return mylist headers={ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3', 'Content-Type': 'application/x-www-form-urlencoded', #'Referer': 'http://xlab.tencent.com/special/spectre/spectre_check.html', 'Upgrade-Insecure-Requests': '1', 'Cookie': 'pgv_pvid=4723488520' } if len(sys.argv)>1: url=sys.argv[1] str1=url.split('/')[-1:][0] url=url.replace(str1,'') try: #print str1 url2=sys.argv[1] html=requests.get(url2,headers=headers,timeout=5) #print 'target\'s stratus:'+str(html.status_code) html=html.text.replace("'",'"') #print html.encode("utf-8",'ignore') for i in getjs2(html): #print i if i.find(".js")>0: if i.find("http://")>=0 or i.find("https://")>=0 or i.find("//")>=0 : murl=i print murl elif i.find("/")==0: murl=url.split('/')[0]+'//'+getdomain(url)[0]+i print murl else: i=i.split(".js")[0] murl=url+'/'+i+'.js' murl=murl.replace('//','/') print murl except Exception as e: print e else: print 'pls,input your domain like: http://111.com'