一、JS加密
1.有的反爬蟲策略采用js對需要傳輸的資料進行加密處理,
2.經過加密,傳輸的就是密文
3.加密函式或者程序一定是在瀏覽器完成,也就是一定會把代碼(js代碼)暴露給使用者
4.通多閱讀加密演算法,就可以模擬出加密程序,從而達到破解,
5.舉一個案例
""" 破解有道詞典 """ from urllib import request,parse ? def youdao(key): url = "http://www.fanyi,com/translate_o?smartresult=dict&smartresult=rule" data = { "i":"girl", "from":"AUTO", "to":"AUTO", "smartresult":"dict", "client":"fanyideskweb", "salt":"1523100789519", "sign":"b8a55a436686cd89873fa46514ccedbe", "doctype":"json", "version":"2.1", "keyfrom":"fanyi.web", "action":"FY_BY_REALTIME", "typeResult":"False" } ? data = parse.urlencode(data).encode() headers = { "Connection": "keep - alive", "Content - Encoding":"gzip", "Content - Language": "zh - CN", "Content - Type": "text / html", "charset":"utf - 8", "Date": "Mon, 17 Feb 2020 15: 23:36 GMT", "Server":"nginx", "Transfer - Encoding": "chunked", "Vary": "Accept - Encoding" } req = request.Request(url=url,data=https://www.cnblogs.com/ruigege0000/p/data,headers=headers) ? rsp = request.urlopen(req) ? html = rsp.read().decode() print(html) ? if __name__ == "__main__": # for i in range(10000): # print(sum) youdao(45)
二、原始碼
Reptitle8_1_JSEncryption.py
https://github.com/ruigege66/PythonReptile/blob/master/Reptitle8_1_JSEncryption.py
2.CSDN:https://blog.csdn.net/weixin_44630050
3.博客園:https://www.cnblogs.com/ruigege0000/
4.歡迎關注微信公眾號:傅里葉變換,個人公眾號,僅用于學習交流,后臺回復”禮包“,獲取大資料學習資料

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/193617.html
標籤:Python
下一篇:Docker之兩小時入門
