python爬蟲 - js逆向解密之簡單端口加密破解v2 -- 修復版


前言

這篇跟上一篇很像,而且他的端口顯示也很類似,是的,它也是一個國外的代理網站

分析

打開網站查看:

 

 

 

發現它的的端口和之前的網站一樣,不是直接顯示的,那么用SmallProxy這個關鍵詞搜索下在哪,很快就找到了下面這個:

 

 

 

 

關鍵點

 

代碼:

<script type="text/javascript">
//<![CDATA[
  Xinemara = 2051;BigBlind = Xinemara^42776;DexterProxy = Xinemara^19605;BigGoodProxy = 26194^DexterProxy;Defender = 18662^BigGoodProxy;SmallProxy = 32206^BigGoodProxy;SmallBlind = 24500^Defender;Agile = Defender^BigGoodProxy;ProxyMoxy = 31100^Agile;BigProxy = 35563^SmallProxy;DontGrubMe = BigProxy^BigProxy;NineBeforeZero = 40710^14588;Xorg = SmallProxy^57660;Socks = 61653^27735;HttpSocks = BigBlind^DexterProxy;GrubMe = 1176^45424;Polymorth = 23590^54130; //]]> </script>

 

代碼實現

 

好的,廢話不多說了,主要用了exec和eval,直接給代碼了,因為之前一篇文章分析過了,就不再詳細說了

 

import requests
from lxml import etree from lxml.html import tostring from bs4 import BeautifulSoup, Comment HEADERS = { 'sec-ch-ua': '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"', 'sec-ch-ua-mobile': '?0', 'sec-fetch-dest': 'document', 'sec-fetch-mode': 'navigate', 'sec-fetch-site': 'cross-site', 'sec-fetch-user': '?1', 'upgrade-insecure-requests': '1', 'Connection': 'close', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36' } url = '' # 保密  req = requests.get(url, headers=HEADERS) res = req.content.decode('utf-8') html = etree.HTML(res) end = [] data = html.xpath('//table[@class="proxytbl"]/tr[position()>1]') key = html.xpath('//noscript/preceding-sibling::script[1]/text()') key = ''.join(key).replace('//<![CDATA[','').replace('//]]>','').strip() if key else '' exec(key.strip()) for item in data: ip = item.xpath('./td[1]/text()') ip = ''.join(ip) if ip else '' port_temp = item.xpath('./td[2]/script/text()') port_temp = ''.join(port_temp) if port_temp else '' port_temp = port_temp.replace('document.write(', '').replace(');', '').replace('//<![CDATA[','').replace('//]]>','').strip() port = eval(port_temp) print(12313213,ip,port) # if ip and port: # proxy = ip + ":" + port # end.append(proxy) print(12312, len(end), end)

 

網址就保密了哈,想要的私信我

 

結語

 

這個也挺簡單的哈,還是那句都不叫加密。我覺得凡是還是多分析吧,別看到什么js就怕了,可以多看看,就算搞不定,也要看看能走到哪里,然后去惡補這方面的知識,下次遇到也就可以搞定了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM