介紹下:
補天是國內知名的漏洞響應平台,旨在企業和白帽子共贏。
白帽子在這里提交廠商漏洞,獲得庫幣和榮譽,廠商從這里發布眾測、獲取漏洞報告和修復建議。
在2017年3月份之前,補天的廠商域名URL是非常好爬取的,即使沒有登陸到平台依然可以用輕松獲取到批量的廠商URL地址,然后白帽子用大型漏洞掃描工具進行批量漏掃。
后來,補天平台可能為了盡可能的保護廠商的URL被濫用,采取了一些措施。
這些措施限定了:
1). 必須登陸到平台
2). 點擊廠商名並進入提交漏洞頁面
3). 只在提交頁面顯示廠商URL域名
下面,就以一段Python 代碼來獲取最新的補天廠商URL,之后如何利用就隨讀者個人意願了。
介紹:
1. 先登陸補天平台,復制Cookie到代碼中的位置
2. 這里只演示爬取前三頁,每頁30個廠商
3. 使用正則提取URL
4. 爬取結果保存在腳本同級目錄的 'butian_company_url.txt' 文件,如果不夠90個URL,可能是有的廠商沒有填寫(即空)
import requests,re,json,time head = {'User-Agent': \ 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36'} cook = {"Cookie": "這里寫你登陸補天后的Cookie"} url = 'http://butian.360.cn/Reward/pub' for page in range(1,3): #前三頁 data = {'s': '1', 'p': page, 'token': ''} html = requests.post(url, headers = head, data=data, cookies = cook).content jsCont = json.loads(html.decode()) jsData = jsCont['data'] for i in jsData['list']: linkaddr = 'http://butian.360.cn/Loo/submit?cid=' + i['company_id'] print(linkaddr,end='\t') shtml = requests.get(linkaddr,headers = head, cookies = cook).content #正則模版<input class="input-xlarge" type="text" name="host" placeholder="請輸入廠商域名" value="www.grgtest.com" /> company_url = re.findall('<input class="input-xlarge" type="text" name="host" placeholder="請輸入廠商域名" value="(.*)" />',shtml.decode()) time.sleep(0.5) # 控制爬取速度 print(company_url[0]) com_url = company_url[0] with open('butian_company_url.txt','a+') as f: f.write(com_url + '\n')
運行結果: