├── README.md
├── account_xiaomi_com
└── xiaomi_login.py
├── d_weidian_com
├── get_encrypted_ua.js
├── uad.js
├── uad_reduction.js
└── weidian_login.py
├── dict_cnki_net
├── cnki.py
└── cnki_encrypt.js
├── epay_163_com
└── epay.js
├── etherrock_ne
├── airdrop_submit.py
└── get_content_and_key.js
├── fanyi_baidu_com
├── baidufanyi.py
└── baidufanyi_encrypt.js
├── fanyi_youdao_com
├── youdao_encrypt.js
└── youdaofanyi.py
├── fuwu_nhsa_gov_cn
├── nhsa.js
└── nhsa.py
├── ggzy_jcs_gov_cn
├── ggzy.py
└── ggzy_js.js
├── icp_chinaz_com
└── README.md
├── jzsc_mohurd_gov_cn
├── jzsc_mohurd.py
└── jzsc_mohurd_decrypt.js
├── learn_open_com_cn
├── fm_new.js
├── fm_old.js
├── get_black_box.js
├── open_login.py
└── replace_js.py
├── m_wcbchina_com
├── wcbchina_encrypt.js
└── wcbchina_login.py
├── max_pedata_cn
├── main.py
└── pedata_decrypt.js
├── mps_gov_cn
├── jsl.js
└── jsl.py
├── oauth_d_cn
├── d_cn_encrypt.js
└── d_cn_login.py
├── passport_fang_com
├── fang_encrypt.js
└── fang_login.py
├── passport_zhihuishu_com
├── code.png
└── zhihuishu_login.py
├── spider_wangluozhecom_challenge_1
├── challenge_1.js
└── challenge_1.py
├── spider_wangluozhecom_challenge_2
├── challenge_2.js
└── challenge_2.py
├── spider_wangluozhecom_challenge_3
├── challenge_3.js
└── challenge_3.py
├── spider_wangluozhecom_challenge_4
├── challenge_4.js
└── challenge_4.py
├── spider_wangluozhecom_challenge_6
├── challenge_6.js
└── challenge_6.py
├── store_steampowered_com
├── steampowered_encrypt.js
└── steampowered_login.py
├── tenhou_net
├── tenhou.py
└── tenhou_decrypt.js
├── uncrackable_level1
├── frida-hook.js
└── frida-hook.py
├── web_ewt360_com
├── ewt360_encrypt.js
└── ewt360_login.py
├── weibo_com
├── weibo_encrypt.js
└── weibo_login.py
├── www_15yunmall_com
├── 15yunmall_encrypt.js
└── 15yunmall_login.py
├── www_37_com
├── 37_encrypt.js
└── 37_login.py
├── www_airasia_com
└── flightstatus.py
├── www_appmiu_com
└── appmiu.js
├── www_gm99_com
├── code.png
├── gm99_encrypt.js
├── gm99_encrypt_2.js
└── gm99_login.py
├── www_hnzwfw_gov_cn
├── encrypt.js
└── hnzww_login.py
├── www_kuwo_cn
├── get_reqId.js
├── get_reqId_2.js
├── get_reqId_3.js
└── kuwo_search.py
├── www_lagou_com
├── lagou.js
└── main.py
├── www_xinshangmeng_com
├── xinshangmeng_encrypt.js
└── xinshangmeng_login.py
├── xueqiu_com
├── get_acw_sc_v2.js
└── main.py
├── yrx_2
├── yrx2.js
└── yrx2.py
├── yrx_5
├── yrx5.js
└── yrx5.py
└── zwfw_san-he_gov_cn
├── zwfw_san_he.py
└── zwfw_san_he_encrypt.js
/README.md:
--------------------------------------------------------------------------------
1 |
K 哥爬虫代码分享
2 |
3 |
23 |
24 |
25 |

26 |
27 |
28 |
29 | ❗❗❗ **声明:本仓库中所有内容仅供学习交流使用,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关,在本仓库中下载的文件学习完毕之后请于 24 小时内删除!若有侵权,请联系我立即删除!**
30 |
31 | > ⭐ [ K 哥爬虫 bilibili 视频,小助理手把手带你学逆向,欢迎点击本链接观看哦 ~](https://space.bilibili.com/1622879192/?spm_id_from=333.999.0.0)
32 | >
33 | > 🔗[【IPWO全球住宅代理】免费住宅代理测试,90M+海外纯净IP-高效爬虫-无限并发-高匿稳定~](https://www.ipwo.net/?ref=kgpc)
34 |
35 | ---
36 |
37 | | K 哥爬虫逆向专栏文章 | 代码 |
38 | | :----- | :----- |
39 | | [【爬虫知识】浏览器开发者工具使用技巧总结](https://mp.weixin.qq.com/s/vR0ZPCAJMUF992chUfBNSQ) | \ |
40 | | [【爬虫知识】爬虫常见加密解密算法](https://mp.weixin.qq.com/s/4QTee0M9ukN6olgoR_LMug) | \ |
41 | | [【JS 逆向百例】百度翻译接口参数逆向](https://mp.weixin.qq.com/s/li_UBzEUvLmaL207eFhyvw) | [fanyi_baidu_com](https://github.com/kgepachong/crawler/tree/master/fanyi_baidu_com) |
42 | | [【JS 逆向百例】有道翻译接口参数逆向](https://mp.weixin.qq.com/s/p9oFqVQhHn4tlpqonAdNSQ) | [fanyi_youdao_com](https://github.com/kgepachong/crawler/tree/master/fanyi_youdao_com) |
43 | | [【JS 逆向百例】建筑市场监管平台企业数据](https://mp.weixin.qq.com/s/QmWy0zhsE0ZwEJwrfCohTA) | [jzsc_mohurd_gov_cn](https://github.com/kgepachong/crawler/tree/master/jzsc_mohurd_gov_cn) |
44 | | [【JS 逆向百例】当乐网登录接口参数逆向](https://mp.weixin.qq.com/s/1eXvxbZklEtwrkUn4iEmtQ) | [oauth_d_cn](https://github.com/kgepachong/crawler/tree/master/oauth_d_cn) |
45 | | [【JS 逆向百例】房天下登录接口参数逆向](https://mp.weixin.qq.com/s/yQMlvddLHi_lSQAuK05HyA) | [passport_fang_com](https://github.com/kgepachong/crawler/tree/main/passport_fang_com) |
46 | | [【JS 逆向百例】某7网游登录接口参数逆向](https://mp.weixin.qq.com/s/OrDOGRECm-k7f_thL6NO1A) | [www_37_com](https://github.com/kgepachong/crawler/tree/main/www_37_com) |
47 | | [【JS 逆向百例】层层嵌套!某加速商城 RSA 加密](https://mp.weixin.qq.com/s/tvzh0tIs1N_R3Ycj8r5SMg) | [www_15yunmall_com](https://github.com/kgepachong/crawler/tree/main/www_15yunmall_com) |
48 | | [【JS 逆向百例】转变思路,少走弯路,X米加密分析](https://mp.weixin.qq.com/s/gBOTxUiq1RgOaZtdR6XRSA) | [account_xiaomi_com](https://github.com/kgepachong/crawler/tree/main/account_xiaomi_com) |
49 | | [【JS 逆向百例】元素ID定位加密位置,某麻将数据逆向](https://mp.weixin.qq.com/s/KWJLN3O2qTwqjj3ZrVo2fA) | [tenhou_net](https://github.com/kgepachong/crawler/tree/main/tenhou_net) |
50 | | [【JS 逆向百例】复杂的登录过程,最新微博逆向](https://mp.weixin.qq.com/s/iwOMzACFk90PHTdH8FoA4g) | [weibo_com](https://github.com/kgepachong/crawler/tree/main/weibo_com) |
51 | | [【JS 逆向百例】无限debugger绕过,某网站互动数据逆向](https://mp.weixin.qq.com/s/iktAAarSwGXNXgNFpeAQlA) | [zwfw_san-he_gov_cn](https://github.com/kgepachong/crawler/tree/main/zwfw_san-he_gov_cn) |
52 | | [【JS 逆向百例】DOM事件断点调试,某商盟登录逆向](https://mp.weixin.qq.com/s/E4pzttU9DvPpCYrAydZ1Rg) | [www_xinshangmeng_com](https://github.com/kgepachong/crawler/tree/main/www_xinshangmeng_com) |
53 | | [【JS 逆向百例】XHR 断点调试,Steam 登录逆向](https://mp.weixin.qq.com/s/DPNtkF9e1pvFVa1m-DsyJw) | [store_steampowered_com](https://github.com/kgepachong/crawler/tree/main/store_steampowered_com) |
54 | | [【JS 逆向百例】如何跟栈调试?某 e 网通 AES 加密分析](https://mp.weixin.qq.com/s/Vj-7P99H6fK5LDUgrktCuw) | [web_ewt360_com](https://github.com/kgepachong/crawler/tree/main/web_ewt360_com) |
55 | | [JS 逆向之 Hook,吃着火锅唱着歌,突然就被麻匪劫了!](https://mp.weixin.qq.com/s/IYFyjVrVkHtUdCzn9arkJQ) | \ |
56 | | [【JS 逆向百例】Fiddler 插件 Hook 实战,某创帮登录逆向](https://mp.weixin.qq.com/s/H4oQvqZmWS4af1VF1nAzkA) | [m_wcbchina_com](https://github.com/kgepachong/crawler/tree/main/m_wcbchina_com) |
57 | | [【JS 逆向百例】浏览器插件 Hook 实战,亚航加密参数分析](https://mp.weixin.qq.com/s/MaDrCJdJCQKSnXWgCR0c0w) | [www_airasia_com](https://github.com/kgepachong/crawler/tree/main/www_airasia_com) |
58 | | [爬虫逆向基础,理解 JavaScript 模块化编程 webpack](https://mp.weixin.qq.com/s/_-9Ib6H51rWGK60X_g2n1g) | \ |
59 | | [当爬虫工程师遇到CTF丨B站1024安全攻防题解](https://mp.weixin.qq.com/s/SKrlslSLwE8FFXdQyTprUg) | \ |
60 | | [【JS 逆向百例】webpack 改写实战,G 某游戏 RSA 加密](https://mp.weixin.qq.com/s/LCnpt37NjiTtBYToqNdQaA) | [www_gm99_com](https://github.com/kgepachong/crawler/tree/main/www_gm99_com) |
61 | | [【JS逆向百例】某音乐网分离式 webpack 非 IIFE 改写实战](https://mp.weixin.qq.com/s/3PgJTsb3moYES0_UJ9Lwkw) | [www_kuwo_cn](https://github.com/kgepachong/crawler/tree/main/www_kuwo_cn) |
62 | | [爬虫逆向基础,认识 SM1-SM9、ZUC 国密算法](https://mp.weixin.qq.com/s/IsoXn_jZI6YdqC7uXVDYiQ) | \ |
63 | | [【JS 逆向百例】医保局 SM2+SM4 国产加密算法实战](https://mp.weixin.qq.com/s/hs0Mz-2GmyOMAdWB22fG5w) | [fuwu_nhsa_gov_cn](https://github.com/kgepachong/crawler/tree/main/fuwu_nhsa_gov_cn) |
64 | | [【JS 逆向百例】某易支付密码 MD5+AES 加密分析](https://mp.weixin.qq.com/s/ddA-yNmpAKJPZTYH4gLB8g) | [epay_163_com](https://github.com/kgepachong/crawler/tree/main/epay_163_com) |
65 | | [【JS 逆向百例】cnki 学术翻译 AES 加密分析](https://mp.weixin.qq.com/s/7DpFHJtr1VCHnPjTvWwO_Q) | [dict_cnki_net](https://github.com/kgepachong/crawler/tree/main/dict_cnki_net) |
66 | | [【JS 逆向百例】Ether Rock 空投接口 AES256 加密分析](https://mp.weixin.qq.com/s/XVOr3iJvKlUWNHjNfLwu_A) | [etherrock_ne](https://github.com/kgepachong/crawler/tree/main/etherrock_ne) |
67 | | [【JS 逆向百例】你没见过的社会主义核心价值观加密](https://mp.weixin.qq.com/s/jaWZ4dsMidX_8kjRCcDzXQ) | [www_appmiu_com](https://github.com/kgepachong/crawler/tree/main/www_appmiu_com) |
68 | | [【JS 逆向百例】反混淆入门,某鹏教育 JS 混淆还原](https://mp.weixin.qq.com/s/fMSCWfWXz4IiF2i7MHAKwQ) | [learn_open_com_cn](https://github.com/kgepachong/crawler/tree/main/learn_open_com_cn) |
69 | | [【JS 逆向百例】W店UA,OB反混淆,抓包替换CORS跨域错误分析](https://mp.weixin.qq.com/s/TqNLdM5cCRpAw7cOG3Dn7g) | [d_weidian_com](https://github.com/kgepachong/crawler/tree/main/d_weidian_com) |
70 | | [【JS 逆向百例】WebSocket 协议爬虫,智慧树扫码登录案例分析](https://mp.weixin.qq.com/s/Kx2TrcOCotZvNjSpStAnQg) | [passport_zhihuishu_com](https://github.com/kgepachong/crawler/tree/main/passport_zhihuishu_com) |
71 | | [【JS 逆向百例】网洛者反爬练习平台第一题:JS 混淆加密,反 Hook 操作](https://mp.weixin.qq.com/s/b-3YJrwOGjNzMxnh9SY2Lg) | [spider_wangluozhe_com_challenge_1](https://github.com/kgepachong/crawler/tree/main/spider_wangluozhe_com_challenge_1) |
72 | | [【JS 逆向百例】网洛者反爬练习平台第二题:JJEncode 加密](https://mp.weixin.qq.com/s/BO4UFe9nF30oK9Ht6qG18g) | [spider_wangluozhe_com_challenge_2](https://github.com/kgepachong/crawler/tree/main/spider_wangluozhe_com_challenge_2) |
73 | | [【JS 逆向百例】网洛者反爬练习平台第三题:AAEncode 加密](https://mp.weixin.qq.com/s/MJAmr8bff8aUTRHPMUOmiA) | [spider_wangluozhe_com_challenge_3](https://github.com/kgepachong/crawler/tree/main/spider_wangluozhe_com_challenge_3) |
74 | | [【JS 逆向百例】网洛者反爬练习平台第四题:JSFuck 加密](https://mp.weixin.qq.com/s/ddNNxTx66-tg55Vmzo-wJQ) | [spider_wangluozhe_com_challenge_4](https://github.com/kgepachong/crawler/tree/main/spider_wangluozhe_com_challenge_4) |
75 | | [【JS 逆向百例】网洛者反爬练习平台第五题:控制台反调试](https://mp.weixin.qq.com/s/kpMG4XdDRXeNFydd_pYghw) | \ |
76 | | [【JS 逆向百例】网洛者反爬练习平台第六题:JS 加密,环境模拟检测](https://mp.weixin.qq.com/s/8k7Ys13P6q8cb1a6kOnn1w) | [spider_wangluozhe_com_challenge_6](https://github.com/kgepachong/crawler/tree/main/spider_wangluozhe_com_challenge_6) |
77 | | [【JS 逆向百例】网洛者反爬练习平台第七题:JSVMPZL 初体验](https://mp.weixin.qq.com/s/GyHomcfX_G8DbJLKAjpU9g) | \ |
78 | | [【JS 逆向百例】X球投资者社区 cookie 参数 acw_sc__v2 加密分析](https://mp.weixin.qq.com/s/-kgcz6k8krM0pcHYqzKf-g) | [xueqiu_com](https://github.com/kgepachong/crawler/tree/main/xueqiu_com) |
79 | | [【JS 逆向百例】PEDATA 加密资讯以及 zlib.gunzipSync() 的应用](https://mp.weixin.qq.com/s/cO0YHQE_J5VGR7954SAnlw) | [max_pedata_cn](https://github.com/kgepachong/crawler/tree/main/max_pedata_cn) |
80 | | [某空气质量监测平台无限 debugger 以及数据动态加密分析](https://mp.weixin.qq.com/s/ithWRqLCIzAi-CKiD6mMdg) | \ |
81 | | [【JS 逆向百例】HN政务服务网登录逆向,验证码形同虚设](https://mp.weixin.qq.com/s/LTMvwrT-UFfH39rRsleyQA) | [www_hnzwfw_gov_cn](https://github.com/kgepachong/crawler/tree/main/www_hnzwfw_gov_cn) |
82 | | [【JS 逆向百例】吾爱破解2022春节解题领红包之番外篇 Web 中级题解](https://mp.weixin.qq.com/s/Hb7bgHoIW6zBNOMBqiWPaQ) | \ |
83 | | [RPC 技术及其框架 Sekiro 在爬虫逆向中的应用,加密数据一把梭!](https://mp.weixin.qq.com/s/9uKho4LY5fbrnHdJiPZ3KA) | \ |
84 | | [深度剖析 JA3 指纹及突破](https://mp.weixin.qq.com/s/TlUhLCBc1CKhiVRNHEIdmw) | \ |
85 | | [【JS 逆向百例】拉勾网爬虫,traceparent、\_\_lg_stoken\_\_、X-S-HEADER 等参数分析](https://mp.weixin.qq.com/s/b8yRLCb0SFhRsrfwZaCEjQ) | [www_lagou_com](https://github.com/kgepachong/crawler/tree/main/www_lagou_com) |
86 | | [逆向进阶,利用 AST 技术还原 JavaScript 混淆代码](https://mp.weixin.qq.com/s/fIbPuNMs5FRADJE5MOZXgA) | \ |
87 | | [【JS 逆向百例】AST 脱混淆实战,某 ICP 备案号查询接口 jsjiami v6 分析](https://mp.weixin.qq.com/s/YuP8oC1Do9x9wdk-I-GCeQ) | [icp_chinaz_com](https://github.com/kgepachong/crawler/tree/main/icp_chinaz_com) |
88 | | [人均瑞数系列,瑞数 4 代 JS 逆向分析](https://mp.weixin.qq.com/s/0uzPRiPdSargFlDM-TwAWw) | \ |
89 | | [【JS 逆向百例】某公共资源交易网,公告 URL 参数逆向分析](https://mp.weixin.qq.com/s/mec3zlTj5-rGRD1vfKrDBg) | [ggzy_jcs_gov_cn](https://github.com/kgepachong/crawler/tree/main/ggzy_jcs_gov_cn) |
90 | | [【JS 逆向百例】某网站加速乐 Cookie 混淆逆向详解](https://mp.weixin.qq.com/s/5N0Kp35XGJAuJSiIyLQt1g) | [mps_gov_cn](https://github.com/kgepachong/crawler/tree/main/mps_gov_cn) |
91 | | [JS逆向丨某行业大佬对坑风控的一些经验总结](https://mp.weixin.qq.com/s/hD5sBRQ1kmfnG7Yw12iZNg) | \ |
92 | | [百度指数 Cipher-Text、百度翻译 Acs-Token 逆向分析](https://mp.weixin.qq.com/s/upHnjYho6qTQlmupf-bjww) | [fanyi_baidu_com](https://github.com/kgepachong/crawler/tree/main/fanyi_baidu_com) |
93 | | [人均瑞数系列,瑞数 5 代 JS 逆向分析](https://mp.weixin.qq.com/s/Li88GVe49Q4DBbq3ti3YlA) | \ |
94 | | [【APP 逆向百例】Frida 初体验,root 检测与加密字符串定位](https://mp.weixin.qq.com/s/WfvTA9MJh-NS86LYDVTBzg) | [uncrackable_level1](https://github.com/kgepachong/crawler/tree/main/uncrackable_level1) |
95 | | [【JS 逆向百例】猿人学系列 web 比赛第五题:js 混淆 - 乱码增强,详细剖析](https://mp.weixin.qq.com/s/RX2jGH2OBdXVvYtynqxoWw) | [yrx_5](https://github.com/kgepachong/crawler/tree/main/yrx_5) |
96 |
97 | ---
98 |
99 | | K 哥爬虫普法专栏文章 |
100 | | :----------------------------------------------------------- |
101 | | [【k哥爬虫普法】程序员183并发爬取官方网站,直接获刑3年?](https://mp.weixin.qq.com/s/DUWO3GBd0u0MFcyvrN1pRQ) |
102 | | [【k哥爬虫普法】Python程序员爬取视频资源13万部,一分钱没挣,获刑2年!](https://mp.weixin.qq.com/s/OgzLbxXFhDPV8JX1NDbtIw) |
103 | | [【k哥爬虫普法】爬虫第一案,侵犯个人隐私,“入侵”短视频服务器!](https://mp.weixin.qq.com/s/cGBEEkHLTklz9sxiFe8Ivw) |
104 |
105 |
106 |
107 |
108 |

109 |
110 |
114 |
--------------------------------------------------------------------------------
/account_xiaomi_com/xiaomi_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-24
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: xiaomi_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import json
11 | import hashlib
12 | import urllib.parse
13 |
14 | import requests
15 |
16 |
17 | index_url = 'https://account.xiaomi.com/'
18 | login_url = 'https://account.xiaomi.com/pass/serviceLoginAuth2'
19 | headers = {
20 | 'Host': 'account.xiaomi.com',
21 | 'Origin': 'https://account.xiaomi.com',
22 | 'Referer': 'https://account.xiaomi.com/fe/service/login/password?_locale=zh_CN',
23 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
24 | }
25 | session = requests.session()
26 |
27 |
28 | def get_encrypted_password(password):
29 | encrypted_password = hashlib.md5(password.encode(encoding='utf-8')).hexdigest().upper()
30 | return encrypted_password
31 |
32 |
33 | def get_parameter():
34 | response = requests.get(url=index_url, headers=headers)
35 | location_url = response.history[1].headers['Location']
36 | urlparse = urllib.parse.urlparse(location_url)
37 | query_dict = urllib.parse.parse_qs(urlparse.query)
38 | # print(query_dict)
39 | return query_dict
40 |
41 |
42 | def login(username, encrypted_password, query_dict):
43 | data = {
44 | 'bizDeviceType': '',
45 | 'needTheme': query_dict['needTheme'][0],
46 | 'theme': '',
47 | 'showActiveX': query_dict['showActiveX'][0],
48 | 'serviceParam': query_dict['serviceParam'][0],
49 | 'callback': query_dict['callback'][0],
50 | 'qs': query_dict['qs'][0],
51 | 'sid': query_dict['sid'][0],
52 | '_sign': query_dict['_sign'][0],
53 | 'user': username,
54 | 'cc': '+86',
55 | 'hash': encrypted_password,
56 | '_json': True
57 | }
58 | response = session.post(url=login_url, data=data, headers=headers)
59 | response_json = json.loads(response.text.replace('&&&START&&&', ''))
60 | print(response_json)
61 | return response_json
62 |
63 |
64 | def main():
65 | username = input('请输入登录账号: ')
66 | password = input('请输入登录密码: ')
67 | encrypted_password = get_encrypted_password(password)
68 | parameter = get_parameter()
69 | login(username, encrypted_password, parameter)
70 |
71 |
72 | if __name__ == '__main__':
73 | main()
74 |
--------------------------------------------------------------------------------
/d_weidian_com/weidian_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-15
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: weidian_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 | from urllib import parse
13 |
14 |
15 | index_url = "https://d.weidian.com/weidian-pc/pc-vue-index/index.html"
16 | login_url = "https://sso1.weidian.com/user/login"
17 | UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
18 | session = requests.session()
19 |
20 |
21 | def get_encrypted_ua():
22 | with open('get_encrypted_ua.js', 'r', encoding='utf-8') as f:
23 | uad_js = f.read()
24 | ua = execjs.compile(uad_js).call('window.getUa')
25 | ua = parse.quote(ua)
26 | return ua
27 |
28 |
29 | def get_wd_token():
30 | headers = {"User-Agent": UserAgent}
31 | response = session.get(url=index_url, headers=headers)
32 | wd_token = response.cookies.get_dict()["wdtoken"]
33 | return wd_token
34 |
35 |
36 | def login(phone, password, ua, wd_token):
37 | headers = {
38 | "user-agent": UserAgent,
39 | "origin": "https://d.weidian.com",
40 | "referer": "https://d.weidian.com/",
41 | }
42 | data = {
43 | "phone": phone,
44 | "countryCode": "86",
45 | "password": password,
46 | "version": "1",
47 | "subaccountId": "",
48 | "clientInfo": '{"clientType": 1}',
49 | "captcha_session": "",
50 | "captcha_answer": "",
51 | "vcode": "",
52 | "mediaVcode": "",
53 | "ua": ua,
54 | "scene": "PCLogin",
55 | "wdtoken": wd_token
56 | }
57 | response = session.post(url=login_url, headers=headers, data=data)
58 | print(response.json())
59 |
60 |
61 | def main():
62 | phone = input("请输入登录手机号: ")
63 | password = input("请输入登录密码: ")
64 | ua = get_encrypted_ua()
65 | wd_token = get_wd_token()
66 | login(phone, password, ua, wd_token)
67 |
68 |
69 | if __name__ == '__main__':
70 | main()
71 |
--------------------------------------------------------------------------------
/dict_cnki_net/cnki.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-05
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: cnki.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | token_url = "https://dict.cnki.net/fyzs-front-api/getToken"
15 | translation_api = "https://dict.cnki.net/fyzs-front-api/translate/literaltranslation"
16 | UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
17 |
18 | session = requests.session()
19 |
20 |
21 | def get_token():
22 | headers = {"User-Agent": UA}
23 | response = session.get(url=token_url, headers=headers).json()
24 | token = response["data"]
25 | return token
26 |
27 |
28 | def get_encrypted_word(word):
29 | with open('cnki_encrypt.js', 'r', encoding='utf-8') as f:
30 | cnki_js = f.read()
31 | encrypted_word = execjs.compile(cnki_js).call('s', word)
32 | return encrypted_word
33 |
34 |
35 | def get_translation_result(encrypted_word, token):
36 | payload = {
37 | "translateType": None,
38 | "words": encrypted_word
39 | }
40 | headers = {
41 | "Token": token,
42 | "User-Agent": UA
43 | }
44 | response = session.post(url=translation_api, headers=headers, json=payload).json()
45 | result = response["data"]["mResult"]
46 | return result
47 |
48 |
49 | def main():
50 | word = input("请输入待翻译字符串: ")
51 | token = get_token()
52 | encrypted_word = get_encrypted_word(word)
53 | result = get_translation_result(encrypted_word, token)
54 | print("翻译结果为: ", result)
55 |
56 |
57 | if __name__ == "__main__":
58 | main()
59 |
--------------------------------------------------------------------------------
/dict_cnki_net/cnki_encrypt.js:
--------------------------------------------------------------------------------
1 | // 引用 crypto-js 加密模块
2 | var CryptoJS = require('crypto-js')
3 |
4 | function s(t) {
5 | var n = "4e87183cfd3a45fe"
6 | var e = {
7 | mode: CryptoJS.mode.ECB,
8 | padding: CryptoJS.pad.Pkcs7
9 | }
10 | , i = CryptoJS.enc.Utf8.parse(n)
11 | , s = CryptoJS.AES.encrypt(t, i, e)
12 | , r = s.toString().replace(/\//g, "_");
13 | return r = r.replace(/\+/g, "-"),
14 | r
15 | }
16 |
17 | console.log(s("测试"))
18 |
--------------------------------------------------------------------------------
/epay_163_com/epay.js:
--------------------------------------------------------------------------------
1 | // 引用 crypto-js 加密模块
2 | var CryptoJS = require('crypto-js')
3 |
4 | function getEncryptedPassword(password, peEnSeed) {
5 | var pwd = CryptoJS.enc.Utf8.parse(CryptoJS.MD5(password));
6 | var key = CryptoJS.enc.Utf8.parse(peEnSeed);
7 | var iv = CryptoJS.enc.Utf8.parse("0123456789012345");
8 | var encrypted = CryptoJS.AES.encrypt(pwd, key, {
9 | iv: iv,
10 | mode: CryptoJS.mode.CBC,
11 | padding: CryptoJS.pad.Pkcs7
12 | });
13 |
14 | return pwd ? key ? encodeURIComponent(encrypted.toString()) : pwd : ""
15 | }
16 |
17 | // 测试样例
18 | var password = "123456"
19 | var peEnSeed = "2F63CCD861E4397F1C2181006904BAB2"
20 | console.log(getEncryptedPassword(password, peEnSeed))
21 |
--------------------------------------------------------------------------------
/etherrock_ne/airdrop_submit.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-24
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: airdrop_submit.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | def get_content_and_key(address):
15 | with open("get_content_and_key.js", encoding="utf-8") as f:
16 | ether_rock_js = f.read()
17 | content_and_key_dict = execjs.compile(ether_rock_js).call('getContentAndKey', address)
18 | return content_and_key_dict
19 |
20 |
21 | def airdrop_submit(content_and_key_dict):
22 | submit_url = "https://etherrock.net/airdrop-submit"
23 | headers = {
24 | "Accept": "text/html, */*; q=0.01",
25 | "Accept-Language": "zh,zh-CN;q=0.9,en-US;q=0.8,en;q=0.7",
26 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
27 | "X-Requested-With": "XMLHttpRequest",
28 | "Host": "etherrock.net",
29 | "Origin": "https://etherrock.net",
30 | }
31 | data = {
32 | "content": content_and_key_dict["content"],
33 | "key": content_and_key_dict["key"]
34 | }
35 | response = requests.post(url=submit_url, data=data, headers=headers)
36 | print(response.text)
37 |
38 |
39 | def main():
40 | address = input("请输入ETH钱包地址领取空投: ")
41 | content_and_key_dict = get_content_and_key(address)
42 | airdrop_submit(content_and_key_dict)
43 |
44 |
45 | if __name__ == '__main__':
46 | main()
47 |
--------------------------------------------------------------------------------
/etherrock_ne/get_content_and_key.js:
--------------------------------------------------------------------------------
1 | function randomString(N) {
2 | if (!parseInt(N, 10)) N = 6;
3 | var rs = Math.floor(Math.pow(36, N) * Math.random()).toString(36);
4 | return (Math.pow(10, N) + rs).substr(-N);
5 | }
6 |
7 | var h = require("node-cryptojs-aes").CryptoJS
8 | , p = {
9 | stringify: function (b) {
10 | var e = h.enc.Hex.parse(b.salt.toString()).toString(h.enc.Latin1);
11 | b = b.ciphertext.toString(h.enc.Latin1);
12 | return h.enc.Latin1.parse("Salted__" + e + b).toString(h.enc.Base64)
13 | },
14 | parse: function (b) {
15 | b = h.enc.Base64.parse(b).toString(h.enc.Latin1);
16 | if ("Salted__" !== b.substr(0, 8))
17 | throw Error("Error parsing salt");
18 | var e = b.substr(8, 8);
19 | b = b.substr(16);
20 | return h.lib.CipherParams.create({
21 | ciphertext: h.enc.Latin1.parse(b),
22 | salt: h.enc.Latin1.parse(e)
23 | })
24 | }
25 | };
26 |
27 | var e = randomString(36);
28 |
29 | function getContent(address) {
30 | var b = JSON.stringify({
31 | "address": address,
32 | "ref": "",
33 | "uuid": "",
34 | "tz": "Asia/Shanghai",
35 | "tz_offset": 8,
36 | "screen": "1920x1080x24",
37 | "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
38 | "cpu": 8,
39 | "lang": "zh"
40 | })
41 | return h.AES.encrypt(b, e, {
42 | format: p
43 | }).toString()
44 | }
45 |
46 | function getKey() {
47 | JSEncrypt = require("jsencrypt")
48 | var crypt = new JSEncrypt();
49 | var pub = [
50 | '-----BEGIN PUBLIC KEY-----',
51 | 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVmYQhCYTnnkTPRMI5Ad3vfad9',
52 | 'lhjzOU92FZ3reUiN/vmqP/wC1DKKExYDsqa+w5xBP0AjGkfDWk3q4PlWu0UsBGZx',
53 | '62Gvt0ds75u8FnmLv+ufMimF4962/9Lx7uyh9g1H3/ze5ZXscWYy3gtts9d2Ga0R',
54 | 'pl0X49Cz0JhYYicuGwIDAQAB',
55 | '-----END PUBLIC KEY-----',
56 | ];
57 | crypt.setPublicKey(pub.join('\n'));
58 | key = crypt.encrypt(e);
59 | return key
60 | }
61 |
62 | function getContentAndKey(address) {
63 | result = {
64 | "key": getKey(),
65 | "content": getContent(address)
66 | }
67 | return result
68 | }
69 |
70 | // 测试样例
71 | // console.log(getContentAndKey("xxxxxxxxxxxxxxxx"))
72 |
--------------------------------------------------------------------------------
/fanyi_baidu_com/baidufanyi.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-12
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: baidufanyi.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import re
11 | import execjs
12 | import requests
13 | from urllib import parse
14 |
15 |
16 | session = requests.session()
17 | index_url = 'https://fanyi.baidu.com/'
18 | lang_url = 'https://fanyi.baidu.com/langdetect'
19 | translate_api = 'https://fanyi.baidu.com/v2transapi'
20 | headers = {
21 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36',
22 | }
23 | # cookies = {
24 | # "BAIDUID": "624363427DBD2BFCDF0C3D6E129F5C65:FG=1"
25 | # }
26 |
27 |
28 | def get_params(query):
29 | # 获取 token 和 gtk
30 | session.get(url=index_url, headers=headers)
31 | # print(session.cookies.get_dict())
32 | response_index = session.get(url=index_url, headers=headers)
33 | token = re.findall(r"token: '([0-9a-z]+)'", response_index.text)[0]
34 | gtk = re.findall(r'gtk = "(.*?)"', response_index.text)[0]
35 | # 自动检测语言
36 | response_lang = session.post(url=lang_url, headers=headers, data={'query': query})
37 | lang = response_lang.json()['lan']
38 | return token, gtk, lang
39 |
40 |
41 | def get_sign_and_token(query, gtk, lang):
42 | with open('baidufanyi_encrypt.js', 'r', encoding='utf-8') as f:
43 | baidu_js = f.read()
44 | sign = execjs.compile(baidu_js).call('e', query, gtk)
45 | translate_url = 'https://fanyi.baidu.com/#%s/en/%s' % (lang, parse.quote(query))
46 | acs_token = execjs.compile(baidu_js).call('ascToken', translate_url)
47 | return sign, acs_token
48 |
49 |
50 | def get_result(query, lang, sign, token, acs_token):
51 | data = {
52 | 'from': lang,
53 | 'to': 'en',
54 | 'query': query,
55 | 'transtype': 'realtime',
56 | 'simple_means_flag': '3',
57 | 'sign': sign,
58 | 'token': token,
59 | }
60 | headers["Acs-Token"] = acs_token
61 | response = session.post(url=translate_api, headers=headers, data=data)
62 | result = response.json()['trans_result']['data'][0]['dst']
63 | return result
64 |
65 |
66 | def main():
67 | query = input('请输入要翻译的文字:')
68 | token, gtk, lang = get_params(query)
69 | sign, acs_token = get_sign_and_token(query, gtk, lang)
70 | result = get_result(query, lang, sign, token, acs_token)
71 | print('翻译成英文的结果为:', result)
72 |
73 |
74 | if __name__ == '__main__':
75 | main()
76 |
--------------------------------------------------------------------------------
/fanyi_youdao_com/youdao_encrypt.js:
--------------------------------------------------------------------------------
1 | /*
2 | # ==================================
3 | # --*-- coding: utf-8 --*--
4 | # @Time : 2021-08-13
5 | # @Author : 微信公众号:K哥爬虫
6 | # @FileName: youdao_encrypt.js
7 | # @Software: PyCharm
8 | # ==================================
9 | */
10 |
11 |
12 | // 引用 crypto-js 加密模块
13 | var CryptoJS = require('crypto-js')
14 |
15 | function getEncryptedParams(data, ua) {
16 | var bv = CryptoJS.MD5(ua).toString(),
17 | lts = "" + (new Date).getTime(),
18 | salt = lts + parseInt(10 * Math.random(), 10)
19 | var sign = CryptoJS.MD5('fanyideskweb' + data + salt + ']BjuETDhU)zqSxf-=B#7m').toString()
20 | return { bv: bv, lts: lts, salt: salt, sign: sign }
21 | }
22 |
23 | // var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
24 | // var data = "测试"
25 | // console.log(getEncryptedParams(data, ua));
--------------------------------------------------------------------------------
/fanyi_youdao_com/youdaofanyi.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-13
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: youdaofanyi.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 | import random
12 | import hashlib
13 |
14 | import execjs
15 | import requests
16 |
17 |
18 | translate_url = 'https://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule'
19 | user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
20 |
21 |
22 | def get_translation_result(parameters):
23 | headers = {
24 | 'User-Agent': user_agent,
25 | 'Host': 'fanyi.youdao.com',
26 | 'Origin': 'https://fanyi.youdao.com',
27 | 'Referer': 'https://fanyi.youdao.com/',
28 | 'X-Requested-With': 'XMLHttpRequest',
29 | 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
30 | 'Cookie': 'OUTFOX_SEARCH_USER_ID="-1848382357@10.169.0.84"; ___rl__test__cookies=1625907853887; OUTFOX_SEARCH_USER_ID_NCOO=132978720.55854891'
31 | }
32 | response = requests.post(url=translate_url, headers=headers, data=parameters)
33 | result = response.json()['translateResult'][0][0]['tgt']
34 | return result
35 |
36 |
37 | def get_parameters_by_python(query, translate_from, translate_to):
38 | lts = str(int(time.time() * 1000)) # 以毫秒为单位的 13 位时间戳
39 | salt = lts + str(random.randint(0, 9)) # 13 位时间戳+随机数字,生成 salt 值
40 | sign = "fanyideskweb" + query + salt + "Y2FYu%TNSbMCxc3t2u^XT" # 拼接字符串组成 sign
41 | sign = hashlib.md5(sign.encode()).hexdigest() # 将 sign 进行 MD5 加密,生成最终 sign 值
42 | bv = hashlib.md5(user_agent.encode()).hexdigest() # 对 UA 进行 MD5 加密,生成 bv 值
43 | parameters = {
44 | 'i': query,
45 | 'from': translate_from,
46 | 'to': translate_to,
47 | 'smartresult': 'dict',
48 | 'client': 'fanyideskweb',
49 | 'salt': salt,
50 | 'sign': sign,
51 | 'lts': lts,
52 | 'bv': bv,
53 | 'doctype': 'json',
54 | 'version': '2.1',
55 | 'keyfrom': 'fanyi.web',
56 | 'action': 'FY_BY_REALTlME'
57 | }
58 | return parameters
59 |
60 |
61 | def get_parameters_by_javascript(query, translate_from, translate_to):
62 | with open('youdao_encrypt.js', 'r', encoding='utf-8') as f:
63 | youdao_js = f.read()
64 | params = execjs.compile(youdao_js).call('get_params', query, user_agent) # 通过 JavaScript 代码获取各个参数
65 | bv = hashlib.md5(user_agent.encode()).hexdigest() # 对 UA 进行 MD5 加密,生成 bv 值
66 | parameters = {
67 | 'i': query,
68 | 'from': translate_from,
69 | 'to': translate_to,
70 | 'smartresult': 'dict',
71 | 'client': 'fanyideskweb',
72 | 'salt': params['salt'],
73 | 'sign': params['sign'],
74 | 'lts': params['lts'],
75 | 'bv': bv,
76 | 'doctype': 'json',
77 | 'version': '2.1',
78 | 'keyfrom': 'fanyi.web',
79 | 'action': 'FY_BY_REALTlME'
80 | }
81 | return parameters
82 |
83 |
84 | def main():
85 | query = input('请输入要翻译的文字:')
86 | # 原始语言,目标语言,默认自动处理
87 | translate_from = translate_to = 'AUTO'
88 | # 通过 Python 获取加密参数或者通过 JavaScript 获取参数,二选一
89 | param = get_parameters_by_python(query, translate_from, translate_to)
90 | # param = get_parameters_by_javascript(query, translate_from, translate_to)
91 | result = get_translation_result(param)
92 | print('翻译的结果为:', result)
93 |
94 |
95 | if __name__ == '__main__':
96 | main()
97 |
--------------------------------------------------------------------------------
/fuwu_nhsa_gov_cn/nhsa.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-03
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: nhsa.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | regn_code_url = "https://fuwu.nhsa.gov.cn/ebus/fuwu/api/nthl/api/dic/queryAdmdvsTree"
15 | lv_and_type_url = "https://fuwu.nhsa.gov.cn/ebus/fuwu/api/nthl/api/fixed/queryDicByType"
16 | result_url = "https://fuwu.nhsa.gov.cn/ebus/fuwu/api/nthl/api/fixed/queryFixedHospital"
17 | UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
18 |
19 | with open('nhsa.js', 'r', encoding='utf-8') as f:
20 | nhsa_js = execjs.compile(f.read())
21 |
22 |
23 | def get_headers():
24 | """获取 header 参数,每次请求改变"""
25 | headers = nhsa_js.call("getHeaders")
26 | headers["User-Agent"] = UA
27 | headers["Content-Type"] = "application/json"
28 | headers["Host"] = "fuwu.nhsa.gov.cn"
29 | headers["Origin"] = "https://fuwu.nhsa.gov.cn"
30 | headers["Referer"] = "https://fuwu.nhsa.gov.cn/nationalHallSt/"
31 | # print(headers)
32 | return headers
33 |
34 |
35 | def get_regn_code():
36 | """获取城市代码,返回结果无加密"""
37 | payload = {"data": {"transferFlag": ""}}
38 | response = requests.post(url=regn_code_url, json=payload, headers=get_headers())
39 | print(response.text)
40 |
41 |
42 | def get_medins_lv_or_type_code(key):
43 | """获取医疗机构等级 (LV) or 类型 (TYPE) 代码"""
44 | if key == "LV":
45 | payload = {"type": "MEDINSLV"}
46 | elif key == "TYPE":
47 | payload = {"type": "MEDINS_TYPE"}
48 | else:
49 | print("输入有误!")
50 | return
51 | encrypted_payload = nhsa_js.call("getEncryptedData", payload)
52 | encrypted_data = requests.post(url=lv_and_type_url, json=encrypted_payload, headers=get_headers()).json()
53 | decrypted_data = nhsa_js.call("getDecryptedData", encrypted_data)
54 | print(decrypted_data)
55 |
56 |
57 | def get_result():
58 | addr = input("请输入医疗机构详细地址(默认无): ") or ""
59 | medins_lv_code = input("请输入医疗机构等级代码(默认无): ") or ""
60 | medins_name = input("请输入医疗机构名称(默认无): ") or ""
61 | medins_type_code = input("请输入医疗机构类型代码(默认无): ") or ""
62 | regn_code = input("请输入医疗机构所在地代码(默认北京市): ") or "110000"
63 | page_num = input("请输入要爬取的页数(默认1): ") or 1
64 |
65 | for page in range(1, int(page_num)+1):
66 | payload = {
67 | "addr": addr,
68 | "medinsLvCode": medins_lv_code,
69 | "medinsName": medins_name,
70 | "medinsTypeCode": medins_type_code,
71 | "pageNum": page,
72 | "pageSize": 10,
73 | "regnCode": regn_code,
74 | "sprtEcFlag": ""
75 | }
76 | page += 1
77 | encrypted_payload = nhsa_js.call("getEncryptedData", payload)
78 | encrypted_data = requests.post(url=result_url, json=encrypted_payload, headers=get_headers()).json()
79 | decrypted_data = nhsa_js.call("getDecryptedData", encrypted_data)
80 | print(decrypted_data)
81 |
82 |
83 | def main():
84 | # 获取城市代码
85 | # get_regn_code()
86 | # 获取医疗机构等级代码
87 | # get_medins_lv_or_type_code("LV")
88 | # 获取医疗机构类型代码
89 | # get_medins_lv_or_type_code("TYPE")
90 | # 获取搜索结果
91 | get_result()
92 |
93 |
94 | if __name__ == "__main__":
95 | main()
96 |
--------------------------------------------------------------------------------
/ggzy_jcs_gov_cn/ggzy.py:
--------------------------------------------------------------------------------
1 | # =======================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2022/7/16
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: ggzy.py
6 | # @Software: PyCharm
7 | # =======================
8 |
9 |
10 | import urllib.parse
11 | import execjs
12 | import requests
13 |
14 |
15 | url = f'http://ggzy.jcs.gov.cn/website/anno/index'
16 |
17 |
18 | def encrypted_project_id(id_enc):
19 | with open('ggzy_js.js', 'r', encoding='utf-8') as f:
20 | public_js = f.read()
21 | project_id = execjs.compile(public_js).call('Public', id_enc)
22 | return project_id
23 |
24 |
25 | def encrypted_project_info(info_enc):
26 | with open('ggzy_js.js', 'r', encoding='utf-8') as f:
27 | public_js = f.read()
28 | project_info = execjs.compile(public_js).call('Public', info_enc)
29 | return project_info
30 |
31 |
32 | def get_project_info(info_name, info_type):
33 | index_url = 'http://ggzy.jcs.gov.cn/pro-api-construction/construction/bidder/bidSection/list?pageNum=1&pageSize=20&releaseTime=&search=&informationType=%s&departmentId=&projectType=SZFJ&informationName=%s&onlyCanBidSectionFlag=NO' % (info_type, info_name)
34 | urlparse = urllib.parse.urlparse(index_url)
35 | project_info = urllib.parse.parse_qs(urlparse.query)['informationName'][0]
36 | return project_info
37 |
38 |
39 | def get_content(page, info_name, info_type):
40 | headers = {
41 | "Connection": "keep-alive",
42 | "Pragma": "no-cache",
43 | "Cache-Control": "no-cache",
44 | "Accept": "application/json, text/plain, */*",
45 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
46 | "Referer": "http://ggzy.jcs.gov.cn/website/transaction/index",
47 | "Accept-Language": "zh-CN,zh;q=0.9"
48 | }
49 | url_param = "http://ggzy.jcs.gov.cn/pro-api-construction/construction/bidder/bidSection/list"
50 | params = {
51 | "pageNum": page,
52 | "pageSize": "20",
53 | "releaseTime": "",
54 | "search": "",
55 | "informationType": info_type,
56 | "departmentId": "",
57 | "projectType": "SZFJ",
58 | "informationName": info_name,
59 | "onlyCanBidSectionFlag": "NO"
60 | }
61 | response = requests.get(url=url_param, headers=headers, params=params)
62 |
63 | return response
64 |
65 |
66 | def main():
67 | print("""=======================================================================
68 | 交易信息类别: 市政、房建工程
69 | 预审/候审公告: 信息类型 ---> ZBGG 公告类型 ---> ANNOUNCEMENT
70 | 变更公告: 信息类型 ---> ZBGG 公告类型 ---> ANNOUNCEMENT_CHANGE
71 | 预审结果公示: 信息类型 ---> YSJG 公告类型 ---> ANNOUNCEMENT_YS
72 | 中标候选人公示: 信息类型 ---> ZBHXRGS 公告类型 ---> ANNOUNCEMENT_CANDIDATE
73 | 中标公示: 信息类型 ---> ZBGS 公告类型 ---> ANNOUNCEMENT_WIN
74 | =======================================================================""")
75 | info_name = input("请输入信息类型:")
76 | info_type = input("请输入公告类型:")
77 | page = input("您想要获取数据的页数:")
78 | get_content(page, info_name, info_type)
79 | response = get_content(page, info_name.upper(), info_type.upper())
80 | num = int(page) * 20
81 | print("总共获取了 %d 个项目" % num)
82 | for i in range(20):
83 | title = response.json()['rows'][i]['content']
84 | query_id = response.json()['rows'][i]['projectId']
85 | query_info = get_project_info(info_name.upper(), info_type.upper())
86 | project_id_enc = encrypted_project_id(str(query_id))
87 | project_info_enc = encrypted_project_info(query_info)
88 | project_url = '%s?projectId=%s&projectInfo=%s' % (url, project_id_enc, project_info_enc)
89 | print("第 %d 个项目:" % (i+1) + "\n" + "项目名称:%s 项目编号:%d " % (title, query_id) + "\n" + "项目链接:%s" % project_url)
90 |
91 |
92 | if __name__ == '__main__':
93 | main()
94 |
--------------------------------------------------------------------------------
/ggzy_jcs_gov_cn/ggzy_js.js:
--------------------------------------------------------------------------------
1 | var CryptoJS = require('crypto-js');
2 |
3 |
4 | o = {
5 | keyHex: CryptoJS.enc.Utf8.parse(Object({
6 | NODE_ENV: "production",
7 | VUE_APP_BASE_API: "/pro-api",
8 | VUE_APP_CONSTRUCTION_API: "/pro-api-construction",
9 | VUE_APP_DEV_FILE_PREVIEW: "/lyjcdFileView/onlinePreview",
10 | VUE_APP_FILE_ALL_PATH: "http://www.lyjcd.cn:8089",
11 | VUE_APP_FILE_PREFIX: "/mygroup",
12 | VUE_APP_LAND_API: "/pro-api-land",
13 | VUE_APP_PREVIEW_PREFIX: "/lyjcdFileView",
14 | VUE_APP_PROCUREMENT_API: "/pro-api-procurement",
15 | VUE_APP_WINDOW_TITLE: "金昌市公共资源交易网",
16 | BASE_URL: "/"
17 | }).VUE_APP_CUSTOM_KEY || "54367819"),
18 | ivHex: CryptoJS.enc.Utf8.parse(Object({
19 | NODE_ENV: "production",
20 | VUE_APP_BASE_API: "/pro-api",
21 | VUE_APP_CONSTRUCTION_API: "/pro-api-construction",
22 | VUE_APP_DEV_FILE_PREVIEW: "/lyjcdFileView/onlinePreview",
23 | VUE_APP_FILE_ALL_PATH: "http://www.lyjcd.cn:8089",
24 | VUE_APP_FILE_PREFIX: "/mygroup",
25 | VUE_APP_LAND_API: "/pro-api-land",
26 | VUE_APP_PREVIEW_PREFIX: "/lyjcdFileView",
27 | VUE_APP_PROCUREMENT_API: "/pro-api-procurement",
28 | VUE_APP_WINDOW_TITLE: "金昌市公共资源交易网",
29 | BASE_URL: "/"
30 | }).VUE_APP_CUSTOM_IV || "54367819")
31 | };
32 |
33 | function Public(t) {
34 | return CryptoJS.DES.encrypt(t, o.keyHex, {
35 | iv: o.ivHex,
36 | mode: CryptoJS.mode.CBC,
37 | padding: CryptoJS.pad.Pkcs7
38 | }).ciphertext.toString()
39 | }
40 |
41 |
42 | //console.log(Public('ZBGG'))
43 |
--------------------------------------------------------------------------------
/icp_chinaz_com/README.md:
--------------------------------------------------------------------------------
1 | 代码已删除。
2 | Code deleted.
3 |
--------------------------------------------------------------------------------
/jzsc_mohurd_gov_cn/jzsc_mohurd.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-16
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: jzsc_mohurd.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import json
11 |
12 | import execjs
13 | import requests
14 |
15 |
16 | data_url = 'http://jzsc.mohurd.gov.cn/api/webApi/dataservice/query/comp/list?pg=%s&pgsz=15&total=450'
17 |
18 |
19 | def get_encrypted_data(page):
20 | headers = {
21 | 'Host': 'jzsc.mohurd.gov.cn',
22 | 'Referer': 'http://jzsc.mohurd.gov.cn/data/company',
23 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
24 | }
25 | encrypted_data = requests.get(url=data_url % page, headers=headers).text
26 | return encrypted_data
27 |
28 |
29 | def get_decrypted_data(encrypted_data):
30 | with open('jzsc_mohurd_decrypt.js', 'r', encoding='utf-8') as f:
31 | jzsc_mohurd_js = f.read()
32 | decrypted_data = execjs.compile(jzsc_mohurd_js).call('getDecryptedData', encrypted_data)
33 | return json.loads(decrypted_data)
34 |
35 |
36 | def main():
37 | # 30页数据
38 | for page in range(30):
39 | encrypted_data = get_encrypted_data(page)
40 | decrypted_data = get_decrypted_data(encrypted_data)
41 | print(decrypted_data)
42 |
43 |
44 | if __name__ == '__main__':
45 | main()
46 |
--------------------------------------------------------------------------------
/jzsc_mohurd_gov_cn/jzsc_mohurd_decrypt.js:
--------------------------------------------------------------------------------
1 | /*
2 | # ==================================
3 | # --*-- coding: utf-8 --*--
4 | # @Time : 2021-08-16
5 | # @Author : 微信公众号:K哥爬虫
6 | # @FileName: jzsc_mohurd_decrypt.js
7 | # @Software: PyCharm
8 | # ==================================
9 | */
10 |
11 | // 引用 crypto-js 加密模块
12 | var CryptoJS = require('crypto-js')
13 |
14 | function getDecryptedData(t) {
15 | var m = CryptoJS.enc.Utf8.parse("0123456789ABCDEF"),
16 | f = CryptoJS.enc.Utf8.parse("jo8j9wGw%6HbxfFn"),
17 | e = CryptoJS.enc.Hex.parse(t),
18 | n = CryptoJS.enc.Base64.stringify(e),
19 | a = CryptoJS.AES.decrypt(n, f, {
20 | iv: m,
21 | mode: CryptoJS.mode.CBC,
22 | padding: CryptoJS.pad.Pkcs7
23 | }),
24 | r = a.toString(CryptoJS.enc.Utf8);
25 | return r.toString()
26 | }
27 |
28 | // 测试样例
29 | // var t = '95780ba0943730051dccb5fe3918f9fe1b6f2130681f99d5620c5497aa480f13068063ac378e2b22caa5bb9dfd753cdfc5e3e7970c1c42cd2a329175a20ff189d767bbb15783ec2788514321fbd15912c2605cb412f9da2effa938b6e965697dd4eb0c3dd446fa74f442a555e8113669869e0c74d3ea1ebc64d57474386bc4f95148a1ebb3241b420d1e19c674c9299644724a15d1b6add7d11944e08810b676f5e6cd39b45e63f0a7ae0a7219221e3828702fe3fab6a2d6f71d599b15c1d32e2dc217f901d0a3444ffbd2d4bd9652d49e7d152c4b4e8b993046bb33af2e81f01434394d3c56e01297fa8dd8ddedc1ff066c112f8a9717056c220f619bdbb3887cd13ccd2d68a9eda6f53008189b82ccc47b61ea18ed634c0f29973c4de8a2645edef20d3a031bc1e54fb8814b49d3a102d72f42d5596158a00226be2654fe7bcb054dbeb6dfc91c3337e16da02195a5ac6d6253371a1a4e5ecbfbe7914b659202ac13aad7f63a21d58d48dc287e78fc84b47f8d6f517bc27e071811636d8b2a650d5b2251e883b1d66f3269c91c1b6909f94a5178488b0950dd35e83bef491bd56b7d8c44364c86d833f3dd14f73bdd144a05d82e2ae093fbea7c52050dfb3498b1ed06dfda465afbc5b9f21a3b80dca4d56c9ab808928005e768c3d0242e966bc4eec6f0fec84fe29510ea48695a0af1f62922f514d20f93221a90389d8d1e3235adeab4efcbf1b3895e5fb54424ef802794f15ca5d70cf06421062645cd43ee72d4d7cc1e0bae2b739cbee45333bafd6c85f94e0702ab900d22da356194bbcdc9d179d84d5e712983b3c06a3d500eb220109e5f23a9cf6c585a4f65f6dfe4edf2f02fc800e39a458c220df89ccee7abdb8d009d4825da5c47bdd1b4663f8444afee856a0ec3ecae968cb48e9b16ddb2c43a2360f0d556d84b29b6f2ea834f79783929cceb01db888338e68f6581d87e2c066aa9ca94caf6aeeac081de22734bbc8ebea96c59fb10c6f498f22c1efcc89f10320d788f11e62214ba365ace067e71caf7c39da639a9ad6178c79f4b89aabf19307a2b66f3f32550680eba70f162f4142b30fd31bb3b826afe83e8cf107629b927b858f7dfc8645d09f6c75d6b98dbd8b5fb957d59a63a3108573e06e4818989f08663c3fa91e84b40980808ad36111d180a68bea09bf78c6226488f9e292a5a45ba19c9a2d6b0d5638690e43aa10b11946d3214bec92945d000e6c79beeb1d2c5fd56736cfd36dfd0cf4ceff88552658006da7753f6b6fdc20c6586ce2380a05896d4e95c5b619c1eef39b694c3506cf0b7bb4df0a355a874485c556cbf433772347ac37a177d9ce8b6bcae2ac34f9dc1e127e4eb913c5e8495f45c9653ca11dab69022587b1497308e3c15a61ccba765f11aec4f7921004e7286ab54ce846c6a36532bb0faf28e7d2db52c5474a61da1d6afff979f57fb7d681cfc9ce8a842b4a14b5f480d0463ce9dfba6871371a2740d13364ef4a035556b69f0a1b7e404624cde8675b8774ed99916bb75756bdeaeadd18453662e07a164a2e91cd04c12c8ea2f77c66f88b79e33fec73953b56eb7e8b37194e5e527f11faeabb4054096657155dbde1d08ca4a014c22560e4937500d9f1c87cd335533e3bafdea41a1c9c6b58170a65a4b53b01def2cb8f180a581f8cbb5dcbff39781cb083aa23e8a12fb3a7648119932f55e270b46f7ed8735fa9349fb99e4bdccb9ddc30d6a2e341aa353f69e41161e663cd5752fb09c90b9759d01d7a16f58870c411e6326503ec4dc967b5cff6e6f45fa7f001da2604312bae5e4f380e31a14feb52c093a73dd8bd674a31c08212974c7a7fafdbbdd5c582059919667c967efd2354638652ff77d7bfc29523c15baffa0b262b2399085294e56e058918fac07e411a9045c0e97975eaddf0ecf7a7dbf507636c009fdbfeefed927e0fe9b97dcbc6d002b2844f09f72090ec9c62fbf8c50f3ffce331d1ccb20f98f865effd34eecd1633cdf0f5396c966cb1f1c3efe1d38e5bdd8c1bacf565e9047bd36c95e1e18313a7de4584915132951c20e77d3e12beaef333d2bcb18a7b7eb91d07b9fe51f7f355e97d13078bde19dea3b0e52f7e17154a896bab9c2ed98fc9887ad4deb37ba5bb4069a4a4794b09b4ab381b35e38d084fe18aea4fb347de0945c2b6046c56fc63eb06ce2c39717f392ce3c3fd5dbf18a17b014e4bc79cb1cc04a93e8f6c9d9a74e513de0b5811f4994618e70038ee5913c444803ff6b860284c8f03bed82ff803b84bdead0e9307ab313a98ff47b320358ed8dac0bd7a49c9d9881bcf869c2c9a84840b52319015d1fc968f13d128b07bddf0a456c39f61fd431e996759525ee732d293c20b2f980edb80929f38398ff4a0013148bc7627cafe0c07488a60c4f5b89bfbc3253b7deaf0b9f2438c96748fda05f4b6e32ec66594e5684b6d4d45a2169696ae85bc9d198b138946e48f07229e6336b23af30f64a4312c29572eeac11ab7bcd87f1c019a7c39aee3ce0fc4ba27b217e9258812b9bc925966cec99b3887ec38c3523864d332decac2d6c9cc8c7a81422c3a6577b8877ee7ed90fff1f6689f13f24061b63ecf6cc81cdcca907c57d4390f72a2b10413ddfb139dd926db077f95f6e41183d32e4f17c54f326077c16c20c80f19fe9a5448531d0e0f4f1be60fb4504ef54a6b55d2dc125f12006aecb3abdcd49d68e74367a1de8d22bc9396f4431ad3875a99b5834c69cc9d0d2b7fb65ec92e49d7203153b50f4d8b310efe6508dcb047f958f2174ce2d82193ec21adcb5b03ae13e0d57e41f0fcd953983359c666c129dee80b4f90298e864352bf64aff790223ec9e65e7d4537a2060bfc2799293fe70c6ba6fda8a6f3126bef87a5931668d10be6dc18342b51eb23c17dfa60e4d2fb50bc06a04d8749f04c75f6906be07d0bda7e0950b25a0788e43357b4f808be37122ebd3204664860a145eb36a35963a06168596e6d2b4a52eeccd05f47fee5a7772989d35f23a730bc974b9cc9f31cd8282ff31b15225946def949677596097ea8689d60c2980563804e822450deb939b683857596d78a8716d19b135517935af3e0dc92c53933daf61ef6865e80c5c17e514c211b243c6322ae75e2f944a17a29700b274c26b5bc10bf0d704105d81be5f6dddea5664d6e37b5e0d68629b4266485bbdfc624c6a461dc512c37c44758ae721c50f6cbca1b5a2195fdaed4fb6449fcb500445bb7d92e78300c2959fc4626837d31c427f1b2c00ac39047c514c2426fd4d13c92f40b508eea2c16a0334354b13ecc06090eb1711b9778ee7fb6dc4ec5a371cb864a668c447667d66fbee2090b175a38dea40095128d786885897365c84e4e6b1a3266a5f392cb4a5dfdc734d1fe484a253a657d4c65edc3674c985bef597c0b99cba913828f22226518b9d8d53ce6cac51c6ac843182c9615eec6399b14a21b5c2d0c1ecc3e041351b34ec9faf495366074febf287c93f82abc80d9c5d18430cff0c54ef3f5d0e216673642cb52a475e926281e6237c42932da78478f8fd046ae2df5fd899aad63722129c6a55bde2dfd17b171be8756d2b84b253adbc0d52b44a195351a0c758d858541a8d6d9a5604d2fed14b8d6ac03d834a3568f74a4ba12df13aa3825483a8c4a0d3122ae55ec5725b3343f72e1420756c166782ba91fb4866d2830f65f757830e824cb59950293b2cbe30d339708166e6da57c6f9b9ca04e13ceaddb25b2692b1c92477cfaa724e70829fb5ff5d6699dd87ac73ddab6f59cc9c54675f0311dd90b6a11b4ede5a17bbaf9570eff8e7e86b4cbf506362ff42beb55b71ba3452de851655cb0fe0349805bdd4f5896b7763a89fe5e62c9fb3461a52cc626b3b99b48a016b54ab7789f81eedb1b26832bb72ab4d82314cd9c11c186d9ae00abd796317186346bb01d3565d5912587712794cf3c1aef24c20d3f371b69f019cfd0582e585eb13fbe39700bd4ecb084a68be6f1933c5dd9cf565dd14eb28982249932a30e4d280edc704a5d21e0e5cacfd5551a174033e4511fa579ab9f98dafba2639c8c85a7dbddd1550cc273c3c0b4f4b6cf1624089351712d2e5b26fb659cfba498de08a0cafc03c5a3e1ad73a8fc74cef34d26878ca069d9ccbe461f0f9c85490601a0d8cb09447d049ff06f51ef7a4324d8137736d212b9b21a49632da1b20768c2d1ab7eb2b7a40e3b7b243e3e4317ca3486c803aad9e8aafcbbc6372115ea8fd0a97caa66db9a253e29f97f17196202c1416d79ee69dba5b3dfc4f03cfb2fce30443fcd77512496a788fe480c714208c8624a826cb5d2c2ce0330872770f450f4044ea18f1f842d94aa6320f7c840f6d1143edc4be6b338b204c00476444f2ab0940347457df4c2e95dd3ba6b30ffe2ab0ed7195ebee61993d1de2f1eda2ea044e31b0ef1be50e80e1074a592a93e0bed0d3c7964e4737100d355c5db4fd38b4a6715bd16ab91468906884fea78e21d90cf278c5f76edc03675bb511549614014efe876cd0d6b0a6dfa43360aff05f5b172590e4abddb74bff42d1bdf5188fabd9c88b7be9680ad883bacb705a89361e00431978a83b19a60be5a643ac521ca11bd9b52dd1ca691d92fd715ff18590adecb621be00bfe73ee17478fff5df6dade2b007bf6e1738e3b610396ddebc442525334256f12badd8b638adf872173f6c117c91bee372d5ac3b6e84aff275831c43faa4f86ee6bf5f021d01e4df08552462003521bd93154b0046194d7ef24cf6afab23dae94711dcd6618ddf73f338ddf2ccb1e73e9c9237bdea9c439109a178e52b3dc9ecec1de34cb329dc4b21055882a746b56625caa192b9b16f68075aeeea17e9c3d9bd7ad4a687369873ed6ad3d14161174bf9edca666a2202c495c784e03a1ec1157e9fce3febe8096d4d77c3f53f6434eeb897cdc46d070c8ca8ec494b8d433e0a779f1c28efb6ed645447ce3ddaae68ed2f19f5930103ff45bccec3897b5f414971ab5ea63758f7b59be6024c1affd03d96f501861b42a798d9bf322bd33cec3254673fcfd7e2b852d41b9737518bb6dec0e2ce549223ca54ca18c7634ac174c875b7b63af89cb6ee5227fecea1d4816939e1e8fe788fea6273f318787f5c6b4e46961dd6561f5d78c7b22096b8ddb87493fe9ec8b259bd741dc2dafd7c9fda3fb822289a14124caec67bc08b580214f6f63d54bd80264510d1aab1d7ece574387b0d9d79799975e1ae85a1ac6fcffc31a68d6f8a9d167e719c5631a987f6ef34cf4c2c9925497b3b8c8aa78c5c28ea9629b37b7ff0cfc5068da4ecca018c452de821aebf1ff8a1af364d25849470ec3284ba276a37381c0baeba2c30f906f8cc8bb1c7ddcf5cbfa59031263100e609deb29be26508e746c1eaa61cbc540423e695344f94bcaaea588270ea7750ef1b0c9878162d7ea1324514619ed34dcff83bcc7b7789a5d36bbf598aea7f5bb48c6b0794e3338d1c2c9a9ce8c8f0a5133cf0b873602a24591c7ec687f91465c3f1f9b0b3dfb4b8b4817e9b693c3dafe5940b8666e6bbb26faca187dd4e37897e0743143c7c46a7bacf3f5fd5aedce02dbcc261e5d11622b76d6b364e01b7e8e2cba60c5228c75de346fa2192b63c7656c107183801404e2d17cd6086781b20b2358fc315851eedb3adf7adcb7aaefbe82b2112b3b1055ad6c760083424393c9f633ae9b2901530c5fe5e2bfa589532510593de8309e2dc60d3a0e2b2c1882b3303fd6b14419240dbf296d876280dc160ab44bae55f8ab5055b2b2a4520b906406e6560d2accf6b9368bd7b3196cff2cee84988c7749d3a0bc9e13b0641ad681afb5f9e3c25c33287b7abff7547b5ce47b2a22169fd513c91dd45438fa3c4ef0c1c82e48afe87158407e70c9365ed737bda8927af7a45b81c648a1b03854cca7e25368f974dc97c88d47ba026061d8d2066734bd78a31a9988cb8cb92e6e474e65a3949e2b8b8ea40a5541633d88224208018e300e668f8e4d6439a9eda429431c257856c49e043769744aceb0025f219fd148b435a6511c114306ba0064c1e91eb2c081687ef148483c4ba410f48ea925028092311265c110fb84c2fdc805fbd58da269752bf09e90d635e6498da89510128a62a1ef46c01a518a13863ba9201ea06850beb4a6408d72358331a3d24e73cd9479f3ad031278c9425106a6dee78e9c82ac2404a54e30ed9b61909d915c0c779c92df8badf2585bf689dcc42a0421f1cdc05142347aa268cbaee4b809460877ab75dd19e6c888e03ddb7cc41655ad2d0db86d8d4cb64b19f775943ad53c2f1f2a14dfb7bb8ba02fe144c5a90affb8b934dad4be957ec0c17b5f763e38a538137683f94d75281ebbfe305e965bc7504dfb4ade0693c00dc36a4799394a40d149d0043631dc5c5145ce01fe19d65cd0fbb61b5804fbf063622385b3b462050f5af71ec578f3b04efd6f65c141363d66660a4c9cdb623d92ac28cf7d73e6bea33ffffd95045ec88e77c00260d8e288b77a2ee3a08511bb52d432ba7bbcc16073bb9bc11126f1258bad4d487147a588a929fd8d6972549b40988000fdb2711f3aaa1c4b39798ee5343'
30 | // console.log(getDecryptedData(t))
--------------------------------------------------------------------------------
/learn_open_com_cn/get_black_box.js:
--------------------------------------------------------------------------------
1 | // 获取 black_box 参数
2 |
3 | function oQ0OQ(Q0o0, o0OQ) {
4 | return Q0o0 < o0OQ;
5 | }
6 |
7 | function O000O(Q0o0, o0OQ) {
8 | return Q0o0 >> o0OQ;
9 | }
10 |
11 | function Qo0oo(Q0o0, o0OQ) {
12 | return Q0o0 | o0OQ;
13 | }
14 |
15 | function OOO0Q(Q0o0, o0OQ) {
16 | return Q0o0 << o0OQ;
17 | }
18 |
19 | function OooQo(Q0o0, o0OQ) {
20 | return Q0o0 & o0OQ;
21 | }
22 |
23 | function Oo0OO(Q0o0, o0OQ) {
24 | return Q0o0 + o0OQ;
25 | }
26 |
27 | var oQoo0 = {};
28 | oQoo0["_keyStr"] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
29 | oQoo0["encode"] = function QQQ0(Q0o0) {
30 | var o0OQ = 62;
31 | while (o0OQ) {
32 | switch (o0OQ) {
33 | case 116 + 13 - 65: {
34 | var Q000;
35 | var Q00O;
36 | var OQO0 = 0;
37 | o0OQ = 65;
38 | break;
39 | }
40 | case 118 + 8 - 63: {
41 | var QQoO;
42 | var oQOQ;
43 | var ooQQ;
44 | o0OQ = 64;
45 | break;
46 | }
47 | case 94 + 8 - 40: {
48 | var ooO0 = "";
49 | var QQOQ;
50 | var QOo0;
51 | o0OQ = 63;
52 | break;
53 | }
54 | case 122 + 6 - 63: {
55 | Q0o0 = oQoo0["_utf8_encode"](Q0o0);
56 | var Q0oO = 9;
57 | while (Q0oO) {
58 | switch (Q0oO) {
59 | case 59 + 11 - 60: {
60 | QQOQ = Q0o0["charCodeAt"](OQO0++),
61 | QOo0 = Q0o0["charCodeAt"](OQO0++),
62 | QQoO = Q0o0["charCodeAt"](OQO0++),
63 | oQOQ = O000O(QQOQ, 2),
64 | ooQQ = Qo0oo(OOO0Q(OooQo(QQOQ, 3), 4), O000O(QOo0, 4)),
65 | Q000 = Qo0oo(OOO0Q(OooQo(QOo0, 15), 2), O000O(QQoO, 6)),
66 | Q00O = OooQo(QQoO, 63);
67 | if (isNaN(QOo0)) {
68 | Q000 = Q00O = 64;
69 | } else if (isNaN(QQoO)) {
70 | Q00O = 64;
71 | }
72 | Q0oO = 11;
73 | break;
74 | }
75 | case 50 + 15 - 56: {
76 | Q0oO = oQ0OQ(OQO0, Q0o0["length"]) ? 10 : 0;
77 | break;
78 | }
79 | case 95 + 5 - 89: {
80 | ooO0 = Oo0OO(Oo0OO(Oo0OO(Oo0OO(ooO0, this["_keyStr"]["charAt"](oQOQ)), this["_keyStr"]["charAt"](ooQQ)), this["_keyStr"]["charAt"](Q000)), this["_keyStr"]["charAt"](Q00O));
81 | Q0oO = 9;
82 | break;
83 | }
84 | }
85 | }
86 | return ooO0;
87 | }
88 | }
89 | }
90 | };
91 | oQoo0["_utf8_encode"] = function oOQ0(Q0o0) {
92 | Q0o0 = Q0o0["replace"](/\r\n/g, "");
93 | var o0OQ = "";
94 | for (var Q000 = 0; oQ0OQ(Q000, Q0o0["length"]); Q000++) {
95 | var Q00O = Q0o0["charCodeAt"](Q000);
96 | if (oQ0OQ(Q00O, 128)) {
97 | o0OQ += String["fromCharCode"](Q00O);
98 | } else if (Q0OQO(Q00O, 127) && oQ0OQ(Q00O, 2048)) {
99 | o0OQ += String["fromCharCode"](Qo0oo(O000O(Q00O, 6), 192)),
100 | o0OQ += String["fromCharCode"](Qo0oo(OooQo(Q00O, 63), 128));
101 | } else {
102 | o0OQ += String["fromCharCode"](Qo0oo(O000O(Q00O, 12), 224)),
103 | o0OQ += String["fromCharCode"](Qo0oo(OooQo(O000O(Q00O, 6), 63), 128)),
104 | o0OQ += String["fromCharCode"](Qo0oo(OooQo(Q00O, 63), 128));
105 | }
106 | }
107 | return o0OQ;
108 | }
109 |
110 | function OOoO0() {
111 | var tokens = "e0ia+fB5zvGuTjFDgcKahQwg2UEH8b0k7EK/Ukt4KwzyCbpm11jjy8Au64MC6s7HvLRacUxd7ka4AdDidJmYAA==";
112 | var version = "+X+3JWoUVBc12xtmgMpwzjAone3cp6/4QuFj7oWKNk+C4tqy4un/e29cODlhRmDy";
113 | var Oo0O0 = {};
114 | Oo0O0["blackBox"] = {};
115 | Oo0O0["blackBox"]["v"] = version;
116 | Oo0O0["blackBox"]["os"] = "web";
117 | Oo0O0["blackBox"]["it"] = parseInt(Math.random() * 100000);
118 | Oo0O0["blackBox"]["t"] = tokens;
119 | return oQoo0["encode"](JSON.stringify(Oo0O0["blackBox"]));
120 | }
121 |
122 | // 测试样例
123 | // console.log(OOoO0())
124 |
--------------------------------------------------------------------------------
/learn_open_com_cn/open_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-10
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: open_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 | import execjs
12 | import requests
13 |
14 |
15 | login_url = "https://learn.open.com.cn/Account/UnitLogin"
16 |
17 |
18 | def get_black_box():
19 | with open('get_black_box.js', 'r', encoding='utf-8') as f:
20 | exec_js = f.read()
21 | black_box = execjs.compile(exec_js).call('OOoO0')
22 | return black_box
23 |
24 |
25 | def login(black_box, username, password):
26 | params = {"bust": str(int(time.time() * 1000))}
27 | data = {
28 | "loginName": username,
29 | "passWord": password,
30 | "validateNum": "",
31 | "black_box": black_box
32 | }
33 | headers = {
34 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
35 | }
36 | response = requests.post(url=login_url, params=params, data=data, headers=headers)
37 | print(response.json())
38 |
39 |
40 | def main():
41 | username = input("请输入登录账号: ")
42 | password = input("请输入登录密码: ")
43 | black_box = get_black_box()
44 | login(black_box, username, password)
45 |
46 |
47 | if __name__ == '__main__':
48 | main()
49 |
--------------------------------------------------------------------------------
/learn_open_com_cn/replace_js.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-09
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: replace_js.py
6 | # @Software: PyCharm
7 | # @describe: 混淆还原小脚本
8 | # ==================================
9 |
10 |
11 | # 以实际列表为准,要和 fm_old.js 里的列表一致
12 | item = ['$super', 'num', 'D', 'mac os', 'zxHLIXE7juh9iFplePUaldxaz6HLanwh', 'wr', 'zPHpanwXjOPFHq7FMZUEbX', 'outerHTML', 'log', 'pageInfo', 'all', 'getElementById', 'gecko', 'enc', 'partnerDetectUrl', 'Base64', 'iframe', 'Chrome', 'xAEv', 'S', 'Segoe UI Symbol', 'hSHQaIEGREhHYp7A', 'Base', 'l', 'rPme', '_invSubKeys', '; expires=', 'documentElement', 'Comic Sans MS', 'netscape', 'ie', 'jsDownloadedTime', 'object', 'Lucida Fax', 'zPHda1EGjlPIHx7FeQCfbp', 'zoom', 'Verdana', '_bbxtimestamp', 'onload', '?platform=3', 'keys', 'E', 'zRzjaKw8Ru', 'value', 'getTime', 'initCookie', 'x', 'style', 'device_version', '&i=', 'getUniformLocation', 'amap', 'bAws', '8.0', 'exec', 'Segoe UI Light', '=', 'text-align-last', 'device-version', 'isFirefox', 'call', 'cookieStore', '?', 'insertBefore', '_data', '&appName=', 'enabled', 'script', 'Gult', 'MicroMessenger', 'stack', 'TrackEvent', 'zIHlanwhRIr9Y3pYMQ', 'gesture', 'monospace', 'zVzDIoxXjuPSGM7FePU5', 'indexedDB', 'callSelenium', 'shaderSource', 'q652mrpq0k', 'zIzLanEeRLhwYO71eHUEb6xHhSHv', 'navigator', 'mozRTCPeerConnection', 'Cipher', 'via', 'MSIE (\\d+\\.\\d+);', 'Shockwave Flash', 'on', 'Object.keys called on non-object', 'src', '&osVersion=', 'target', '20030107', 'Palatino', '_x64Rotl', '_x64LeftShift', 'LINUX', 'z0HLINOFRmPr', 'ios', 'CHROME', 'useSid', 'getTimezoneOffset', 'Lucida Handwriting', 'name', 'UNMASKED_RENDERER_WEBGL', 'Pkcs7', 'split', 'createBuffer', 'addHandler', '__BROWSERTOOLS_DOMEXPLORER_ADDED', 'browser', 'userAgent', 'zVzLaNELjKrFYO71MQUEJpfj', 'Lucida Calligraphy', 'jsonCallback', 'presto', 'fulfilled', '#069', 'keydown', 'kdf', 'Safari', 'screen', 'w3', '_utf8_decode', 'z1HdawEcjuhiGPqYMQCpbKx9z0', 'wk', 'this is null or not defined', 'Lucida Sans', 'GEwr', 'ontouchstart', 'dp', 'zRzLINEGRVQqY37bMQUo', 'callPhantom', 'jTimeout', 'tdtest', 'IPHONE', 'UNMASKED_VENDOR_WEBGL', 'base64s', 'h', 'MS Gothic', '_ks', 'index', 'zPHpanwXjOPFHP7aoQUiJgxmi10wkExeRLPSY371ey', 'symbol', 'ANDROID', 'vendor', 'hasOwnProperty', 'https://fp.tongdun.net', 'get', 'G', 'Century Schoolbook', 'cookieHandler', 'qhjc', 'ctrlKey', 'getParameter', 'zPHlaMECjzhriy71eTUpbXxIzS', 'screenLeft', 'salt', 'webkitOfflineAudioContext', 'RIMTABLET', 'appName', 'Geneva', ' OPR/', 'indexDB', 'floor', 'partnerSendSwitch', 'getBattery', '_xid', 'keyWords', '(', 'p=', 'qrkd', 'enableVertexAttribArray', '-&-', 'msBattery', 'zVzDIoOcjzhiYOplNGUEJqfgz6Hlan', 'id', '_', 'webdriver', 'plugins', 'referer', '/web/ub.png', 'rejected', 'createElement', '_t16', 'version', 'getExtension', 'PKzx', 'WEBOS', '?u=', 'toDataURL', '_DEC_XFORM_MODE', '__wxjs_environment', 'status', 'j', 'C', 'timestamp', 'onFulfilled', 'StreamCipher', 'Hex', 'alipay', '_callback=', 'toLowerCase', 'fpNetHost', 'replace', 'allow-scripts', 'M', 'altKey', 'trident', 'qDej', 'O', 'Array.prototype.indexOf() - can\'t convert `', 'indexOf', 'Tahoma', 'P', '&browserVersion=', 'app_name', 'test', 'put', '/fp3/profile.json', 'EvpKDF', 'availHeight', 'MSIE ([0-9]{1,}[.0-9]{0,})', 'charging', 'IPAD', 'vertexPosAttrib', 'metaKey', 'true', 'Arial Black', 'mousemove', '_des2', '-webkit-hyphens', 'o', '4enw49pim03', 'Microsoft Internet Explorer', 'webkitAudioContext', 'readPixels', 'dec', 'Pgwz', 'edit', '_xformMode', 'IE', 'AudioContext', 'zsHpINELRBhriG7AeqUDJgxs', 'Elzt', 'charAt', 'detachEvent', 'ig', 'width', 'splice', 'A', 'yourip', '&os=', 'ABCDEFGHJIKLMNOPQRSTUVWXYZ', 'idf', 'readwrite', 'zNHpanwGjBhLYMpbMzCpbFft', '_unhandledRejectionFn', 'u', 'detect', 'timeout', ' is not a function', 'OpenSSL', 'quota', 'mac', 'screenX', 'Wingdings', 'N', 'RTCPeerConnection', 'Latin1', 'ipod', '_keyStr', 'detectEthernet', 'Lucida Console', 'xiamenair', 'getItem', '_utf8_encode', 'hPHjIXEGjuhiiG7AeGCf', 'Calibri', '/v3/get_black_box.js', 'fmb', 'pad', 'rgba(255,255,255,1)', 'bot', 'zJHpanEFRuhLYx7A', 'TripleDES', 'L', 'cssText', ',', 'availWidth', 'q', ';', '_lBlock', '~/', 'position', 'zPHpanwXjOPF', 'toLocaleString', '_x64Add', 'z6HCanEGRVrRYy7FeyUoJg', 'BlockCipher', 'win', 'setDate', 'MSIE', 'Android.*(wv|.0.0.0)', 'iPhone', 'K', 'Helvetica Neue', 'detectSwitch', 'hash128', 'shiftKey', 'MAC', 'IPOD', 'vertexAttribPointer', '*', 'substring', 'Times', 'gk', 'protocol', 'compatible', 'Z', '&browser=', 'Century', 'invoked', 'webkit', 'touchstart', 'requestPermission', ' is not iterable(cannot read property Symbol(Symbol.iterator))', 'font', 'length', 'token_id', 'absolute', 'objectStoreNames', 'gwsF', 'span', 'documentMode', 'c', 'a', '_x64Multiply', 'toString', 'start', 'TDpx', 'display', 'pxy', 'sin', 'compileShader', '&occurTime=', '$1', 'wsHost', 'WordArray', 'onsuccess', 'Device fingerprint request send successfully, token_id: ', 'msie', 'mobile', 'BLACKBERRY', 'g', 'Segoe Print', 'bgMG', 'w', 'Webkit', 'level', 'sort', 'localStorage', 'ubid', 'chrome', 'string', 'td_ua', 'cdu', 'CLkC', 'k', '\'WebSocket\' is undefined', 'sigBytes', 'staticHost', 'detectUrl', 'transaction', 'gCcJ', 'OPERA', 'FLOAT', 'STATIC_DRAW', 'linkProgram', 'hyhbgqbaxi6', 'ipad', 'tcpHost', 'productSub', 'CSS', 'FRAGMENT_SHADER', 'maxChannelCount', 'iterations', 'zJHpanEFRuhLYx7AMN', 'offsetHeight', 'newValue', 'taobao', 'zNzjkIEkRUQIYOpAeNUoK7xiz6HCINwe', 'IOS', '_x64Xor', 'ch', 'iphone', 'match', 'input', 'uc', '_phantom', '#f60', 'prlt87lwxvm', 'iterator', 'isEdge', 'addres', 'removeChild', 'unknown', 'chromeos', '_des1', 'initialized', '|', 'document', 'http://', 'hczmaKxeRLPSY371ey', 'kPfK', ', ', '_k16', '_handled', 'https://bugly.tongdun.net/bugly/errorCollect/v1.png', 'Utf8', 'f', 'h0HLaXEFjCQFGPple4U5bE', '_cipher', 'set', '0123456789', 'https://xx.com', 'HzEu', 'TRIDENT', 'task', 'Wingdings 2', 'uniform2f', 'isTrusted', 'abs', 'static.fraudmetrix.cn', 'WEBGL_debug_renderer_info', 'MS Reference Sans Serif', 'fontFamily', 'aomygod', 'ltx71', 'spider', 'webos', 'touchmove', 'addEventListener', 'storage', '_k41', 'createShader', 'reCheckCookie', 'Times New Roman PS', 'map', 'WEBKIT', 'error', '2d', 'HmacMD5', 'major', 'Cambria', 'isBlink', 'Georgia', '_sz', 'TOUCHPAD', 'deleted', 'setMonth', 'PRESTO', '未定义', 'result', '-', 'jsonUrl', 'BADA', 'StyleMedia', 'sKrB', '&v=', 'webkitRTCPeerConnection', 'zczwaMwFRIhrGZHSeTU5bEfIzVHKaw', 'ct', 'offsetUniform', 'zJHlaKEkRLhwYO71', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'hPzQIKwhjuhDiG7eeqUDJFxmz0HL', 'h1zjawwrtOhqYy71MQ', 'getError', 'toUpperCase', 'F', 'FDxu', 'wbvNtP9DRhv8AItE4pgJIHT+k8otjqWtQFKG7tqOS4VtrWerxRtG2w6341/sgCNL', '&errorType=', 'ywwE', 'zPzjIKEkRLPIGZ7FeaCEJgxI', 'hSHlJKwhRVhwYp79NNCfJqxNzsHK', 'propertyIsEnumerable', 'position:absolute !important; z-index:-9999 !important; visibility:hidden !important', 'fontSize', 'onerror', 'zJMu', 'fmData', '14px \'Arial\'', 'tIndex', 'valueOf', 'DES', 'MS PGothic', 'Arial MT', 'getAttribLocation', 'Android', 'token', 'changedTouches', 'normal', 'hPzDawEejzhLYG7lMaUeJEfgz1zw', 'origin', 'h0HQaNwhjU', 'z1HCIwEcjuPSYSpbezefbFfZz6HjawweSIPIGZ7FeqUD', 'add', 'txLj', '[', 'type', '_value', '@script', 'left', '_des3', 'A promise cannot be resolved with itself.', 'MYRIAD', 'onicecandidate', 'debug', 'zding_', 'number', 'zVzDIoOejKhIYyH1eTUabF', 'hasher', 'W', 'Garamond', '', 'removeEventListener', 'chargingTime', 'zbHLa1EFjUPI', 'it', 'canSetSearchEngine', 'encode', '1234567890', '"function log() {\\n [native code]\\n}"', 'candidate', 'MSPointerEvent', 'screenTop', 'n', 'prototype', 'complete', 'getOwnPropertyDescriptor', '_minBufferSize', 'Lucida Sans Unicode', 'R', 'Ebdl', 'webkitPerformance', 'channelCountMode', 'zPHda1EGjlPIiY7Ae4UDbpfj', 'resolve', 'blackberry', 'cqhk', 'precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}', 'getElementsByName', '&', 'J', '[object SafariRemoteNotification]', 'cub', 'lib', 'https://fptest.fraudmetrix.cn/partnerDetect.json', 'iceServers', '/', 'queryUsageAndQuota', 'iUrl', 'CipherParams', 'zVzcaQELjCrRYy7FeyUoJg', 'offsetWidth', 'Alipay', 'Object', '_fmOpt.token is blank, please set the value of _fmOpt.token and try again!', 'LAjt', 'Segoe UI', 'webkitTemporaryStorage', 'not a function', 'micromessage', 'MJxC', 'slice', 'Lucida Bright', 'join', 'os', 'event', 'fp.fraudmetrix.cn:9090', 'unload', 'getElementsByTagName', 'remove', 'ejmK', 'ARRAY_BUFFER', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', 'min', 'body', 'Bitstream Vera Sans Mono', 'toLocaleLowerCase', '/FreshCookieRequest/fresh.json', 'battery', '/fp/detect.json', 'partnerFpUrl', 'height', 'onreadystatechange', 'check', ']', 'change', 'MD5', '1', 'Opera', 'onunload', 't', 'toGMTString', 'caller', 'Microsoft Sans Serif', '_Selenium_IDE_Recorder', 'https:', 'reverse', 'Mozilla', 'U', 'onRejected', 'hPHjIXEGjuhiHP7aMr', 'msPerformance', 'zPHvawEejqPqY371eQUeJE', 'X', 'Trident', 'forEach', 'concat', 'isGecko', 'webkitIndexedDB', '__IE_DEVTOOLBAR_CONSOLE_COMMAND_LINE', 'Hasher', 'miniprogram', 'hSHlIwEejUQFGyp2MrUeJqfj', 'readyState', 'numItems', 'targetTouches', 'zbHpIXEhRthLGZ7AoNUeb6xgh1zwIXEGjlhFG3', 'ub', '_immediateFn', '72px', '~/=', 'keywords', 'itemSize', 'allSettled', 'Arial Unicode MS', '__defineGetter__', 'Impact', 'Gecko', 'createObjectStore', 'zPHda1EGjlPIi37b', '_t41', 'touchend', 'openDatabase', 'vertexPosArray', 'boolean', 'Lucida Sans Typewriter', 'Q', 'zVzcaQELjCQqY37bMQUo', 'hPzQanwhjOPRiyplMaUeJq', 'Courier', 'createDataChannel', 'mediaDevices', 'linux', '_fmdata', 'm', 'DHDD', '_selenium', '_rBlock', '_fmaa', 'partnerCode', '_prevBlock', 'attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}', 'WINNDOWS', 'Uburl', 'createAnalyser', 'h0HLaXEFjCQHYK7blz', 'Promise.all accepts an array', 'userAgent:', 'stringify', 'window', '0', 'mtgC', 'crios', 'zEwr', 'opera', 'mmmmmmmmmmlli', 'contains', 'numberOfOutputs', 'CHROMEOS', 'jmks', 'dischargingTime', 'abcdefghigklmn', 'mkcK', 'onmessage', 'none', 'isSafari', 'z', 'head', 'https://fptest.fraudmetrix.cn/partnerProfile.json', 'oyo', '; domain=', 'z1zmaWOLRm', 'createProgram', '&h=', 'https://fp.fraudmetrix.cn', 'defineProperty', '00000000', 'getImageData', 'Arial Hebrew', 'referrer', '_ENC_XFORM_MODE', 'Palatino Linotype', '-9999px', 'attrVertex', 'createEvent', 'mouseup', 'Firefox', 'decode', 'SILK', 'android', 'r', 'contentWindow', 'Malformed UTF-8 data', 'Edge', 'HpMx', 'Courier New', 'Consolas', 'tdIframe', 'mozIndexedDB', 'shift', 'isWebkit', 'T', 'location', '_deferreds', 'd', 'canvas', 'TEMPORARY', '&partnerCode=', 'estimate', '(iPhone|iPod|iPad)(?!.*Safari/)', '^^', 'bindBuffer', 'p', 'Mac OS', 'partner', 'format', 'experimental-webgl', 'uwCb', 'values', 'fillText', '\\', 'BlockCipherMode', 'Possible Unhandled Promise Rejection:', 'WINDOWSPHONE', 'top', 'InstallTrigger', 'uniformOffset', 'numberOfInputs', 'compute', 'bada', '` to object', 'then', 'webkitRequestFileSystem', 'apply', '.', 'htHdIwEFjzhiGMqYMQCpbKx9z0', '"function log() { [native code] }"', 'pTimeout', 'open', 'keyup', 'appendChild', 'durations', 'isIE', 'useProgram', 'key', 'z6HCanEGRVQqY37bMQUo', 'move', 'promise', 'http://fp.fraudmetrix.cn', 'textBaseline', 'userData', 'i init ok', 'random', 'fpWebDB', 'page:', 's38huiupo1g', 'abcdefghjiklmnopqrstuvwxyz', 'filename', 'MS Sans Serif', 'Promise.race accepts an array', 'UC', 'v', 'imgLoaded', ')', '12345678', 'attachShader', 'frameElement', 'drawArrays', 'PvtK', 'ErdG', 'getContext', 'success', 'y', 'MS Serif', 'race', 'phantomjs', 'orientation', '_fmOpt', 'e', 'Y', 'H', 'windows', 'webgl', 'downkey', 'PbrD', 'device_type', 'mousedown', 'zSHLIDELjIhriK7AeLUeJqfN', 'PkAF', 'undefined', '_state', 'LIEBAO', 'blackBoxType', '\n', 'CrOS', 'title', 'fromCharCode', 'TRIANGLE_STRIP', 'I', 'usage', '=; domain=', 'reject', 'Promises must be constructed via new', 'deviceInfo', '&sdkName=cn.tongdun.web', 'ucapi', 'ongestureend', 'onupgradeneeded', 'opr', 'ethernet', 'unpad', '_key', '_x64Fmix', 'pushNotification', 'VERTEX_SHADER', 'mozBattery', 'Arial Rounded MT Bold', 'enumerateDevices', 'loaded', 'HMAC', 'keyPath', 'zVzDIoO7jOhDYy', '_nDataBytes', 'rimtablet', 'MOZILLA', 'WebView', 'setLocalDescription', 'zVzLaNELjKQFGPple4U5bE', 'h1zjawwrtChLYp79MzUibExI', 'firefox', 'init', 'sans-serif', 'gbCC', 'sessionStorage', 'TouchEvent', 'desktop', 'PasswordBasedCipher', 'fillStyle', 'Constructor', 'message', 'createOffer', 'fpHost', 'rtcAvailable', 'f736mgcni9c', 'touchpad', 'zcHpINwhjuPSG3', 'RGBA', 'getCookie', 'unable to locate global object', 'htHdIwEFjzhiGM', 'href', 'alphabetic', 'msIndexedDB', 'UNSIGNED_BYTE', 'words', 'innerHTML', 'platform', 'standalone', 'BufferedBlockAlgorithm', 'addons', 'GECKO', 'decryptBlock', 'substr', 'Wingdings 3', 'reason', 'cfg', 'mod', ' ', 'zRzLINEGRVrRYy7FeyUoJg', 'channelInterpretation', 'SAFARI', 'LUCIDA GRANDE', 'now', 'cookie', 'private', 'firstChild', 'o8gm8qu97as', 'url', 'text-rendering', 'SerializableCipher', 'postMessage', 'fpflash.fraudmetrix.cn', 'HTMLElement', 'catch', 'webkitBattery', 'timer', '; path=/', 'finally', 'DeviceMotionEvent', 'sandbox', '&productType=2', 'tokens', 'dingtalk', '__nightmare', 'web', 'serif', 'upkey', 'function', 'initStorage', 'base64_map', 'Cambria Math', 'warn', 'Times New Roman', 'screenY', '_mode', 'paramz', 'SyntaxError', 'fpCache', 'can\'t find _fmOpt', 'bufferData', 'Trebuchet MS', 'itsgonnafail', 'B', 'keyCode', 'Arial Narrow', 'constructor', '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 'CBC', 'safari', 'Comic Sans', 'reduce', 's', 'isOpera', 'ua', 'performance', 'Book Antiqua', 'removeItem', 'push', 'algo', 'objectStore', 'https://', 'data', 'cookieEnabled', 'UCNewsJSController', 'attachEvent', 'mozilla', 'Andale Mono', 'removeHandler', 'fp.fraudmetrix.cn', 'device_name', 'blackBox', '0.0.0.0', 'DOLFIN', 'resize', 'V', '_subKeys', 'h77umrlknir', '?period=switchDomain&cookie=', 'fl', 'channelCount', 'zufs', 'checkStatus', 'fmTest', 'drawImage', 'no token returned', 'b', 'htHdaQwhjBhHGZ7W', 'reliable', 'hSHQaIEGRIPIYS7WMr', 'description', 'Monotype Corsiva', 'console', 'Century Gothic', 'destination', 'rgba(102, 204, 0, 0.7)', 'isPrototypeOf', 'getinfo', 'charCodeAt', 'Helvetica', 'click', 'max', 'rtcFinished', 'hostname', '.yourip.cn/fp/proxy2.html', 'Promise', 'hbRmawwXjzhFYyHFeQ', 'ceil', '_hash', 'phantomas', 'Monaco', 'callee', 'PointerEvent', 'Arial', 'i', 'cbur', 'jsonFreshUrl', 'uCMl', '_bbx', 'i.html', 'zSHlknEgRLQIGZ7eeNUA', 'Bookman Old Style', 'facebookexternalhit', 'lineHeight', 'Segoe Script', 'jmty', 'OfflineAudioContext', '; expires=Thu, 01-Jan-70 00:00:01 GMT;', 'isChrome', 'wm', 'tao', 'rv:11.0', 'setItem', 'zPHpanwXjOPFiy7WMrCfJKgjzRRmaQwhjOQrHZHS', 'zSHLIDELjIhrHq7FMZUEbXgtzVzma1Eg', 'bingpreview', 'https://static.tongdun.net/v3/', '&errorMsg=', 'TAOBAO', 'zPzDIwOejChLGMpY', '&sdkVersion=', 'isUC', 'fillRect', 'MS Outlook', 'Decryptor', 'Segoe UI Semibold', 'sampleRate', 'MYRIAD PRO', 'RequestFileSystem']
13 |
14 | # 混淆后的 JS
15 | with open("fm_old.js", "r", encoding="utf-8") as f:
16 | js_lines = f.readlines()
17 |
18 | js = ""
19 | for j in js_lines:
20 | js += j
21 |
22 | for i in item:
23 | # Qo00o 需要根据你 fm_old.js 具体的字符串进行替换
24 | str_old = "Qo00o[{}]".format(item.index(i))
25 | js = js.replace(str_old, '"' + i + '"')
26 |
27 | # 还原后的 JS
28 | with open("fm_new.js", "w", encoding="utf-8") as f:
29 | f.write(js)
30 |
--------------------------------------------------------------------------------
/m_wcbchina_com/wcbchina_encrypt.js:
--------------------------------------------------------------------------------
1 | /*
2 | # ==================================
3 | # --*-- coding: utf-8 --*--
4 | # @Time : 2021-10-12
5 | # @Author : 微信公众号:K哥爬虫
6 | # @FileName: wcbchina_encrypt.js
7 | # @Software: PyCharm
8 | # ==================================
9 | */
10 |
11 | function c(x, c) {
12 | x[c >> 5] |= 128 << c % 32,
13 | x[(c + 64 >>> 9 << 4) + 14] = c;
14 | for (var a = 1732584193, _ = -271733879, y = -1732584194, d = 271733878, i = 0; i < x.length; i += 16) {
15 | var b = a
16 | , B = _
17 | , D = y
18 | , E = d;
19 | a = h(a, _, y, d, x[i + 0], 7, -680876936),
20 | d = h(d, a, _, y, x[i + 1], 12, -389564586),
21 | y = h(y, d, a, _, x[i + 2], 17, 606105819),
22 | _ = h(_, y, d, a, x[i + 3], 22, -1044525330),
23 | a = h(a, _, y, d, x[i + 4], 7, -176418897),
24 | d = h(d, a, _, y, x[i + 5], 12, 1200080426),
25 | y = h(y, d, a, _, x[i + 6], 17, -1473231341),
26 | _ = h(_, y, d, a, x[i + 7], 22, -45705983),
27 | a = h(a, _, y, d, x[i + 8], 7, 1770035416),
28 | d = h(d, a, _, y, x[i + 9], 12, -1958414417),
29 | y = h(y, d, a, _, x[i + 10], 17, -42063),
30 | _ = h(_, y, d, a, x[i + 11], 22, -1990404162),
31 | a = h(a, _, y, d, x[i + 12], 7, 1804603682),
32 | d = h(d, a, _, y, x[i + 13], 12, -40341101),
33 | y = h(y, d, a, _, x[i + 14], 17, -1502002290),
34 | _ = h(_, y, d, a, x[i + 15], 22, 1236535329),
35 | a = g(a, _, y, d, x[i + 1], 5, -165796510),
36 | d = g(d, a, _, y, x[i + 6], 9, -1069501632),
37 | y = g(y, d, a, _, x[i + 11], 14, 643717713),
38 | _ = g(_, y, d, a, x[i + 0], 20, -373897302),
39 | a = g(a, _, y, d, x[i + 5], 5, -701558691),
40 | d = g(d, a, _, y, x[i + 10], 9, 38016083),
41 | y = g(y, d, a, _, x[i + 15], 14, -660478335),
42 | _ = g(_, y, d, a, x[i + 4], 20, -405537848),
43 | a = g(a, _, y, d, x[i + 9], 5, 568446438),
44 | d = g(d, a, _, y, x[i + 14], 9, -1019803690),
45 | y = g(y, d, a, _, x[i + 3], 14, -187363961),
46 | _ = g(_, y, d, a, x[i + 8], 20, 1163531501),
47 | a = g(a, _, y, d, x[i + 13], 5, -1444681467),
48 | d = g(d, a, _, y, x[i + 2], 9, -51403784),
49 | y = g(y, d, a, _, x[i + 7], 14, 1735328473),
50 | _ = g(_, y, d, a, x[i + 12], 20, -1926607734),
51 | a = v(a, _, y, d, x[i + 5], 4, -378558),
52 | d = v(d, a, _, y, x[i + 8], 11, -2022574463),
53 | y = v(y, d, a, _, x[i + 11], 16, 1839030562),
54 | _ = v(_, y, d, a, x[i + 14], 23, -35309556),
55 | a = v(a, _, y, d, x[i + 1], 4, -1530992060),
56 | d = v(d, a, _, y, x[i + 4], 11, 1272893353),
57 | y = v(y, d, a, _, x[i + 7], 16, -155497632),
58 | _ = v(_, y, d, a, x[i + 10], 23, -1094730640),
59 | a = v(a, _, y, d, x[i + 13], 4, 681279174),
60 | d = v(d, a, _, y, x[i + 0], 11, -358537222),
61 | y = v(y, d, a, _, x[i + 3], 16, -722521979),
62 | _ = v(_, y, d, a, x[i + 6], 23, 76029189),
63 | a = v(a, _, y, d, x[i + 9], 4, -640364487),
64 | d = v(d, a, _, y, x[i + 12], 11, -421815835),
65 | y = v(y, d, a, _, x[i + 15], 16, 530742520),
66 | _ = v(_, y, d, a, x[i + 2], 23, -995338651),
67 | a = A(a, _, y, d, x[i + 0], 6, -198630844),
68 | d = A(d, a, _, y, x[i + 7], 10, 1126891415),
69 | y = A(y, d, a, _, x[i + 14], 15, -1416354905),
70 | _ = A(_, y, d, a, x[i + 5], 21, -57434055),
71 | a = A(a, _, y, d, x[i + 12], 6, 1700485571),
72 | d = A(d, a, _, y, x[i + 3], 10, -1894986606),
73 | y = A(y, d, a, _, x[i + 10], 15, -1051523),
74 | _ = A(_, y, d, a, x[i + 1], 21, -2054922799),
75 | a = A(a, _, y, d, x[i + 8], 6, 1873313359),
76 | d = A(d, a, _, y, x[i + 15], 10, -30611744),
77 | y = A(y, d, a, _, x[i + 6], 15, -1560198380),
78 | _ = A(_, y, d, a, x[i + 13], 21, 1309151649),
79 | a = A(a, _, y, d, x[i + 4], 6, -145523070),
80 | d = A(d, a, _, y, x[i + 11], 10, -1120210379),
81 | y = A(y, d, a, _, x[i + 2], 15, 718787259),
82 | _ = A(_, y, d, a, x[i + 9], 21, -343485551),
83 | a = C(a, b),
84 | _ = C(_, B),
85 | y = C(y, D),
86 | d = C(d, E)
87 | }
88 | return Array(a, _, y, d)
89 | }
90 |
91 | function a(q, c, a, x, s, t) {
92 | return C(y(C(C(c, q), C(x, t)), s), a)
93 | }
94 |
95 | function h(c, h, g, d, x, s, t) {
96 | return a(h & g | ~h & d, c, h, x, s, t)
97 | }
98 |
99 | function g(c, h, g, d, x, s, t) {
100 | return a(h & d | g & ~d, c, h, x, s, t)
101 | }
102 |
103 | function v(c, h, g, d, x, s, t) {
104 | return a(h ^ g ^ d, c, h, x, s, t)
105 | }
106 |
107 | function A(c, h, g, d, x, s, t) {
108 | return a(g ^ (h | ~d), c, h, x, s, t)
109 | }
110 |
111 | function _(a, h) {
112 | var g = b(a);
113 | g.length > 16 && (g = c(g, a.length * U));
114 | for (var v = Array(16), A = Array(16), i = 0; 16 > i; i++)
115 | v[i] = 909522486 ^ g[i],
116 | A[i] = 1549556828 ^ g[i];
117 | var _ = c(v.concat(b(h)), 512 + h.length * U);
118 | return c(A.concat(_), 640)
119 | }
120 |
121 | function C(x, c) {
122 | var a = (65535 & x) + (65535 & c)
123 | , h = (x >> 16) + (c >> 16) + (a >> 16);
124 | return h << 16 | 65535 & a
125 | }
126 |
127 | function y(c, a) {
128 | return c << a | c >>> 32 - a
129 | }
130 |
131 | function b(c) {
132 | for (var a = Array(), h = (1 << U) - 1, i = 0; i < c.length * U; i += U)
133 | a[i >> 5] |= (c.charCodeAt(i / U) & h) << i % 32;
134 | return a
135 | }
136 |
137 | function B(c) {
138 | for (var a = "", h = (1 << U) - 1, i = 0; i < 32 * c.length; i += U)
139 | a += String.fromCharCode(c[i >> 5] >>> i % 32 & h);
140 | return a
141 | }
142 |
143 | function D(c) {
144 | for (var a = F ? "0123456789ABCDEF" : "0123456789abcdef", h = "", i = 0; i < 4 * c.length; i++)
145 | h += a.charAt(c[i >> 2] >> i % 4 * 8 + 4 & 15) + a.charAt(c[i >> 2] >> i % 4 * 8 & 15);
146 | return h
147 | }
148 |
149 | function E(c) {
150 | for (var a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", h = "", i = 0; i < 4 * c.length; i += 3)
151 | for (var g = (c[i >> 2] >> 8 * (i % 4) & 255) << 16 | (c[i + 1 >> 2] >> 8 * ((i + 1) % 4) & 255) << 8 | c[i + 2 >> 2] >> 8 * ((i + 2) % 4) & 255, v = 0; 4 > v; v++)
152 | h += 8 * i + 6 * v > 32 * c.length ? S : a.charAt(g >> 6 * (3 - v) & 63);
153 | return h
154 | }
155 |
156 | var F = 0
157 | , S = ""
158 | , U = 8
159 | , j = {
160 | hex_md5: function (s) {
161 | return D(c(b(s), s.length * U)).toUpperCase()
162 | },
163 | b64_md5: function (s) {
164 | return E(c(b(s), s.length * U))
165 | },
166 | str_md5: function (s) {
167 | return B(c(b(s), s.length * U))
168 | },
169 | hex_hmac_md5: function (c, a) {
170 | return D(_(c, a))
171 | },
172 | b64_hmac_md5: function (c, a) {
173 | return E(_(c, a))
174 | },
175 | str_hmac_md5: function (c, a) {
176 | return B(_(c, a))
177 | }
178 | };
179 |
180 | function getSign(){
181 | var c = (new Date).getTime();
182 | var N = j.hex_md5(c).toUpperCase();
183 | return N
184 | }
185 |
186 | function getEncryptedPassword(password) {
187 | return j.hex_md5(password)
188 | }
189 |
190 | // 测试样例
191 | // console.log(getEncryptedPassword("12345678"))
192 | // console.log(getSign())
193 |
194 |
--------------------------------------------------------------------------------
/m_wcbchina_com/wcbchina_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-10-12
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: wcbchina_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 | import random
12 | import hashlib
13 |
14 | import execjs
15 | import requests
16 |
17 |
18 | login_url = 'https://m.wcbchina.com/api/login/login'
19 |
20 |
21 | def get_enpwd_and_sign_by_javascript(password):
22 | with open('wcbchina_encrypt.js', 'r', encoding='utf-8') as f:
23 | encrypt_js = execjs.compile(f.read())
24 | encrypted_password = encrypt_js.call('getEncryptedPassword', password)
25 | sign = encrypt_js.call('getSign')
26 | return encrypted_password, sign
27 |
28 |
29 | def get_enpwd_and_sign_by_python(password):
30 | timestamp = str(int(time.time() * 1000))
31 | encrypted_password = hashlib.md5(password.encode('utf-8')).hexdigest().upper()
32 | sign = hashlib.md5(timestamp.encode('utf-8')).hexdigest().upper()
33 | return encrypted_password, sign
34 |
35 |
36 | def get_rnd():
37 | rnd = 'rnd' + str(random.uniform(0, 1))
38 | return rnd
39 |
40 |
41 | def login(username, encrypted_password, sign, rnd):
42 | headers = {
43 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
44 | }
45 | json = {
46 | "auth": {
47 | "timestamp": str(int(time.time() * 1000)),
48 | "sign": sign
49 | },
50 | "username": username,
51 | "password": encrypted_password
52 | }
53 | response = requests.post(url=login_url, params=rnd, json=json, headers=headers)
54 | print(response.json())
55 |
56 |
57 | def main():
58 | username = input('请输入登录账号: ')
59 | password = input('请输入登录密码: ')
60 | # 通过 JavaScript 代码获取加密后的密码和 sign
61 | encrypted_password, sign = get_enpwd_and_sign_by_javascript(password)
62 | # 通过 Python 代码获取加密后的密码和 sign
63 | # encrypted_password, sign = get_enpwd_and_sign_by_python(password)
64 | rnd = get_rnd()
65 | login(username, encrypted_password, sign, rnd)
66 |
67 |
68 | if __name__ == '__main__':
69 | main()
70 |
--------------------------------------------------------------------------------
/max_pedata_cn/main.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-12-31
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: main.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 | news_est_url = "https://max.pedata.cn/api/q4x/newsflash/list"
14 | login_token = "1796a48fa1968edd5xxxxxxxxxxxxxxxxxxxxxxxxxxxx" # token 换成你自己的
15 | headers = {
16 | "Accept": "application/json, text/plain, */*",
17 | "Content-Type": "application/json",
18 | "Host": "max.pedata.cn",
19 | "HTTP-X-TOKEN": login_token,
20 | "Origin": "https://max.pedata.cn",
21 | "Referer": "https://max.pedata.cn/client/news/newsflash",
22 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
23 | }
24 |
25 |
26 | def get_decrypted_data(encrypted_data, exor):
27 | with open('pedata_decrypt.js', 'r', encoding='utf-8') as f:
28 | pedata_js = f.read()
29 | decrypted_data = execjs.compile(pedata_js).call('getDecryptedData', encrypted_data, exor, login_token)
30 | return decrypted_data
31 |
32 |
33 | def get_encrypted_data():
34 | data = {
35 | "type": "",
36 | "module": "LP",
37 | "page":
38 | {
39 | "currentPage": 1,
40 | "pageSize": 10
41 | }
42 | }
43 | response = requests.post(url=news_est_url, headers=headers, json=data).json()
44 | encrypted_data, exor = response["data"], response["exor"]
45 | return encrypted_data, exor
46 |
47 |
48 | def main():
49 | encrypted_data, exor = get_encrypted_data()
50 | decrypted_data = get_decrypted_data(encrypted_data, exor)
51 | print(decrypted_data)
52 |
53 |
54 | if __name__ == '__main__':
55 | main()
56 |
--------------------------------------------------------------------------------
/max_pedata_cn/pedata_decrypt.js:
--------------------------------------------------------------------------------
1 | /* ==================================
2 | # @Time : 2021-12-31
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: pedata_decrypt.js
5 | # @Software: PyCharm
6 | # ================================== */
7 |
8 | var zlib = require('zlib');
9 |
10 | function L(e, t) {
11 | if ("1" == t)
12 | return [7, 65, 75, 31, 71, 101, 57, 0];
13 | for (var n = [], a = 0, r = t.length; a < r; a += 2)
14 | n.push(e.substr(1 * t.substr(a, 2), 1).charCodeAt());
15 | return n
16 | }
17 |
18 | function Y(e, t) {
19 | for (var n, a = new Uint8Array(e.length), r = 0, c = e.length; r < c; r++)
20 | n = t[r % t.length],
21 | a[r] = e[r].charCodeAt() ^ n;
22 | return a
23 | }
24 |
25 | function B(e) {
26 | var t, n, a, r, c, u, i, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", s = "", f = 0;
27 | e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
28 | while (f < e.length)
29 | r = o.indexOf(e.charAt(f++)),
30 | c = o.indexOf(e.charAt(f++)),
31 | u = o.indexOf(e.charAt(f++)),
32 | i = o.indexOf(e.charAt(f++)),
33 | t = r << 2 | c >> 4,
34 | n = (15 & c) << 4 | u >> 2,
35 | a = (3 & u) << 6 | i,
36 | s += String.fromCharCode(t),
37 | 64 != u && (s += String.fromCharCode(n)),
38 | 64 != i && (s += String.fromCharCode(a));
39 | return s
40 | }
41 |
42 | function getDecryptedData(encryptedData, exor, loginToken) {
43 | var a = L(loginToken, exor);
44 | var r = Y(B(encryptedData), a)
45 | var decryptedData = zlib.gunzipSync(r).toString();
46 | return decryptedData
47 | }
48 |
49 | // 测试样例
50 | // var encryptedData = "L7JsMjA2YmMwOYlua2V5KqbHTzYhJdN4U5repboBzQSW7lfvAbiMHuvR/BqlfNS/aEElhuvlsXIyGkC2IFYR9DC63fonEgoA4LyvTdlnBDYNwEv+CaMgTRTt6Y+OwwwkyJjOpknE/vCp5p38+fK9FCo6GU9WEhg+j1gSRHuhWK7fmxlUz3Yt14MCVuLjRcvQhxYMxEVAFRVu09gxvYhonC0jlu6V+LEFz8QZlQ4m37q7tFrdNVefs+TR6XZxGh5B5cS+U/mv7bj1k/cqhwFlity3V2UV01/5S38XA4KIB84OjtKUWBwUjspmjeB2m1CR/+E0nyQV7RSs0KPW0c7JoARgK6K5DwmauaxJarv1BgW018qBbkKZUgmlxNsRXVYue/w+V624pCMy5DqV/2EjRamh1mXjg4ginW11icwEVkHBwlpJWCNn2A/jP/EEiUjIbZM4mayGZJvTWKj4/uEoSoqmg4lU0xWTPU1iIXhf6qc+1JkKH0c+wDu1LmQa4KhoqqPVbT4NkUx5mCgU48KzIp1r1EC35t016h+9EYuOiqcm0LhunQJkleC6ZwCpMt8KXq1AxdlCuzpKO8au9OJdALPdHKDeECJD/QSj5dyn964K4HWgbbU1N98crJ2gtW/ZYIiLLeUcOdbiG7eTETL5ji4MHrMgzADkfF8tUyRo/641CeULpFLV0nEQCVeCllEftG4IToB6BXBEFyrQiyxLj0t00VFBBGPwpnhzShYxbtW78rLGepvwAlO5mRI1kP8PX7uBAv/Y4NpD1itPjYEDpgBAsn4qCGWgzU4exkvJd909ksph0DKcUR9lcss++L1OueR4NV1W/+aTzp4pG6dPNZNOROBo8iNems4jx9g21oFJz3qPRzEGacDvt0mTIViakk6aFMCqSkss1odOmv6ZVqEO8JJYfkM64AwpAiTvkhCSJzZHT+H/qz0hQ5DvAO9rHk2rluSJ+XKWcgvtvUbS0GtqQHMhGReVB8MQ5G94eSXFIgz15862FPNVjA3gWcLj/vd7HI0VeTZ+yZUMedZ3LTo88JIRf+R/5HU5ZnwLAmW0mfuhiZg5FP7jjKvogFQJus+FX9Tj5O5XLZJerMV3hUnJYZXCqazXuAchx/MMMXah7mh7Z05dBDY8R5LYN/xouau2Dh3o/75eYyB3pAnI7m682WriUDhbpargvZAHzWnXdm/VozZzb20zYL6wGucbDRn9WLCh2/OSIhbyPKjhaz290bmzEjvhuGrPLDHyWWijHZqufKK4Ox/BIXvCLI325f917UewQ4/ynr/IR6GTksKUFJaf4bdqtTN0hkv6Da6uUlwwK8FI1bfJBB2/4VeaU3p3Bd5FepWhGAQVTN+J3lUjtQH+ignlX+XIjc3GUbDBDLeRYyIGqh/zVPrd6IIjPxuf1eenPW90YuWs14xHzWtttdrut1ygzAV4yzasvu921pBFy0pzkF5Gsy8DnuUY3kx9Iy9Ah2av3fN2D+m3HAND3zVtIuzZ0w0GuRDrjpt3PqcBUD56ie25qrkeNxoWqLzttze+i4vK7WjpbUOg8qydrwvL3lsq/4uUWH8o878+zUYV/96Ke3l19K8ZBFfsIQAdUJ9YQgww69S0oeZ8maFVqHAfYq4+RKQsTsalFtPoYdDfyGKh4We+rVlPThfbaI450kjXt4IYFrRuYtKLvzaq49PHUmg9YbicPi1KYGlomit6ETs0a/z7z8RhNzRj+Lwy5MQY0fsUiiQQrINzG0ZQq8F2BdBQUnSDE5Jtt06bgykBSc1GKL4yKIRlKwRnNOWHQJg8mKpt17oE2P4+8qRm9Lst0mPkwx0RsN39mUeuTvLkeNzzcGuQ8eRbk8XDPMHr9IbePLaucb/RdSLgj1G2MGBGR6QaOnVKd+Yh05J4NyMNLT32Qj8+9QbyIoVJ8NDkwaExCwQKf8I5eCKlaPAAiZ/3mNV12EW12RqGc3QlKTI3TP1+BK8d/NnO1ZXMrQv9Q4XpQUBBC1Y85KXXBj0UNBDJOvYDvUgw/SjmrhkGP2q3WaIjZ8pC2rokLjo1xvE9uvMK8hsitJSKoA/tT78IO4wtuXCe36wjN0R3gVZp6xF8prTEykO7oJuaEmXbsP0N1ZLQi4FbKqgG9RkcZy4c0nQ2eJOSqjbGhhEwW3aSeSw4yE+vDPqjyPpWdjRWYzFRqfhQfFUAEPtyLLIPOK9o4hyPLnwDzvciNd9k2BNEsSRaiFH8ZTeIKUJQTYvgNj4l1x8uflM7qd8X2Rvg4JqNYrU71wFICIfiQ4bTrAHIIJCEP7wsD/JjW1QI+xsSKrlqRQv1q8oM8ALf5YrXPXFpLjPsE6oirpWLb8nUbdbav4x0F91a4DET+jVSVw+H2c3aj4db3a9quktbXD+DckLYnbX+7NI+aDy0FIkK/6wwh0SAcOA+ulRPhiL3wQmGAQtevB2lbdNfDOFSNslIUKBNt3U5bvv7kRu+nYgv2CTRZXpWMo/j/y2/5C7/GGDpHcdw+ek9JbXAByl85ZytYvJZbJ0OQwrmAUmI/jEP/ABpCXkfo/JqmdVRwOxJUfOFrqdmwjK6ZVNc3KNypakAKBS6UTeuNd0hF8l2lO31cS6Oe2QPRSERLaPqPG1bXaVNXolimtfsUCWBwVqv6fcCYinFrU8mYDrp793p4bl1kfreqXxp6R/J03pKcYgMugh3+08VuzVmUFI7T/dQKtssLa78FXJAPuTcMNvmyD523i4i7JR/Cw40Gt66gH2fiVIeiUqxt9kNPTLmxEdUlnsL/d4OJogZRd7K22s05c0XITBEd4BHAZYhY1l3l5xMzye43HeHts+rCz3MbGDf0s5ph2xS441H2byOiixSXbfDKvThQr+Vx3OhJb/QNwZ1Y1rNmzDkQ+P0zFttV7pP+0BLYD4/BT/UlGnocKWMxEo13r0wqcnJ6+Ayui5l0LQHT76mHtEFcx4hYSE3IecOXosCzJbSEXmQuMeYhXqEqxkyxSm11ygLP8HT5YiOIXizQpin6qcheqweW1AXXR8zEjAb0jOBi9ZOUlqMnK9lK/hyuDlLuLRHgHeAZNTZI4KzhxcEhXv2fX6F6FcMYv02aXy2KSWHL6dPsSdVZxCMdhaR0gsoRqXACDBSwxakWoSuCSVodvJUPNQSVpCwd3NbSqZv6zXzoKZvoDv3c27eja6nYZHbm1L7VCSp1It6hKy2dhmMsAdb1BFhDSsRyDnz/53i5YX6JbqiWBDWeWsdpCZ3RYtdbFI3j5y2KTkL/TVDMnUhaVwQIpDklxOlrdIzsdf7NWcitaKWJUYyUZLE4yh6yH7VKc+BS2AXZexSgW2g21sRxCnmFAgvw7udk7bbGm9gB26TAyTQjovhbSWjjlBBZF47e/Ik4Xun0TVozIJ4UUSLwPM9aobBtI/xUGzXj7KuDGef2Crmp5cSCo4tPC/nv3bQqpvLJ9bw/CLB0X07ch1LlNJFd9az8qe5k8q6mpdnd27ZAGfm87R5J5dpAK5PP8lYfyVnYPMty74+UpiMnJLxVL9QcyJ7TMMbS0QaOox4t8y7BoTobuOOqprX14YGTamvacSHxuDiTON+415eCIzZi6Gurakn0Vzsxg9i5binq/ka8s6PGR+sNkSNv7JIuelsRtDlyJCpZ0NWk3T8TU6T52pLoycyM4PNhaz5/ef99br5r20nhjwCNEHZ22mK9WeHE1OEMvfJYDIsLVfZeKsZDDHl6U5PIqSCGYfV08nZTprsKqSssxiF/vFbCb6V7fHm9WL5J24XpavupwpI2NXWs2it4cIRLiN2cIUDQDr0b/F5GKXsquUByfE3vfOsvwcm+3UJ2V62j5xV8hwk/15FJUHGZQ63Aj0bJvc1WUp/rNBIxen1CDoCbfGKHERXfYpohTKfghf+tlNeqh+mT2+QpJRwZIb0m3m5uj1tbomQmBvu9O/UxEY+hV+D+tAwy38AvgULW1NnGmZfaUL0uKdSwP+TE9bt8XhohC8z/7UGGiFLWJ0E1lG1gzxY3UV5WP73IP7rko8TC/+TBXKh/q5reFln5+Pl63fYOTv6XjpPTJw7N0be0f/ajIxZ2P36iidjwxHjAixN3rM1yH+5f5PqKl1hmDqvIOOnu2UREJ9gfDygwvK7SM+WBMtGuYB7E+rXxbir0qQlqxdEkEKZY++cOeZXcTNBZYlKUf7mdiekN+kDHk3aSnXtTC7aJ96JG8kgecXufpXxNrCjIlPHC/W87lyAwNL8xSd2QKXtvrsQ3xih7lL4tA4pgPxQkl2mNuiiGZ7nEPlVUAUDWzBw3+e0CnVwZJ3/8xWr1Usxocj5GZTazw1HylvPKw6p+r24CfJfdOymAL1/PNgombTZCDyO3cNYKEzbUipjANvlU+jDXAasazqWl4DqmB3NoJlc2Ms4eF0q1EI8MXOUo+fuZrft2RPWno4NDEB5LoMEsupP3/1QxxiGIvY4ibhzeX89+4T1TmiWHTefbvojefL6q6dyiqIc/21cx1879/yJl1HPtghgrOWazU53g8rBCDyggDWVcaJhlE464MzgwRF8azL+2UPZ/YxKx4rs6R0EXwu+oJODsD5jr3/N4Zg1lnxY22KiUujDq7WOY4FHovV+3nwuMwSlwmybuuZTn3lPCVB1BMDaIONpTCYAa53UvrdL5xaM6jDvsObsBrs+N364S3AUPzQ3fFI06WXLFixTvRBt/2y1ijyxCH8u0cSwY2eYPZy1Mav735SkiTWYxCviMRjBTzLiyehkgB+Rmc3YcXtoS3J5tjf1mWnCoOZrW4HcbWdyFAN7bqn93Kl9xDigYhkUY2rDvajTVk6FNvbauPT5Rworuzw8ujk+zdjsvDk4ACKNgb3dywAOvcXwWB0Tdsjfvy5dYeZ7N4Y0t4dd7b2cvrMoi197iGM54H5BQEIplYdg4DpqlFXSQsHN5qM/0atNedyVMBWGkOoZi4+UOXb0Qs61oHuRaknu4+CJaFmxdrCu1xywXakuoQ4+T96jWv/jHjanxIZEumXYBoINAw06xOtHDn+fjpssqnd7UeImZWAjndQyaZb3eFM7fy2BMFv+t7Q5mZzhSGzoGG3w/fo8zsStDWmbdAAxG/Q+p5cS2+fFhMkDfCTVUkFKchWck7q2/yk+YMnsM+2+9rRDjDwbhirdYEfrofyzaZWkALFgF+FUfzz4ckVJDVVPjcZRMfRttxytoRy/DaP0AVcV3IE4Gi6/Hp9KRGafuD8w5HjEaykPzH6sOyvPMmDQJahkkLMUnprZHEbZzq1roHnJkH7s5IGcH52xKIdTK6erapszDoAWeNSYWEh3sRVChbotqPMbLurSoyVA1jUblsSdF5GqmRJTbN9X/ToxfjaG/771C1M35Q5XrqagXcw9OlxUTwYeJpYVVLY25KySEygrwGH6C2xCiucXNhWI+cefc+i9I64v1uC//9aHNGHEDUfQseIleYNcBhJ5CBjAJ2ZuvC6ErGe4ZLpVh9tp5FNcMiFanaUmmEutYvbamHCpVmoPVnXOU2yfSjqfIs3SNUIMcDdqC72RtK+XAteCPAegD9xoZWCCftIFcaeYppTIRtYzYd2fW4RoYyiTx7bKNOexL91uEw9X+xYkuGHLeom3HP+bwJm9lWNbGwWoqxCRnPdnYSLIdqCjvD3Ur6FiN2S3HrvQySnnjcS0T+badOgdrlGZzr3jbSKQkwdZEEAHKxkc5bvAA8OjweYSgGa7MFALP/p0whHM7C5mNnPfLpHxGOZeu33NKEtySSt3rAs269viHKnfEYs9HZpYGqoDwHA06qvL7KglxfmjFmh3c5lY17GaTdiddqMsSvEPPzyaF30wvbssvF7WKCNg/192QG9oX2Fkge78ycbPAUaSkhDCI/K09X1gbaqiPGW1G485euI9F8JnRPQMi3TQu0xdayintxqdMIl9wspE5eb35wkpIXwDGjoDOt4YObfiB6qFHfwFD401fG4FizMYssZdT/veElNcLg5KK+0bxqAGjnbIjEYZvnDmQgu3xf5VmdvbxxrL7T8Nw+3BDaUsuSaHvaSZqhx75fE+XfsgDz8yNXd2cDIZq/8ej5jftgFU1+sr+BpN0t0sWT9ffMZH+HU8vWDxxK3ER7nJjuXBOTZXyDc7sR3TRyyoArtirvVdmUhOkRduJZ501nRY5d3oHxzTwzbZXcARGjV/lM/I+bJqHw86loDSNuSdtEFZlErkUuXWiUu/3bDcpa4krYPwG2u10kujbXkOP95fU73AEJ/K58eJmcDjHUSZLE+hUOFc4tqZgVwlJ5alG3eRAXR+K3yCDdNkKfVUrLrp/cdV0APxaV5fq/arHpSU9Ml0vluCrhH2mUCKhSWpH5lz+EETtiSscfWxPU3WIYJSqg6WuM4F8Gf9MOjTwko/TU3AHwdE3auqGlF8iZDRKtYzHL638oSLfNxBAWY23dlKt/cLCDz1BGyRwarStRu93ljq15hOBCOK62V3DxDruOngDlzTgTldP3i2qmBWCrD2IThY2UbqzDRUzZ80hDgWtrhd+dXNfDo8PWQeOudBcFi/IbapweBiMnlWWO6T7L5KlZwNZNahdBKQT70slCbPLVJJskP1l3bM+plcWCY94sWRfdyJ8HNJoJ/TbxpNouxmJjIw"
51 | // var exor = "0446092417571135"
52 | // var loginToken = "99a401435dcb65c4008d3ad22c8cdad0c78c433465528f9a941720fa367c900c"
53 | // console.log(getDecryptedData(encryptedData, exor, loginToken))
54 |
--------------------------------------------------------------------------------
/mps_gov_cn/jsl.js:
--------------------------------------------------------------------------------
1 | var CryptoJS = require('crypto-js');
2 |
3 |
4 | function hash(type, value){
5 | if(type == 'md5'){
6 | return CryptoJS.MD5(value).toString();
7 | }
8 | if(type == 'sha1'){
9 | return CryptoJS.SHA1(value).toString();
10 | }
11 | if(type == 'sha256'){
12 | return CryptoJS.SHA256(value).toString();
13 | }
14 | }
15 |
16 |
17 | var _0x2228a0 = {
18 | "mLZyz" : function(_0x435347, _0x8098d) {
19 | return _0x435347 < _0x8098d;
20 | },
21 | "SsARo" : function(_0x286fd4, _0x10b2a6) {
22 | return _0x286fd4 + _0x10b2a6;
23 | },
24 | "jfMAx" : function(_0x6b4da, _0x19c099) {
25 | return _0x6b4da + _0x19c099;
26 | },
27 | "HWzBW" : function(_0x3b9d7f, _0x232017) {
28 | return _0x3b9d7f + _0x232017;
29 | },
30 | "DRnYs" : function(_0x4573a2, _0x3855be) {
31 | return _0x4573a2 == _0x3855be;
32 | },
33 | "ZJMqu" : function(_0x3af043, _0x1dbbb7) {
34 | return _0x3af043 - _0x1dbbb7;
35 | },
36 | };
37 |
38 |
39 | function cookies(_0x60274b){
40 | var _0x34d7a8 = new Date();
41 | function _0x14e035(_0x56cbce, _0x5e5712) {
42 | var _0x2d0a43 = _0x60274b['chars']['length'];
43 | for (var _0x212ce4 = 0x0; _0x212ce4 < _0x2d0a43; _0x212ce4++) {
44 | for (var _0x8164 = 0x0; _0x2228a0["mLZyz"](_0x8164, _0x2d0a43); _0x8164++) {
45 | var _0x2a7ea9 = _0x5e5712[0] + _0x60274b["chars"]["substr"](_0x212ce4, 1) + _0x60274b["chars"]["substr"](_0x8164, 1) + _0x5e5712[1];
46 | if (_0x2228a0["DRnYs"](hash(_0x60274b['ha'], _0x2a7ea9), _0x56cbce)) {
47 | return [_0x2a7ea9, _0x2228a0["ZJMqu"](new Date(), _0x34d7a8)];
48 | }
49 | }
50 | }
51 | }
52 | var _0x732635 = _0x14e035(_0x60274b['ct'], _0x60274b['bts']);
53 | return {'__jsl_clearance_s' : _0x732635[0]};
54 | }
55 |
--------------------------------------------------------------------------------
/mps_gov_cn/jsl.py:
--------------------------------------------------------------------------------
1 | # =======================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2022/7/27
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: jsl.py
6 | # @Software: PyCharm
7 | # =======================
8 |
9 |
10 | import json
11 | import re
12 | import requests
13 | import execjs
14 |
15 |
16 | cookies = {}
17 | headers = {
18 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
19 | }
20 | url = "https://www.mps.gov.cn/index.html"
21 |
22 |
23 | def get_first_cookie():
24 | global cookies
25 | resp_first = requests.get(url=url, headers=headers)
26 | # 获取 cookie 值 __jsluid_s
27 | cookies.update(resp_first.cookies)
28 | # 获取第一层响应内容, AAEncode 加密
29 | content_first = re.findall('cookie=(.*?);location', resp_first.text)[0]
30 | jsl_clearance_s = execjs.eval(content_first).split(';')[0]
31 | # 获取 cookie 值 __jsl_clearance_s
32 | cookies['__jsl_clearance_s'] = jsl_clearance_s.split("=")[1]
33 |
34 |
35 | def get_second_cookie():
36 | global cookies
37 | # 通过携带 jsluid_s 和 jsl_clearance_s 值的 cookie 获取第二层响应内容
38 | resp_second = requests.get(url=url, headers=headers, cookies=cookies)
39 | # 获取 go 字典参数
40 | go_params = re.findall(';go\((.*?)\)', resp_second.text)[0]
41 | params = json.loads(go_params)
42 | return params
43 |
44 |
45 | def get_third_cookie():
46 | with open('jsl.js', 'r', encoding='utf-8') as f:
47 | jsl_js = f.read()
48 | params = get_second_cookie()
49 | # 传入字典
50 | third_cookie = execjs.compile(jsl_js).call('cookies', params)
51 | cookies.update(third_cookie)
52 |
53 |
54 | def main():
55 | get_first_cookie()
56 | get_third_cookie()
57 | resp_third = requests.get(url=url, headers=headers, cookies=cookies)
58 | resp_third.encoding = 'utf-8'
59 | print(resp_third.text)
60 |
61 |
62 | if __name__ == '__main__':
63 | main()
64 |
--------------------------------------------------------------------------------
/oauth_d_cn/d_cn_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-17
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: d_cn_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | def get_encrypted_password(password):
15 | with open('d_cn_encrypt.js', 'r', encoding='utf-8') as f:
16 | weibo_js = f.read()
17 | encrypted_password = execjs.compile(weibo_js).call('getEncryptedPassword', password)
18 | return encrypted_password
19 |
20 |
21 | def login(encrypted_password, username):
22 | login_url = 'https://oauth.d.cn/auth/login'
23 | headers = {
24 | 'Host': 'oauth.d.cn',
25 | 'Referer': 'https://oauth.d.cn/auth/goLogin.html',
26 | 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
27 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
28 | }
29 | params = {
30 | 'display': 'web',
31 | 'name': username,
32 | 'pwd': encrypted_password,
33 | 'to': 'https%3A%2F%2Fwww.d.cn%2F'
34 | }
35 | response = requests.get(url=login_url, params=params, headers=headers).json()
36 | print(response)
37 |
38 |
39 | def main():
40 | username = input('请输入登录账号: ')
41 | password = input('请输入登录密码: ')
42 | encrypted_password = get_encrypted_password(password)
43 | login(encrypted_password, username)
44 |
45 |
46 | if __name__ == '__main__':
47 | main()
48 |
--------------------------------------------------------------------------------
/passport_fang_com/fang_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-18
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: fang_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import re
11 |
12 | import execjs
13 | import requests
14 |
15 |
16 | index_url = 'https://passport.fang.com/'
17 | login_url = 'https://passport.fang.com/login.api'
18 | user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'
19 | session = requests.session()
20 |
21 |
22 | def get_key_to_encode():
23 | headers = {'User-Agent': user_agent}
24 | response = session.get(url=index_url, headers=headers)
25 | key_to_encode = re.findall(r'RSAKeyPair\((.*)\);', response.text)[0].replace('"', '').split(', ')
26 | return key_to_encode
27 |
28 |
29 | def get_encrypted_password(key_to_encode, pwd):
30 | n, i, t = key_to_encode[0], key_to_encode[1], key_to_encode[2]
31 | with open('fang_encrypt.js', 'r', encoding='utf-8') as f:
32 | fang_js = f.read()
33 | encrypted_pwd = execjs.compile(fang_js).call('getEncryptedPassword', pwd, n, i, t)
34 | return encrypted_pwd
35 |
36 |
37 | def login(encrypted_password, uid):
38 | headers = {
39 | 'User-Agent': user_agent,
40 | 'X-Requested-With': 'XMLHttpRequest',
41 | 'Host': 'passport.fang.com',
42 | 'Origin': 'https://passport.fang.com',
43 | 'Referer': 'https://passport.fang.com/?backurl=http%3a%2f%2fmy.fang.com%2f',
44 | 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
45 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
46 | }
47 | data = {
48 | 'uid': uid,
49 | 'pwd': encrypted_password,
50 | 'Service': 'soufun-passport-web',
51 | 'AutoLogin': 1
52 | }
53 | response = session.post(url=login_url, data=data, headers=headers)
54 | print(response.json())
55 |
56 |
57 | def main():
58 | # 16521689404
59 | uid = input('请输入登录账号:')
60 | pwd = input('请输入登录密码:')
61 | rsa_key = get_key_to_encode()
62 | encrypted_pwd = get_encrypted_password(rsa_key, pwd)
63 | login(encrypted_pwd, uid)
64 |
65 |
66 | if __name__ == '__main__':
67 | main()
68 |
--------------------------------------------------------------------------------
/passport_zhihuishu_com/code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kgspider/crawler/c3f6862efccee5874009eeafafdafe90edd684b3/passport_zhihuishu_com/code.png
--------------------------------------------------------------------------------
/passport_zhihuishu_com/zhihuishu_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-29
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: zhihuishu_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 | import json
12 | import base64
13 | import _thread
14 | import requests
15 | import websocket
16 | from PIL import Image
17 |
18 |
19 | web_socket_url = "wss://appcomm-user.zhihuishu.com/app-commserv-user/websocket?qrToken=%s"
20 | get_login_qr_img_url = "https://passport.zhihuishu.com/qrCodeLogin/getLoginQrImg"
21 | login_url = "https://passport.zhihuishu.com/login"
22 | user_info_url = "https://onlineservice.zhihuishu.com/login/getLoginUserInfo"
23 |
24 | headers = {
25 | "Host": "passport.zhihuishu.com",
26 | "Pragma": "no-cache",
27 | "Referer": "https://passport.zhihuishu.com/login",
28 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
29 | }
30 |
31 | qr_token = ""
32 | once_password = ""
33 | uuid = ""
34 | cookie = {}
35 |
36 |
37 | def get_cookies_first():
38 | response = requests.get(url=login_url, headers=headers)
39 | global cookie
40 | cookie = response.cookies.get_dict()
41 |
42 |
43 | def get_login_qr_img():
44 | response = requests.get(url=get_login_qr_img_url, headers=headers, cookies=cookie).json()
45 | qr_img = response["img"]
46 | global qr_token
47 | qr_token = response["qrToken"]
48 | with open('code.png', 'wb') as f:
49 | f.write(base64.b64decode(qr_img))
50 | image = Image.open('code.png')
51 | image.show()
52 | print("请扫描验证码! ")
53 |
54 |
55 | def wss_on_message(ws, message):
56 | print("=============== [message] ===============")
57 | message = json.loads(message)
58 | print(message)
59 | if "扫码成功" in message["msg"]:
60 | global once_password, uuid
61 | once_password = message["oncePassword"]
62 | uuid = message["uuid"]
63 | ws.close()
64 |
65 |
66 | def wss_on_error(ws, error):
67 | print("=============== [error] ===============")
68 | print(error)
69 | ws.close()
70 |
71 |
72 | def wss_on_close(ws, close_status_code, close_msg):
73 | print("=============== [closed] ===============")
74 | print(close_status_code)
75 | print(close_msg)
76 |
77 |
78 | def wss_on_open(ws):
79 | def run(*args):
80 | while True:
81 | ws.send(qr_token)
82 | time.sleep(8)
83 | _thread.start_new_thread(run, (qr_token,))
84 |
85 |
86 | def wss():
87 | # websocket.enableTrace(True) # 是否显示连接详细信息
88 | ws = websocket.WebSocketApp(
89 | web_socket_url % qr_token, on_open=wss_on_open,
90 | on_message=wss_on_message, on_error=wss_on_error,
91 | on_close=wss_on_close
92 | )
93 | ws.run_forever()
94 |
95 |
96 | def get_cookie_second():
97 | global cookie
98 | params = {
99 | "pwd": once_password,
100 | "service": "https://onlineservice.zhihuishu.com/login/gologin"
101 | }
102 | headers["Host"] = "passport.zhihuishu.com"
103 | headers["Referer"] = "https://passport.zhihuishu.com/login"
104 | response = requests.get(url=login_url, params=params, headers=headers, cookies=cookie, allow_redirects=False)
105 | cookie.update(response.cookies.get_dict())
106 | location = response.headers.get("Location")
107 | return location
108 |
109 |
110 | def get_cookie_third(location):
111 | global cookie
112 | headers["Host"] = "onlineservice.zhihuishu.com"
113 | headers["Referer"] = "https://passport.zhihuishu.com/"
114 | response = requests.get(url=location, headers=headers, cookies=cookie, allow_redirects=False)
115 | cookie.update(response.cookies.get_dict())
116 | location = response.headers.get("Location")
117 | return location
118 |
119 |
120 | def get_login_user_info():
121 | headers["Host"] = "onlineservice.zhihuishu.com"
122 | headers["Origin"] = "https://onlineweb.zhihuishu.com"
123 | headers["Referer"] = "https://onlineweb.zhihuishu.com/"
124 | params = {"time": str(int(time.time() * 1000))}
125 | response = requests.get(url=user_info_url, headers=headers, cookies=cookie, params=params)
126 | print(response.text)
127 |
128 |
129 | def main():
130 | # 第一次获取 cookie,包含 INGRESSCOOKIE、JSESSIONID、SERVERID、acw_tc
131 | get_cookies_first()
132 | # 获取二维码
133 | get_login_qr_img()
134 | # websocket 扫码登录,返回一次性密码
135 | wss()
136 | # 第二次获取 cookie,更新 SERVERID、获取 CASLOGC、CASTGC
137 | location1 = get_cookie_second()
138 | # 第三次获取 cookie,获取 SESSION
139 | get_cookie_third(location1)
140 | # 获取登录用户信息
141 | get_login_user_info()
142 |
143 |
144 | if __name__ == '__main__':
145 | main()
146 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_1/challenge_1.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-12-01
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: challenge_1.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 | challenge_api = "http://spider.wangluozhe.com/challenge/api/1"
14 | headers = {
15 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
16 | "Cookie": "session=282bc521-992c-451d-a006-3be584ce4509.tReFYhd1ESBPS6phcnS1ehOfWFo",
17 | "Host": "spider.wangluozhe.com",
18 | "Origin": "http://spider.wangluozhe.com",
19 | "Referer": "http://spider.wangluozhe.com/challenge/1",
20 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
21 | "X-Requested-With": "XMLHttpRequest"
22 | }
23 |
24 |
25 | def get_signature():
26 | with open('challenge_1.js', 'r', encoding='utf-8') as f:
27 | ppdai_js = execjs.compile(f.read())
28 | signature = ppdai_js.call("getSign")
29 | print("signature: ", signature)
30 | return signature
31 |
32 |
33 | def main():
34 | result = 0
35 | for page in range(1, 101):
36 | data = {
37 | "page": page,
38 | "count": 10,
39 | "_signature": get_signature()
40 | }
41 | response = requests.post(url=challenge_api, headers=headers, data=data).json()
42 | for d in response["data"]:
43 | result += d["value"]
44 | print("结果为: ", result)
45 |
46 |
47 | if __name__ == '__main__':
48 | main()
49 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_2/challenge_2.js:
--------------------------------------------------------------------------------
1 | /* ==================================
2 | # @Time : 2021-12-10
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: challenge_2.js
5 | # @Software: PyCharm
6 | # ================================== */
7 |
8 |
9 | var hexcase = 0;
10 | var chrsz = 8;
11 |
12 | function hex_sha1(s) {
13 | return binb2hex(core_sha1(AlignSHA1(s)));
14 | }
15 |
16 | function sha1_vm_test() {
17 | return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
18 | }
19 |
20 | function core_sha1(blockArray) {
21 | var x = blockArray;
22 | var w = Array(80);
23 | var a = 1732584173;
24 | var b = -271733877;
25 | var c = -1752584194;
26 | var d = 271733878;
27 | var e = -1009589776;
28 | for (var i = 0; i < x.length; i += 16) {
29 | var olda = a;
30 | var oldb = b;
31 | var oldc = c;
32 | var oldd = d;
33 | var olde = e;
34 | for (var j = 0; j < 80; j++) {
35 | if (j < 16)
36 | w[j] = x[i + j];
37 | else
38 | w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
39 | var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
40 | e = d;
41 | d = c;
42 | c = rol(b, 30);
43 | b = a;
44 | a = t;
45 | }
46 | a = safe_add(a, olda);
47 | b = safe_add(b, oldb);
48 | c = safe_add(c, oldc);
49 | d = safe_add(d, oldd);
50 | e = safe_add(e, olde);
51 | }
52 | return new Array(a, b, c, d, e);
53 | }
54 |
55 | function sha1_ft(t, b, c, d) {
56 | if (t < 20) {
57 | return (b & c) | ((~b) & d);
58 | }
59 | if (t < 40) {
60 | return b ^ c ^ d;
61 | }
62 | if (t < 60) {
63 | return (b & c) | (b & d) | (c & d);
64 | }
65 | return b ^ c ^ d;
66 | }
67 |
68 | function sha1_kt(t) {
69 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514;
70 | }
71 |
72 | function safe_add(x, y) {
73 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
74 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
75 | return (msw << 16) | (lsw & 0xFFFF);
76 | }
77 |
78 | function rol(num, cnt) {
79 | return (num << cnt) | (num >>> (32 - cnt));
80 | }
81 |
82 | function AlignSHA1(str) {
83 | var nblk = ((str.length + 8) >> 6) + 1;
84 | var blks = new Array(nblk * 16);
85 | for (var i = 0; i < nblk * 16; i++) {
86 | blks[i] = 0;
87 | }
88 | for (i = 0; i < str.length; i++) {
89 | blks[i >> 2] |= str.charCodeAt(i) << (24 - (i & 3) * 8);
90 | }
91 | blks[i >> 2] |= 0x80 << (24 - (i & 3) * 8);
92 | blks[nblk * 16 - 1] = str.length * 8;
93 | return blks;
94 | }
95 |
96 | function binb2hex(binarray) {
97 | var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
98 | var str = "";
99 | for (var i = 0; i < binarray.length * 4; i++) {
100 | str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);
101 | }
102 | return str;
103 | }
104 |
105 | function getSign() {
106 | return hex_sha1(Date.parse(new Date).toString());
107 | }
108 |
109 | // 测试输出
110 | // console.log(getSign())
111 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_2/challenge_2.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-12-10
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: challenge_2.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | challenge_api = "http://spider.wangluozhe.com/challenge/api/2"
15 | headers = {
16 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
17 | "Cookie": "session=eb2d1c7c-3179-4776-938e-f995478c1ebe.wdC8W9r38z_O97ynvrtBlSEQzPk",
18 | "Host": "spider.wangluozhe.com",
19 | "Origin": "http://spider.wangluozhe.com",
20 | "Referer": "http://spider.wangluozhe.com/challenge/2",
21 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
22 | "X-Requested-With": "XMLHttpRequest"
23 | }
24 |
25 |
26 | def get_signature():
27 | with open('challenge_2.js', 'r', encoding='utf-8') as f:
28 | ppdai_js = execjs.compile(f.read())
29 | signature = ppdai_js.call("getSign")
30 | print("signature: ", signature)
31 | return signature
32 |
33 |
34 | def main():
35 | result = 0
36 | for page in range(1, 101):
37 | data = {
38 | "page": page,
39 | "count": 10,
40 | "_signature": get_signature()
41 | }
42 | response = requests.post(url=challenge_api, headers=headers, data=data).json()
43 | for d in response["data"]:
44 | result += d["value"]
45 | print("结果为: ", result)
46 |
47 |
48 | if __name__ == '__main__':
49 | main()
50 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_3/challenge_3.js:
--------------------------------------------------------------------------------
1 | /* ==================================
2 | # @Time : 2021-12-13
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: challenge_3.js
5 | # @Software: PyCharm
6 | # ================================== */
7 |
8 | var CryptoJS = require('crypto-js')
9 |
10 | function encryptByDES(message, key) {
11 | var keyHex = CryptoJS.enc.Utf8.parse(key);
12 | var encrypted = CryptoJS.DES.encrypt(message, keyHex, {
13 | mode: CryptoJS.mode.ECB,
14 | padding: CryptoJS.pad.Pkcs7
15 | });
16 | return encrypted.ciphertext.toString();
17 | }
18 |
19 | function getSign() {
20 | var message = "http://spider.wangluozhe.com/challenge/3";
21 | message = message + '|' + Date.parse(new Date()).toString();
22 | var key = Date.parse(new Date()).toString();
23 | return encryptByDES(message, key);
24 | }
25 |
26 | // 测试输出
27 | // console.log(getSign())
28 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_3/challenge_3.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-12-13
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: challenge_3.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | challenge_api = "http://spider.wangluozhe.com/challenge/api/3"
15 | headers = {
16 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
17 | "Cookie": "session=eb2d1c7c-3179-4776-938e-f995478c1ebe.wdC8W9r38z_O97ynvrtBlSEQzPk",
18 | "Host": "spider.wangluozhe.com",
19 | "Origin": "http://spider.wangluozhe.com",
20 | "Referer": "http://spider.wangluozhe.com/challenge/2",
21 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
22 | "X-Requested-With": "XMLHttpRequest"
23 | }
24 |
25 |
26 | def get_signature():
27 | with open('challenge_3.js', 'r', encoding='utf-8') as f:
28 | ppdai_js = execjs.compile(f.read())
29 | signature = ppdai_js.call("getSign")
30 | print("signature: ", signature)
31 | return signature
32 |
33 |
34 | def main():
35 | result = 0
36 | for page in range(1, 101):
37 | data = {
38 | "page": page,
39 | "count": 10,
40 | "_signature": get_signature()
41 | }
42 | response = requests.post(url=challenge_api, headers=headers, data=data).json()
43 | for d in response["data"]:
44 | result += d["value"]
45 | print("结果为: ", result)
46 |
47 |
48 | if __name__ == '__main__':
49 | main()
50 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_4/challenge_4.js:
--------------------------------------------------------------------------------
1 | /* ==================================
2 | # @Time : 2021-12-13
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: challenge_4.js
5 | # @Software: PyCharm
6 | # ================================== */
7 |
8 | var CryptoJS = require('crypto-js')
9 |
10 | let date = Date.parse(new Date());
11 | window = {};
12 |
13 | let key_tmp = date * 1234;
14 | // let key_tmp = date * 1244;
15 | let iv_tmp = date * 4321;
16 | // let iv_tmp = date * 4311;
17 |
18 | const key = CryptoJS.enc.Utf8.parse(key_tmp);
19 | var iv = CryptoJS.enc.Utf8.parse(iv_tmp);
20 | (function tmp(date, key, iv) {
21 | function Encrypt(word) {
22 | let srcs = CryptoJS.enc.Utf8.parse(word);
23 | let encrypted = CryptoJS.AES.encrypt(srcs, key, {
24 | iv: iv,
25 | mode: CryptoJS.mode.CBC,
26 | padding: CryptoJS.pad.Pkcs7
27 | });
28 | return encrypted.ciphertext.toString().toUpperCase();
29 | }
30 |
31 | window.sign = Encrypt(date);
32 | })(date, key, iv);
33 |
34 | function getSign() {
35 | return window.sign
36 | }
37 |
38 | // 测试输出
39 | // console.log(getSign())
40 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_4/challenge_4.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-12-13
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: challenge_4.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | challenge_api = "http://spider.wangluozhe.com/challenge/api/4"
15 | headers = {
16 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
17 | "Cookie": "session=eb2d1c7c-3179-4776-938e-f995478c1ebe.wdC8W9r38z_O97ynvrtBlSEQzPk",
18 | "Host": "spider.wangluozhe.com",
19 | "Origin": "http://spider.wangluozhe.com",
20 | "Referer": "http://spider.wangluozhe.com/challenge/4",
21 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
22 | "X-Requested-With": "XMLHttpRequest"
23 | }
24 |
25 |
26 | def get_signature():
27 | with open('challenge_4.js', 'r', encoding='utf-8') as f:
28 | ppdai_js = execjs.compile(f.read())
29 | signature = ppdai_js.call("getSign")
30 | print("signature: ", signature)
31 | return signature
32 |
33 |
34 | def main():
35 | result = 0
36 | for page in range(1, 101):
37 | data = {
38 | "page": page,
39 | "count": 10,
40 | "_signature": get_signature()
41 | }
42 | response = requests.post(url=challenge_api, headers=headers, data=data).json()
43 | for d in response["data"]:
44 | result += d["value"]
45 | print("结果为: ", result)
46 |
47 |
48 | if __name__ == '__main__':
49 | main()
50 |
--------------------------------------------------------------------------------
/spider_wangluozhecom_challenge_6/challenge_6.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-12-20
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: challenge_6.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | challenge_api = "http://spider.wangluozhe.com/challenge/api/6"
15 | headers = {
16 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
17 | "Cookie": "session=eb2d1c7c-3179-4776-938e-f995478c1ebe.wdC8W9r38z_O97ynvrtBlSEQzPk; v=A0ljXUrQTfK4UjBNHUpAlhwCWH6glj1Yp4thXOu-xd5tGGdoM-ZNmDfacSh4",
18 | "Host": "spider.wangluozhe.com",
19 | "Origin": "http://spider.wangluozhe.com",
20 | "Referer": "http://spider.wangluozhe.com/challenge/6",
21 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
22 | "X-Requested-With": "XMLHttpRequest"
23 | }
24 |
25 |
26 | def get_hexin_v():
27 | with open('challenge_6.js', 'r', encoding='utf-8') as f:
28 | wlz_js = execjs.compile(f.read())
29 | hexin_v = wlz_js.call("getHexinV")
30 | print("hexin-v: ", hexin_v)
31 | return hexin_v
32 |
33 |
34 | def main():
35 | result = 0
36 | for page in range(1, 101):
37 | data = {
38 | "page": page,
39 | "count": 10,
40 | }
41 | headers["hexin-v"] = get_hexin_v()
42 | response = requests.post(url=challenge_api, headers=headers, data=data).json()
43 | for d in response["data"]:
44 | result += d["value"]
45 | print("结果为: ", result)
46 |
47 |
48 | if __name__ == '__main__':
49 | main()
50 |
--------------------------------------------------------------------------------
/store_steampowered_com/steampowered_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-09-09
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: steampowered_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 |
12 | import execjs
13 | import requests
14 | from PIL import Image
15 |
16 |
17 | index_url = 'https://store.steampowered.com/login'
18 | login_url = 'https://store.steampowered.com/login/dologin/'
19 | get_rsa_key_url = 'https://store.steampowered.com/login/getrsakey/'
20 | render_captcha_url = 'https://store.steampowered.com/login/rendercaptcha/'
21 | refresh_captcha_url = 'https://store.steampowered.com/login/refreshcaptcha/'
22 |
23 | headers = {
24 | 'Host': 'store.steampowered.com',
25 | 'Origin': 'https://store.steampowered.com',
26 | 'Referer': 'https://store.steampowered.com/login',
27 | 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
28 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
29 | }
30 | session = requests.session()
31 |
32 |
33 | def get_cookies():
34 | response = session.get(url=index_url, headers=headers)
35 | cookies = response.cookies.get_dict()
36 | print(cookies)
37 | return cookies
38 |
39 |
40 | def get_captcha(cookies):
41 | # 首先获取 gid
42 | data = {'donotcache': str(int(time.time() * 1000))}
43 | refresh_captcha_response = session.post(url=refresh_captcha_url, data=data, cookies=cookies, headers=headers)
44 | gid = refresh_captcha_response.json()['gid']
45 |
46 | # 携带 gid 获取验证码
47 | params = {'gid': gid}
48 | render_captcha_response = session.get(url=render_captcha_url, params=params, cookies=cookies, headers=headers)
49 |
50 | with open('code.png', 'wb') as f:
51 | f.write(render_captcha_response.content)
52 | image = Image.open('code.png')
53 | image.show()
54 | captcha = input('请输入验证码: ')
55 | return captcha, gid
56 |
57 |
58 | def get_rsa_key(username, cookies):
59 | data = {
60 | 'donotcache': str(int(time.time() * 1000)),
61 | 'username': username
62 | }
63 | response = session.post(url=get_rsa_key_url, data=data, cookies=cookies, headers=headers).json()
64 | print(response)
65 | return response
66 |
67 |
68 | def get_encrypted_password(password, rsa_key_dict):
69 | with open('steampowered_encrypt.js', 'r', encoding='utf-8') as f:
70 | steampowered_js = f.read()
71 | encrypted_password = execjs.compile(steampowered_js).call('getEncryptedPassword', password, rsa_key_dict)
72 | print(encrypted_password)
73 | return encrypted_password
74 |
75 |
76 | def login(username, encrypted_password, cookies, rsa_key_dict, captcha, gid):
77 | data = {
78 | 'donotcache': str(int(time.time() * 1000)),
79 | 'password': encrypted_password,
80 | 'username': username,
81 | 'twofactorcode': '',
82 | 'emailauth': '',
83 | 'loginfriendlyname': '',
84 | 'captchagid': gid,
85 | 'captcha_text': captcha,
86 | 'emailsteamid': '',
87 | 'rsatimestamp': rsa_key_dict['timestamp'],
88 | 'remember_login': False,
89 | # 'tokentype': '-1'
90 | }
91 | print(data)
92 | response = session.post(url=login_url, data=data, cookies=cookies, headers=headers)
93 | print(response.text)
94 |
95 |
96 | def main():
97 | username = input('请输入登录账号: ')
98 | password = input('请输入登录密码: ')
99 |
100 | # 获取 cookies
101 | cookies = get_cookies()
102 |
103 | # 获取验证码和 gid
104 | captcha, gid = get_captcha(cookies)
105 |
106 | # 获取 RSA 加密所需 key 等信息
107 | rsa_key_dict = get_rsa_key(username, cookies)
108 |
109 | # 获取加密后的密码
110 | encrypted_password = get_encrypted_password(password, rsa_key_dict)
111 |
112 | # 携带 用户名、加密后的密码、cookies、验证码等登录
113 | login(username, encrypted_password, cookies, rsa_key_dict, captcha, gid)
114 |
115 |
116 | if __name__ == '__main__':
117 | main()
118 |
--------------------------------------------------------------------------------
/tenhou_net/tenhou.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-26
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: tenhou.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 |
12 |
13 | url = 'https://tenhou.net/2/?q=336m237p2479s167z3s'
14 |
15 |
16 | def main():
17 | q = url.split('=')[1]
18 | with open('tenhou_decrypt.js', 'r', encoding='utf-8') as f:
19 | tenhou_js = f.read()
20 | data = execjs.compile(tenhou_js).call('fa', q)
21 | print(data)
22 |
23 |
24 | if __name__ == '__main__':
25 | main()
26 |
--------------------------------------------------------------------------------
/uncrackable_level1/frida-hook.js:
--------------------------------------------------------------------------------
1 | /* ==================================
2 | # @Time : 2022-08-29
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: frida-hook.js
5 | # @Software: PyCharm
6 | # ================================== */
7 |
8 |
9 | Java.perform(
10 | function(){
11 | console.log("[*] Hook begin")
12 |
13 | // 方法一:Hook 三个检测方法,让它们都返回 false,不再执行后续的 a 方法,就不会退出 APP 了
14 | // var vantagePoint = Java.use("sg.vantagepoint.a.c")
15 | // vantagePoint.a.implementation = function(){
16 | // console.log("[*] Hook vantagepoint.a.c.a")
17 | // this.a();
18 | // return false;
19 | // }
20 | // vantagePoint.b.implementation = function(){
21 | // console.log("[*] Hook vantagepoint.a.c.b")
22 | // this.b();
23 | // return false;
24 | // }
25 | // vantagePoint.c.implementation = function(){
26 | // console.log("[*] Hook vantagepoint.a.c.c")
27 | // this.c();
28 | // return false;
29 | // }
30 |
31 | // 方法二:Hook a() 方法,置空,什么都不做,不弹出对话框,也不退出 APP
32 | // var mainActivity = Java.use("sg.vantagepoint.uncrackable1.MainActivity");
33 | // mainActivity.a.implementation = function(){
34 | // console.log("[*] Hook mainActivity.a")
35 | // }
36 |
37 | // 方法三:Hook onClick() 方法,点击 OK 后不让其退出 APP
38 | // var mainActivity$1 = Java.use("sg.vantagepoint.uncrackable1.MainActivity$1");
39 | // mainActivity$1.onClick.implementation = function(){
40 | // console.log("[*] Hook mainActivity$1.onClick")
41 | // }
42 |
43 | // 方法四:Hook System.exit 方法,点击 OK 后不让其退出 APP
44 | var javaSystem = Java.use("java.lang.System");
45 | javaSystem.exit.implementation = function(){
46 | console.log("[*] Hook system.exit")
47 | }
48 |
49 | var cryptoAES = Java.use("sg.vantagepoint.a.a");
50 | cryptoAES.a.implementation = function(bArr, bArr2){
51 | console.log("[*] Hook cryptoAES")
52 | var secret = "";
53 | var decryptValue = this.a(bArr, bArr2);
54 | console.log("[*] DecryptValue:", decryptValue)
55 | for (var i=0; i < decryptValue.length; i++){
56 | secret += String.fromCharCode(decryptValue[i]);
57 | }
58 | console.log("[*] Secret:", secret)
59 | return decryptValue;
60 | }
61 | }
62 | )
63 |
--------------------------------------------------------------------------------
/uncrackable_level1/frida-hook.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2022-08-29
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: frida-hook.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import sys
11 | import frida
12 |
13 |
14 | def on_message(message, data):
15 | if message['type'] == 'send':
16 | print("[*] {0}".format(message['payload']))
17 | else:
18 | print(message)
19 |
20 |
21 | with open("./frida-hook.js", "r", encoding="utf-8") as fp:
22 | hook_string = fp.read()
23 |
24 | # 方式一:attach 模式,已经启动的 APP
25 | process = frida.get_usb_device(-1).attach("Uncrackable1")
26 | script = process.create_script(hook_string)
27 | script.on("message", on_message)
28 | script.load()
29 | sys.stdin.read()
30 |
31 | # 方式二,spawn 模式,重启 APP
32 | # device = frida.get_usb_device(-1)
33 | # pid = device.spawn(["owasp.mstg.uncrackable1"])
34 | # process = device.attach(pid)
35 | # script = process.create_script(hook_string)
36 | # script.on("message", on_message)
37 | # script.load()
38 | # device.resume(pid)
39 | # sys.stdin.read()
40 |
--------------------------------------------------------------------------------
/web_ewt360_com/ewt360_encrypt.js:
--------------------------------------------------------------------------------
1 | /*
2 | # ==================================
3 | # --*-- coding: utf-8 --*--
4 | # @Time : 2021-09-27
5 | # @Author : 微信公众号:K哥爬虫
6 | # @FileName: ewt360_encrypt.js
7 | # @Software: PyCharm
8 | # ==================================
9 | */
10 |
11 |
12 | CryptoJS = require("crypto-js")
13 |
14 | const key = CryptoJS.enc.Utf8.parse("20171109124536982017110912453698");
15 | const iv = CryptoJS.enc.Utf8.parse('2017110912453698'); //十六位十六进制数作为密钥偏移量
16 |
17 | function getEncryptedPassword(word) {
18 | let srcs = CryptoJS.enc.Utf8.parse(word);
19 | let encrypted = CryptoJS.AES.encrypt(srcs, key, {
20 | iv: iv,
21 | mode: CryptoJS.mode.CBC,
22 | padding: CryptoJS.pad.Pkcs7
23 | });
24 | return encrypted.ciphertext.toString().toUpperCase();
25 | }
26 |
27 | // 测试样例
28 | // console.log(getEncryptedPassword("123457"))
29 |
--------------------------------------------------------------------------------
/web_ewt360_com/ewt360_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-09-27
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: ewt360_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 | import hashlib
12 |
13 | import execjs
14 | import requests
15 |
16 |
17 | login_url = 'https://gateway.ewt360.com/api/authcenter/v2/oauth/login/account'
18 | session = requests.session()
19 |
20 |
21 | def get_sign():
22 | timestamp = str(int(time.time()*1000))
23 | sign = hashlib.md5((timestamp + 'bdc739ff2dcf').encode(encoding='utf-8')).hexdigest().upper()
24 | return sign
25 |
26 |
27 | def get_encrypted_parameter(password):
28 | with open('ewt360_encrypt.js', 'r', encoding='utf-8') as f:
29 | ewt360_js = f.read()
30 | encrypted_password = execjs.compile(ewt360_js).call('getEncryptedPassword', password)
31 | return encrypted_password
32 |
33 |
34 | def login(sign, username, encrypted_password):
35 | headers = {
36 | 'sign': sign,
37 | 'timestamp': str(int(time.time()*1000)),
38 | 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
39 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
40 | }
41 | data = {
42 | 'autoLogin': True,
43 | 'password': encrypted_password,
44 | 'platform': 1,
45 | 'userName': username
46 | }
47 | response = session.post(url=login_url, headers=headers, json=data)
48 | print(response.json())
49 |
50 |
51 | def main():
52 | username = input('请输入登录账号: ')
53 | password = input('请输入登录密码: ')
54 | sign = get_sign()
55 | encrypted_password = get_encrypted_parameter(password)
56 | login(sign, username, encrypted_password)
57 |
58 |
59 | if __name__ == '__main__':
60 | main()
61 |
--------------------------------------------------------------------------------
/weibo_com/weibo_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-31
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: weibo_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import re
11 | import json
12 | import time
13 | import base64
14 | import binascii
15 |
16 | import rsa
17 | import execjs
18 | import requests
19 | from lxml import etree
20 |
21 |
22 | # 判断某些请求是否成功的标志
23 | weibo_response_success_str = 'succ'
24 |
25 | pre_login_url = 'https://login.sina.com.cn/sso/prelogin.php'
26 | get_token_url = 'https://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.19)'
27 | protection_url = 'https://passport.weibo.com/protection/index'
28 | send_code_url = 'https://passport.weibo.com/protection/mobile/sendcode'
29 | confirm_url = 'https://passport.weibo.com/protection/mobile/confirm'
30 |
31 | headers = {
32 | 'Host': 'login.sina.com.cn',
33 | 'Referer': 'https://weibo.com/',
34 | 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
35 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
36 | }
37 | session = requests.session()
38 |
39 |
40 | def get_pre_parameter(username: str) -> dict:
41 | su = base64.b64encode(username.encode())
42 | time_now = str(int(time.time() * 1000))
43 | params = {
44 | 'entry': 'weibo',
45 | 'callback': 'sinaSSOController.preloginCallBack',
46 | 'su': su,
47 | 'rsakt': 'mod',
48 | 'checkpin': 1,
49 | 'client': 'ssologin.js(v1.4.19)',
50 | '_': time_now,
51 | }
52 | response = session.get(url=pre_login_url, params=params, headers=headers).text
53 | parameter_dict = json.loads(re.findall(r'\((.*)\)', response)[0])
54 | # print('1.【pre parameter】: %s' % parameter_dict)
55 | return parameter_dict
56 |
57 |
58 | def get_encrypted_password(pre_parameter: dict, password: str) -> str:
59 | # 通过 JS 获取加密后的密码
60 | # with open('weibo_encrypt.js', 'r', encoding='utf-8') as f:
61 | # weibo_js = f.read()
62 | # encrypted_password = execjs.compile(weibo_js).call('getEncryptedPassword', pre_parameter, password)
63 | # # print('2.【encrypted password】: %s' % encrypted_password)
64 | # return encrypted_password
65 |
66 | # 通过 Python 的 rsa 模块和 binascii 模块获取加密后的密码
67 | public_key = rsa.PublicKey(int(pre_parameter['pubkey'], 16), int('10001', 16))
68 | text = '%s\t%s\n%s' % (pre_parameter['servertime'], pre_parameter['nonce'], password)
69 | encrypted_str = rsa.encrypt(text.encode(), public_key)
70 | encrypted_password = binascii.b2a_hex(encrypted_str).decode()
71 | # print('2.【encrypted password】: %s' % encrypted_password)
72 | return encrypted_password
73 |
74 |
75 | def get_token(encrypted_password: str, pre_parameter: dict, username: str) -> str:
76 | su = base64.b64encode(username.encode())
77 | data = {
78 | 'entry': 'weibo',
79 | 'gateway': 1,
80 | 'from': '',
81 | 'savestate': 7,
82 | 'qrcode_flag': False,
83 | 'useticket': 1,
84 | 'pagerefer': '',
85 | 'vsnf': 1,
86 | 'su': su,
87 | 'service': 'miniblog',
88 | 'servertime': pre_parameter['servertime'],
89 | 'nonce': pre_parameter['nonce'],
90 | 'pwencode': 'rsa2',
91 | 'rsakv': pre_parameter['rsakv'],
92 | 'sp': encrypted_password,
93 | 'sr': '1920*1080',
94 | 'encoding': 'UTF-8',
95 | 'prelt': 38,
96 | 'url': 'https://weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack',
97 | 'returntype': 'META'
98 | }
99 | response = session.post(url=get_token_url, headers=headers, data=data)
100 | # response.encoding = 'gbk'
101 | ajax_login_url = re.findall(r'replace\("(.*)"\)', response.text)[0]
102 | token = ajax_login_url.split('token%3D')[-1]
103 | if 'weibo' not in token:
104 | # print('3.【token】: %s' % token)
105 | return token
106 | else:
107 | raise Exception('登录失败! 用户名或者密码错误!')
108 |
109 |
110 | def get_encrypted_mobile(token: str) -> str:
111 | params = {
112 | 'token': token,
113 | 'callback_url': 'https://weibo.com'
114 | }
115 | response = session.get(url=protection_url, params=params, headers=headers)
116 | tree = etree.HTML(response.text)
117 | encrypted_mobile = tree.xpath("//input[@name='encrypt_mobile']/@value")[0]
118 | # print('4.【encrypted mobile】: %s' % encrypted_mobile)
119 | return encrypted_mobile
120 |
121 |
122 | def send_code(token: str, encrypt_mobile: str) -> str:
123 | params = {'token': token}
124 | data = {'encrypt_mobile': encrypt_mobile}
125 | response = session.post(url=send_code_url, params=params, data=data, headers=headers).json()
126 | if response['msg'] == weibo_response_success_str:
127 | code = input('请输入验证码: ')
128 | # print('5.【code】: %s' % code)
129 | return code
130 | else:
131 | # print('5.【failed to send verification code】: %s' % response)
132 | raise Exception('验证码发送失败: %s' % response)
133 |
134 |
135 | def confirm_code(encrypted_mobile: str, code: str, token: str) -> str:
136 | params = {'token': token}
137 | data = {
138 | 'encrypt_mobile': encrypted_mobile,
139 | 'code': code
140 | }
141 | response = session.post(url=confirm_url, params=params, data=data, headers=headers).json()
142 | if response['msg'] == weibo_response_success_str:
143 | redirect_url = response['data']['redirect_url']
144 | # print('6.【redirect url】: %s' % redirect_url)
145 | return redirect_url
146 | else:
147 | # print('6.【验证码校验失败】: %s' % response)
148 | raise Exception('验证码校验失败: %s' % response)
149 |
150 |
151 | def get_cross_domain2_url(redirect_url: str) -> str:
152 | response = session.get(url=redirect_url, headers=headers).text
153 | cross_domain2_url = re.findall(r'replace\("(.*)"\)', response)[0]
154 | # print('7.【cross domain2 url】: %s' % cross_domain2_url)
155 | return cross_domain2_url
156 |
157 |
158 | def get_passport_url(cross_domain2_url: str) -> str:
159 | response = session.get(url=cross_domain2_url, headers=headers).text
160 | passport_url_str = re.findall(r'setCrossDomainUrlList\((.*)\)', response)[0]
161 | passport_url = json.loads(passport_url_str)['arrURL'][0]
162 | # print('8.【passport url】: %s' % passport_url)
163 | return passport_url
164 |
165 |
166 | def login(passport_url: str) -> None:
167 | response = session.get(url=passport_url, headers=headers).text
168 | login_result = json.loads(response.replace('(', '').replace(');', ''))
169 | if login_result['result']:
170 | user_unique_id = login_result['userinfo']['uniqueid']
171 | user_display_name = login_result['userinfo']['displayname']
172 | print('登录成功!用户 ID:%s,用户名:%s' % (user_unique_id, user_display_name))
173 | else:
174 | raise Exception('登录失败:%s' % login_result)
175 |
176 |
177 | def main():
178 | username = input('请输入登录账号: ')
179 | password = input('请输入登录密码: ')
180 |
181 | # 1.预登陆,获取一个字典参数,包含后面要用的 servertime、nonce、pubkey、rsakv
182 | pre_parameter = get_pre_parameter(username)
183 |
184 | # 2.通过 JS 或者 Python 获取加密后的密码
185 | encrypted_password = get_encrypted_password(pre_parameter, password)
186 |
187 | # 3.获取 token
188 | token = get_token(encrypted_password, pre_parameter, username)
189 |
190 | # 4.通过 protection url 获取加密后的手机号
191 | encrypted_mobile = get_encrypted_mobile(token)
192 |
193 | # 5.发送手机验证码
194 | code = send_code(token, encrypted_mobile)
195 |
196 | # 6.校验验证码,校验成功则返回一个重定向的 URL
197 | redirect_url = confirm_code(encrypted_mobile, code, token)
198 |
199 | # 7.访问重定向的 URL,提取 crossdomain2 URL
200 | cross_domain2_url = get_cross_domain2_url(redirect_url)
201 |
202 | # 8.访问 crossdomain2 URL,提取 passport URL
203 | passport_url = get_passport_url(cross_domain2_url)
204 |
205 | # 9.访问 passport URL 进行登录操作
206 | login(passport_url)
207 |
208 |
209 | if __name__ == '__main__':
210 | main()
211 |
--------------------------------------------------------------------------------
/www_15yunmall_com/15yunmall_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-19
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: 15yunmall_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 | from lxml import etree
14 | from PIL import Image
15 |
16 |
17 | index_url = 'http://www.15yunmall.com/pc/login/index'
18 | login_url = 'http://www.15yunmall.com/pc/login/check'
19 | code_url = 'http://www.15yunmall.com/very/code.html'
20 |
21 | headers = {
22 | 'Host': 'www.15yunmall.com',
23 | 'Referer': 'http://www.15yunmall.com/',
24 | 'Origin': 'http://www.15yunmall.com',
25 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'
26 | }
27 | session = requests.session()
28 |
29 |
30 | def get_encrypted_password(password):
31 | with open('15yunmall_encrypt.js', 'r', encoding='utf-8') as f:
32 | yunmall_js = f.read()
33 | encrypted_password = execjs.compile(yunmall_js).call('getEncryptedPassword', password)
34 | return encrypted_password
35 |
36 |
37 | def get_csrf_token_cookie():
38 | response = session.get(url=index_url, headers=headers)
39 | tree = etree.HTML(response.text)
40 | csrf_token = tree.xpath("//input[@name='_csrfToken']/@value")[0]
41 | cookies = response.cookies.get_dict()
42 | # print(csrf_token, cookies)
43 | return csrf_token, cookies
44 |
45 |
46 | def get_very_code(cookies):
47 | response = session.get(url=code_url, cookies=cookies, headers=headers)
48 | with open('code.png', 'wb') as f:
49 | f.write(response.content)
50 | image = Image.open('code.png')
51 | image.show()
52 | very_code = input('请输入验证码: ')
53 | return very_code
54 |
55 |
56 | def login(csrf_token, very_code, cookies, username, encrypted_password):
57 | data = {
58 | 'u[loginType]': 'name',
59 | 'u[phone]': username,
60 | 'u[password]': encrypted_password,
61 | 'u[veryCode]': very_code,
62 | 'u[token]': '',
63 | '_csrfToken': csrf_token
64 | }
65 | header_info = {
66 | 'X-Requested-With': 'XMLHttpRequest',
67 | }
68 | headers.update(header_info)
69 | response = session.post(url=login_url, data=data, cookies=cookies, headers=headers)
70 | response.encoding = 'utf-8-sig'
71 | response_code = response.text
72 | # print(response_code)
73 | status_code = {
74 | '31': '恭喜,登陆成功。',
75 | '32': '登陆失败。',
76 | '33': '用户名或密码错误。',
77 | '35': '该用户已被管理员锁定。',
78 | '311': '该账号已绑定设备,请在绑定的设备登陆。',
79 | '20001': '验证码填写错误!'
80 | }
81 | try:
82 | print(status_code[response_code])
83 | except KeyError:
84 | print('请求超时!')
85 |
86 |
87 | def main():
88 | username = input('请输入登录账号: ')
89 | password = input('请输入登录密码: ')
90 | if len(password) > 32:
91 | raise Exception('请输入正确的密码!')
92 | encrypted_password = get_encrypted_password(password)
93 | csrf_token, cookies = get_csrf_token_cookie()
94 | very_code = get_very_code(cookies)
95 | login(csrf_token, very_code, cookies, username, encrypted_password)
96 |
97 |
98 | if __name__ == '__main__':
99 | main()
100 |
--------------------------------------------------------------------------------
/www_37_com/37_encrypt.js:
--------------------------------------------------------------------------------
1 | /*
2 | # ==================================
3 | # --*-- coding: utf-8 --*--
4 | # @Time : 2021-08-20
5 | # @Author : 微信公众号:K哥爬虫
6 | # @FileName: 37_encrypt.js
7 | # @Software: PyCharm
8 | # ==================================
9 | */
10 |
11 | var ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
12 | function __rsa(str) {
13 | var out, i, len;
14 | var c1, c2, c3;
15 | len = str.length;
16 | i = 0;
17 | out = "";
18 | while (i < len) {
19 | c1 = str.charCodeAt(i++) & 0xff;
20 | if (i == len) {
21 | out += ch.charAt(c1 >> 2);
22 | out += ch.charAt((c1 & 0x3) << 4);
23 | out += "==";
24 | break
25 | }
26 | c2 = str.charCodeAt(i++);
27 | if (i == len) {
28 | out += ch.charAt(c1 >> 2);
29 | out += ch.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
30 | out += ch.charAt((c2 & 0xF) << 2);
31 | out += "=";
32 | break
33 | }
34 | c3 = str.charCodeAt(i++);
35 | out += ch.charAt(c1 >> 2);
36 | out += ch.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
37 | out += ch.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
38 | out += ch.charAt(c3 & 0x3F)
39 | }
40 | return out
41 | }
42 |
43 | function getEncryptedPassword(a) {
44 | var maxPos = ch.length - 2
45 | , w = [];
46 | for (i = 0; i < 15; i++) {
47 | w.push(ch.charAt(Math.floor(Math.random() * maxPos)));
48 | if (i === 7) {
49 | w.push(a.substr(0, 3))
50 | }
51 | if (i === 12) {
52 | w.push(a.substr(3))
53 | }
54 | }
55 | return __rsa(w.join(""))
56 | }
57 |
58 | // 测试样例
59 | // console.log(getEncryptedPassword("34343434"))
60 |
--------------------------------------------------------------------------------
/www_37_com/37_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-08-20
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: 37_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 | import random
12 |
13 | import execjs
14 | import requests
15 |
16 |
17 | login_url = 'https://my.37.com/api/login.php'
18 |
19 |
20 | def get_encrypted_password(password):
21 | with open('37_encrypt.js', 'r', encoding='utf-8') as f:
22 | www_37_js = f.read()
23 | encrypted_pwd = execjs.compile(www_37_js).call('getEncryptedPassword', password)
24 | return encrypted_pwd
25 |
26 |
27 | def login(username, encrypted_password):
28 | timestamp = str(int(time.time() * 1000))
29 | jsonp = ''
30 | for _ in range(20):
31 | jsonp += str(random.randint(0, 9))
32 | callback = 'jQuery' + jsonp + '_' + timestamp
33 | params = {
34 | 'callback': callback,
35 | 'action': 'login',
36 | 'login_account': username,
37 | 'password': encrypted_password,
38 | 'ajax': 0,
39 | 'remember_me': 1,
40 | 'save_state': 1,
41 | 'ltype': 1,
42 | 'tj_from': 100,
43 | 's': 1,
44 | 'tj_way': 1,
45 | '_': timestamp
46 | }
47 | headers = {
48 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36',
49 | 'sec-ch-ua': '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"'
50 | }
51 | response = requests.post(url=login_url, headers=headers, params=params)
52 | print(response.text)
53 |
54 |
55 | def main():
56 | username = input('请输入登录账号: ')
57 | password = input('请输入登录密码: ')
58 | encrypted_password = get_encrypted_password(password)
59 | login(username, encrypted_password)
60 |
61 |
62 | if __name__ == '__main__':
63 | main()
64 |
--------------------------------------------------------------------------------
/www_airasia_com/flightstatus.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-10-15
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: flightstatus.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import requests
11 |
12 |
13 | status_url = 'https://k.apiairasia.com/flightstatus/status/od/v3/'
14 |
15 |
16 | def get_flight_status(departure, destination, date):
17 | headers = {
18 | 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36',
19 | 'authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJMQ0FLaWhpbUxlTjZ3a1FYU2FhRTgyZTh0ZDUwM3NZUiIsImlhdCI6MTUzMzY5NzU5NSwiZXhwIjoxODQ5MzE2Nzk1LCJhdWQiOiJGbGlnaHQgU3RhdHVzIiwic3ViIjoiRmxpZ2h0IFN0YXR1cyJ9._M8lPMqvBYW20NcjeUyb0iQRrUYSjIWhGwJeDY4Apns'
20 | }
21 | complete_url = status_url + departure + '/' + destination + '/' + date
22 | response = requests.get(url=complete_url, headers=headers)
23 | print(response.text)
24 |
25 |
26 | if __name__ == '__main__':
27 | departure = input('请输入出发地代码:')
28 | destination = input('请输入目的地代码:')
29 | date = input('请输入日期(例如:29/09/2021):')
30 |
31 | # departure = 'MFM'
32 | # destination = 'KUL'
33 | # date = '29/09/2021'
34 | get_flight_status(departure, destination, date)
35 |
--------------------------------------------------------------------------------
/www_appmiu_com/appmiu.js:
--------------------------------------------------------------------------------
1 | var e = function () {
2 | for (var t = arguments.length, n = Array(t), r = 0; r < t; r++)
3 | n[r] = arguments[r];
4 | var e = n.length
5 | , i = "string" == typeof n[e - 1] ? n[e - 1] : "Assert Error"
6 | , o = !0
7 | , u = !1
8 | , c = void 0;
9 | try {
10 | for (var f, a = n[Symbol.iterator](); !(o = (f = a.next()).done); o = !0) {
11 | if (!f.value)
12 | throw new Error(i)
13 | }
14 | } catch (t) {
15 | u = !0,
16 | c = t
17 | } finally {
18 | try {
19 | !o && a.return && a.return()
20 | } finally {
21 | if (u)
22 | throw c
23 | }
24 | }
25 | }
26 | , i = function () {
27 | return Math.random() >= .5
28 | }
29 | , o = function (t) {
30 | var n = /[A-Za-z0-9\-\_\.\!\~\*\'\(\)]/g
31 | , r = t.replace(n, function (t) {
32 | return t.codePointAt(0).toString(16)
33 | });
34 | return encodeURIComponent(r).replace(/%/g, "").toUpperCase()
35 | }
36 | , u = function (t) {
37 | e("string" == typeof t, "utfs Error");
38 | var n = t.length;
39 | e(0 == (1 & n));
40 | for (var r = [], i = 0; i < n; i++)
41 | 0 == (1 & i) && r.push("%"),
42 | r.push(t[i]);
43 | return decodeURIComponent(r.join(""))
44 | }
45 | , c = function (t) {
46 | e("string" == typeof t);
47 | var n = []
48 | , r = !0
49 | , o = !1
50 | , u = void 0;
51 | try {
52 | for (var c, f = t[Symbol.iterator](); !(r = (c = f.next()).done); r = !0) {
53 | var a = c.value
54 | , s = Number.parseInt(a, 16);
55 | s < 10 ? n.push(s) : i() ? (n.push(10),
56 | n.push(s - 10)) : (n.push(11),
57 | n.push(s - 6))
58 | }
59 | } catch (t) {
60 | o = !0,
61 | u = t
62 | } finally {
63 | try {
64 | !r && f.return && f.return()
65 | } finally {
66 | if (o)
67 | throw u
68 | }
69 | }
70 | return n
71 | }
72 | , f = function (t) {
73 | e(t instanceof Array);
74 | for (var n = [], r = t.length, i = 0; i < r;)
75 | t[i] < 10 ? n.push(t[i]) : 10 === t[i] ? (i++,
76 | n.push(t[i] + 10)) : (i++,
77 | n.push(t[i] + 6)),
78 | i++;
79 | return n.map(function (t) {
80 | return t.toString(16).toUpperCase()
81 | }).join("")
82 | }
83 | , a = function (t) {
84 | return t.map(function (t) {
85 | return h[2 * t] + h[2 * t + 1]
86 | }).join("")
87 | }
88 | , s = function (t) {
89 | var n = []
90 | , r = !0
91 | , i = !1
92 | , o = void 0;
93 | try {
94 | for (var c, a = t[Symbol.iterator](); !(r = (c = a.next()).done); r = !0) {
95 | var s = c.value
96 | , l = h.indexOf(s);
97 | -1 !== l && (1 & l || n.push(l >> 1))
98 | }
99 | } catch (t) {
100 | i = !0,
101 | o = t
102 | } finally {
103 | try {
104 | !r && a.return && a.return()
105 | } finally {
106 | if (i)
107 | throw o
108 | }
109 | }
110 | var v = f(n);
111 | e(0 == (1 & v.length));
112 | var p = void 0;
113 | try {
114 | p = u(v)
115 | } catch (t) {
116 | throw t
117 | }
118 | return p
119 | }
120 | , h = "富强民主文明和谐自由平等公正法治爱国敬业诚信友善"
121 |
122 | function encrypt(t) {
123 | return a(c(o(t)))
124 | }
125 |
126 | function decrypt(t) {
127 | return s(t)
128 | }
129 |
130 | // 测试样例
131 | // console.log(encrypt("1234"))
132 | // console.log(decrypt("和谐民主和谐文明和谐和谐和谐自由"))
133 |
--------------------------------------------------------------------------------
/www_gm99_com/code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kgspider/crawler/c3f6862efccee5874009eeafafdafe90edd684b3/www_gm99_com/code.png
--------------------------------------------------------------------------------
/www_gm99_com/gm99_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-10-28
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: gm99_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import re
11 | import json
12 | import time
13 | import random
14 | import base64
15 | from urllib import parse
16 |
17 | import execjs
18 | import requests
19 | from PIL import Image
20 | from Cryptodome.PublicKey import RSA
21 | from Cryptodome.Cipher import PKCS1_v1_5
22 |
23 | login_url = 'https://passport.gm99.com/login/login3'
24 | verify_image_url = 'https://passport.gm99.com/verify_image'
25 | check_code_url = 'https://passport.gm99.com/ajax/check_code'
26 |
27 | headers = {
28 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
29 | }
30 | session = requests.session()
31 |
32 |
33 | def get_jquery():
34 | jsonp = ''
35 | for _ in range(21):
36 | jsonp += str(random.randint(0, 9))
37 | jquery = 'jQuery' + jsonp + '_'
38 | return jquery
39 |
40 |
41 | def get_dict_from_jquery(text):
42 | result = re.findall(r'\((.*?)\)', text)[0]
43 | return json.loads(result)
44 |
45 |
46 | def get_encrypted_password_by_javascript(password):
47 | # 两个 JavaScript 脚本,两种方法均可
48 | with open('gm99_encrypt.js', 'r', encoding='utf-8') as f:
49 | # with open('gm99_encrypt_2.js', 'r', encoding='utf-8') as f:
50 | exec_js = f.read()
51 | encrypted_password = execjs.compile(exec_js).call('getEncryptedPassword', password)
52 | return encrypted_password
53 |
54 |
55 | def get_encrypted_password_by_python(password):
56 | timestamp = str(int(time.time() * 1000))
57 | encrypted_object = timestamp + "|" + password
58 | public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDq04c6My441Gj0UFKgrqUhAUg+kQZeUeWSPlAU9fr4HBPDldAeqzx1UR92KJHuQh/zs1HOamE2dgX9z/2oXcJaqoRIA/FXysx+z2YlJkSk8XQLcQ8EBOkp//MZrixam7lCYpNOjadQBb2Ot0U/Ky+jF2p+Ie8gSZ7/u+Wnr5grywIDAQAB"
59 | rsa_key = RSA.import_key(base64.b64decode(public_key)) # 导入读取到的公钥
60 | cipher = PKCS1_v1_5.new(rsa_key) # 生成对象
61 | encrypted_password = base64.b64encode(cipher.encrypt(encrypted_object.encode(encoding="utf-8")))
62 | encrypted_password = parse.quote(encrypted_password)
63 | return encrypted_password
64 |
65 |
66 | def get_verify_code():
67 | response = session.get(url=verify_image_url, headers=headers)
68 | with open('code.png', 'wb') as f:
69 | f.write(response.content)
70 | image = Image.open('code.png')
71 | image.show()
72 | code = input('请输入图片验证码: ')
73 | return code
74 |
75 |
76 | def check_code(code):
77 | timestamp = str(int(time.time() * 1000))
78 | params = {
79 | 'callback': get_jquery() + timestamp,
80 | 'ckcode': code,
81 | '_': timestamp,
82 | }
83 | response = session.get(url=check_code_url, params=params, headers=headers)
84 | result = get_dict_from_jquery(response.text)
85 | if result['result'] == 1:
86 | pass
87 | else:
88 | raise Exception('验证码输入错误!')
89 |
90 |
91 | def login(username, encrypted_password, code):
92 | timestamp = str(int(time.time() * 1000))
93 | params = {
94 | 'callback': get_jquery() + timestamp,
95 | 'encrypt': 1,
96 | 'uname': username,
97 | 'password': encrypted_password,
98 | 'remember': 'checked',
99 | 'ckcode': code,
100 | '_': timestamp
101 | }
102 | response = session.get(url=login_url, params=params, headers=headers)
103 | result = get_dict_from_jquery(response.text)
104 | print(result)
105 |
106 |
107 | def main():
108 | # 测试账号:15434947408,密码:iXqC@aJt8fi@VwV
109 | username = input('请输入登录账号: ')
110 | password = input('请输入登录密码: ')
111 |
112 | # 获取加密后的密码,使用 Python 或者 JavaScript 实现均可
113 | encrypted_password = get_encrypted_password_by_javascript(password)
114 | # encrypted_password = get_encrypted_password_by_python(password)
115 |
116 | # 获取验证码
117 | code = get_verify_code()
118 |
119 | # 校验验证码
120 | check_code(code)
121 |
122 | # 登录
123 | login(username, encrypted_password, code)
124 |
125 |
126 | if __name__ == '__main__':
127 | main()
128 |
--------------------------------------------------------------------------------
/www_hnzwfw_gov_cn/encrypt.js:
--------------------------------------------------------------------------------
1 | /* ==================================
2 | # @Time : 2022-01-11
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: encrypt.js
5 | # @Software: PyCharm
6 | # ================================== */
7 |
8 | JSEncrypt = require("jsencrypt")
9 |
10 | function encrypt(pwd){
11 | var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgDq4OqxuEisnk2F0EJFmw4xKa5IrcqEYHvqxPs2CHEg2kolhfWA2SjNuGAHxyDDE5MLtOvzuXjBx/5YJtc9zj2xR/0moesS+Vi/xtG1tkVaTCba+TV+Y5C61iyr3FGqr+KOD4/XECu0Xky1W9ZmmaFADmZi7+6gO9wjgVpU9aLcBcw/loHOeJrCqjp7pA98hRJRY+MML8MK15mnC4ebooOva+mJlstW6t/1lghR8WNV8cocxgcHHuXBxgns2MlACQbSdJ8c6Z3RQeRZBzyjfey6JCCfbEKouVrWIUuPphBL3OANfgp0B+QG31bapvePTfXU48TYK0M5kE+8LgbbWQIDAQAB";
12 | var encrypt = new JSEncrypt();
13 | encrypt.setPublicKey(key);
14 | var encrypted = encrypt.encrypt(pwd);
15 | return encrypted;
16 | }
17 |
18 | // 测试样例
19 | // console.log(encrypt("15555555555"))
20 |
--------------------------------------------------------------------------------
/www_hnzwfw_gov_cn/hnzww_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # @Time : 2022-01-11
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: hnzww_login.py
5 | # @Software: PyCharm
6 | # ==================================
7 |
8 |
9 | import execjs
10 | import requests
11 |
12 |
13 | cookies = {}
14 | UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
15 |
16 | with open("encrypt.js", encoding="utf-8") as f:
17 | js = execjs.compile(f.read())
18 |
19 |
20 | def csrf_save():
21 | url = "https://login.hnzwfw.gov.cn/tacs-uc/naturalMan/csrfSave"
22 | headers = {"User-Agent": UA}
23 | response = requests.post(url=url, headers=headers, cookies=cookies).json()
24 | data = response["data"]
25 | return data
26 |
27 |
28 | def get_session():
29 | url = "https://login.hnzwfw.gov.cn/tacs-uc/login/index"
30 | headers = {"User-Agent": UA}
31 | response = requests.get(url=url, headers=headers)
32 | cookies.update(response.cookies.get_dict())
33 |
34 |
35 | def get_uuid():
36 | url = "https://login.hnzwfw.gov.cn/tacs-uc/naturalMan/uploadIdentifier"
37 | headers = {
38 | "User-Agent": UA,
39 | "token": js.call("encrypt", csrf_save())
40 | }
41 | response = requests.post(url=url, headers=headers, cookies=cookies).json()
42 | uuid = response["data"]
43 | return uuid
44 |
45 |
46 | def ver_code():
47 | url = "https://login.hnzwfw.gov.cn/tacs-uc/login/verCode"
48 | headers = {
49 | "User-Agent": UA,
50 | "token": js.call("encrypt", csrf_save())
51 | }
52 | response = requests.post(url=url, headers=headers, cookies=cookies).json()
53 | data = response["data"]
54 | return data
55 |
56 |
57 | def login(phone, pwd, code, uuid):
58 | url = "https://login.hnzwfw.gov.cn/tacs-uc/naturalMan/loginNo"
59 | headers = {
60 | "User-Agent": UA,
61 | "token": js.call("encrypt", csrf_save())
62 | }
63 | data = {
64 | "backUrl": "",
65 | "loginNo": js.call("encrypt", phone),
66 | "loginPwd": js.call("encrypt", pwd),
67 | "code": code,
68 | "requestUUID": uuid,
69 | "guoBanAuthCode": ""
70 | }
71 | response = requests.post(url=url, headers=headers, cookies=cookies, data=data)
72 | print(response.json())
73 |
74 |
75 | def main():
76 | phone = input("请输入账号:")
77 | pwd = input("请输入密码:")
78 | get_session()
79 | uuid = get_uuid()
80 | code = ver_code()
81 | login(phone, pwd, code, uuid)
82 |
83 |
84 | if __name__ == '__main__':
85 | main()
86 |
--------------------------------------------------------------------------------
/www_kuwo_cn/get_reqId.js:
--------------------------------------------------------------------------------
1 | var kuwo;
2 |
3 | !function(e) {
4 | var t = {};
5 |
6 | function d(n) {
7 | if (t[n]) return t[n].exports;
8 | var r = t[n] = {
9 | i: n,
10 | l: !1,
11 | exports: {}
12 | };
13 | return e[n].call(r.exports, r, r.exports, d),
14 | r.l = !0,
15 | r.exports
16 | }
17 |
18 | d.n = function(e) {
19 | var n = e && e.__esModule ?
20 | function() {
21 | return e.
22 | default
23 | }:
24 | function() {
25 | return e
26 | };
27 | return d.d(n, "a", n),
28 | n
29 | },
30 | d.d = function(e, n, r) {
31 | d.o(e, n) || Object.defineProperty(e, n, {
32 | enumerable: !0,
33 | get: r
34 | })
35 | },
36 | d.o = function(object, e) {
37 | return Object.prototype.hasOwnProperty.call(object, e)
38 | }
39 |
40 | kuwo = d
41 | }({
42 | 109 : function(t, e, n) {
43 | var r, o, l = n(202),
44 | c = n(203),
45 | h = 0,
46 | d = 0;
47 | t.exports = function(t, e, n) {
48 | var i = e && n || 0,
49 | b = e || [],
50 | f = (t = t || {}).node || r,
51 | v = void 0 !== t.clockseq ? t.clockseq: o;
52 | if (null == f || null == v) {
53 | var m = l();
54 | null == f && (f = r = [1 | m[0], m[1], m[2], m[3], m[4], m[5]]),
55 | null == v && (v = o = 16383 & (m[6] << 8 | m[7]))
56 | }
57 | var y = void 0 !== t.msecs ? t.msecs: (new Date).getTime(),
58 | w = void 0 !== t.nsecs ? t.nsecs: d + 1,
59 | dt = y - h + (w - d) / 1e4;
60 | if (dt < 0 && void 0 === t.clockseq && (v = v + 1 & 16383), (dt < 0 || y > h) && void 0 === t.nsecs && (w = 0), w >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
61 | h = y,
62 | d = w,
63 | o = v;
64 | var x = (1e4 * (268435455 & (y += 122192928e5)) + w) % 4294967296;
65 | b[i++] = x >>> 24 & 255,
66 | b[i++] = x >>> 16 & 255,
67 | b[i++] = x >>> 8 & 255,
68 | b[i++] = 255 & x;
69 | var _ = y / 4294967296 * 1e4 & 268435455;
70 | b[i++] = _ >>> 8 & 255,
71 | b[i++] = 255 & _,
72 | b[i++] = _ >>> 24 & 15 | 16,
73 | b[i++] = _ >>> 16 & 255,
74 | b[i++] = v >>> 8 | 128,
75 | b[i++] = 255 & v;
76 | for (var A = 0; A < 6; ++A) b[i + A] = f[A];
77 | return e || c(b)
78 | }
79 | },
80 | 202 : function(t, e) {
81 | var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof window.msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto);
82 | if (n) {
83 | var r = new Uint8Array(16);
84 | t.exports = function() {
85 | return n(r),
86 | r
87 | }
88 | } else {
89 | var o = new Array(16);
90 | t.exports = function() {
91 | for (var t, i = 0; i < 16; i++) 0 == (3 & i) && (t = 4294967296 * Math.random()),
92 | o[i] = t >>> ((3 & i) << 3) & 255;
93 | return o
94 | }
95 | }
96 | },
97 | 203 : function(t, e) {
98 | for (var n = [], i = 0; i < 256; ++i) n[i] = (i + 256).toString(16).substr(1);
99 | t.exports = function(t, e) {
100 | var i = e || 0,
101 | r = n;
102 | return [r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]]].join("")
103 | }
104 | }
105 | })
106 |
107 | function getReqId() {
108 | var l = kuwo(109),
109 | c = kuwo.n(l),
110 | r = c()()
111 | return r
112 | }
113 |
114 | // console.log(getReqId())
115 |
--------------------------------------------------------------------------------
/www_kuwo_cn/get_reqId_2.js:
--------------------------------------------------------------------------------
1 | var kuwo;
2 |
3 | !function (e){
4 | var t = {};
5 |
6 | function d(n) {
7 | if (t[n]) return t[n].exports;
8 | var r = t[n] = {
9 | i: n,
10 | l: !1,
11 | exports: {}
12 | };
13 | return e[n].call(r.exports, r, r.exports, d),
14 | r.l = !0,
15 | r.exports
16 | }
17 |
18 | d.n = function (e) {
19 | var n = e && e.__esModule ?
20 | function () {
21 | return e.default
22 | } :
23 | function () {
24 | return e
25 | };
26 | return d.d(n, "a", n),
27 | n
28 | },
29 | d.d = function (e, n, r) {
30 | d.o(e, n) || Object.defineProperty(e, n, {
31 | enumerable: !0,
32 | get: r
33 | })
34 | },
35 | d.o = function (object, e) {
36 | return Object.prototype.hasOwnProperty.call(object, e)
37 | }
38 |
39 | kuwo = d
40 | }([
41 | function (t, e, n) {
42 | var r, o, l = n(1),
43 | c = n(2),
44 | h = 0,
45 | d = 0;
46 | t.exports = function (t, e, n) {
47 | var i = e && n || 0,
48 | b = e || [],
49 | f = (t = t || {}).node || r,
50 | v = void 0 !== t.clockseq ? t.clockseq : o;
51 | if (null == f || null == v) {
52 | var m = l();
53 | null == f && (f = r = [1 | m[0], m[1], m[2], m[3], m[4], m[5]]),
54 | null == v && (v = o = 16383 & (m[6] << 8 | m[7]))
55 | }
56 | var y = void 0 !== t.msecs ? t.msecs : (new Date).getTime(),
57 | w = void 0 !== t.nsecs ? t.nsecs : d + 1,
58 | dt = y - h + (w - d) / 1e4;
59 | if (dt < 0 && void 0 === t.clockseq && (v = v + 1 & 16383), (dt < 0 || y > h) && void 0 === t.nsecs && (w = 0), w >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
60 | h = y,
61 | d = w,
62 | o = v;
63 | var x = (1e4 * (268435455 & (y += 122192928e5)) + w) % 4294967296;
64 | b[i++] = x >>> 24 & 255,
65 | b[i++] = x >>> 16 & 255,
66 | b[i++] = x >>> 8 & 255,
67 | b[i++] = 255 & x;
68 | var _ = y / 4294967296 * 1e4 & 268435455;
69 | b[i++] = _ >>> 8 & 255,
70 | b[i++] = 255 & _,
71 | b[i++] = _ >>> 24 & 15 | 16,
72 | b[i++] = _ >>> 16 & 255,
73 | b[i++] = v >>> 8 | 128,
74 | b[i++] = 255 & v;
75 | for (var A = 0; A < 6; ++A) b[i + A] = f[A];
76 | return e || c(b)
77 | }
78 | },
79 | function (t, e) {
80 | var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof window.msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto);
81 | if (n) {
82 | var r = new Uint8Array(16);
83 | t.exports = function () {
84 | return n(r),
85 | r
86 | }
87 | } else {
88 | var o = new Array(16);
89 | t.exports = function () {
90 | for (var t, i = 0; i < 16; i++) 0 == (3 & i) && (t = 4294967296 * Math.random()),
91 | o[i] = t >>> ((3 & i) << 3) & 255;
92 | return o
93 | }
94 | }
95 | },
96 | function (t, e) {
97 | for (var n = [], i = 0; i < 256; ++i) n[i] = (i + 256).toString(16).substr(1);
98 | t.exports = function (t, e) {
99 | var i = e || 0,
100 | r = n;
101 | return [r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]]].join("")
102 | }
103 | }
104 | ])
105 |
106 | function getReqId() {
107 | var l = kuwo(0),
108 | c = kuwo.n(l),
109 | r = c()()
110 | return r
111 | }
112 |
113 | // console.log(getReqId())
114 |
--------------------------------------------------------------------------------
/www_kuwo_cn/get_reqId_3.js:
--------------------------------------------------------------------------------
1 | var f109 = function(t, e, n) {
2 | var r, o, l = n(1),
3 | c = n(2),
4 | h = 0,
5 | d = 0;
6 | t.exports = function(t, e, n) {
7 | var i = e && n || 0,
8 | b = e || [],
9 | f = (t = t || {}).node || r,
10 | v = void 0 !== t.clockseq ? t.clockseq: o;
11 | if (null == f || null == v) {
12 | var m = l();
13 | null == f && (f = r = [1 | m[0], m[1], m[2], m[3], m[4], m[5]]),
14 | null == v && (v = o = 16383 & (m[6] << 8 | m[7]))
15 | }
16 | var y = void 0 !== t.msecs ? t.msecs: (new Date).getTime(),
17 | w = void 0 !== t.nsecs ? t.nsecs: d + 1,
18 | dt = y - h + (w - d) / 1e4;
19 | if (dt < 0 && void 0 === t.clockseq && (v = v + 1 & 16383), (dt < 0 || y > h) && void 0 === t.nsecs && (w = 0), w >= 1e4) throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
20 | h = y,
21 | d = w,
22 | o = v;
23 | var x = (1e4 * (268435455 & (y += 122192928e5)) + w) % 4294967296;
24 | b[i++] = x >>> 24 & 255,
25 | b[i++] = x >>> 16 & 255,
26 | b[i++] = x >>> 8 & 255,
27 | b[i++] = 255 & x;
28 | var _ = y / 4294967296 * 1e4 & 268435455;
29 | b[i++] = _ >>> 8 & 255,
30 | b[i++] = 255 & _,
31 | b[i++] = _ >>> 24 & 15 | 16,
32 | b[i++] = _ >>> 16 & 255,
33 | b[i++] = v >>> 8 | 128,
34 | b[i++] = 255 & v;
35 | for (var A = 0; A < 6; ++A) b[i + A] = f[A];
36 | return e || c(b)
37 | }
38 | };
39 | var f202 = function(t, e) {
40 | var n = "undefined" != typeof crypto && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && "function" == typeof window.msCrypto.getRandomValues && msCrypto.getRandomValues.bind(msCrypto);
41 | if (n) {
42 | var r = new Uint8Array(16);
43 | t.exports = function() {
44 | return n(r),
45 | r
46 | }
47 | } else {
48 | var o = new Array(16);
49 | t.exports = function() {
50 | for (var t, i = 0; i < 16; i++) 0 == (3 & i) && (t = 4294967296 * Math.random()),
51 | o[i] = t >>> ((3 & i) << 3) & 255;
52 | return o
53 | }
54 | }
55 | };
56 | var f203 = function(t, e) {
57 | for (var n = [], i = 0; i < 256; ++i) n[i] = (i + 256).toString(16).substr(1);
58 | t.exports = function(t, e) {
59 | var i = e || 0,
60 | r = n;
61 | return [r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], "-", r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]], r[t[i++]]].join("")
62 | }
63 | };
64 |
65 | var e = [f109, f202, f203];
66 |
67 | function d(n) {
68 | var t = {};
69 | if (t[n]) return t[n].exports;
70 | var r = t[n] = {
71 | i: n,
72 | l: !1,
73 | exports: {}
74 | };
75 | return e[n].call(r.exports, r, r.exports, d),
76 | r.l = !0,
77 | r.exports
78 | }
79 |
80 | d.n = function(e) {
81 | var n = e && e.__esModule ?
82 | function() {
83 | return e.
84 | default
85 | }:
86 | function() {
87 | return e
88 | };
89 | return d.d(n, "a", n),
90 | n
91 | },
92 | d.d = function(e, n, r) {
93 | d.o(e, n) || Object.defineProperty(e, n, {
94 | enumerable: !0,
95 | get: r
96 | })
97 | },
98 | d.o = function(object, e) {
99 | return Object.prototype.hasOwnProperty.call(object, e)
100 | };
101 |
102 | function getReqId() {
103 | var l = d(0),
104 | c = d.n(l),
105 | r = c()()
106 | return r
107 | }
108 |
109 | // console.log(getReqId())
--------------------------------------------------------------------------------
/www_kuwo_cn/kuwo_search.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-11-02
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: kuwo_search.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import execjs
11 | import requests
12 |
13 |
14 | host = "www.kuwo.cn"
15 | index_url = "http://www.kuwo.cn/search/list"
16 | search_url = "http://www.kuwo.cn/api/www/search/searchMusicBykeyWord"
17 | session = requests.session()
18 | UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
19 |
20 |
21 | def get_get_req_id():
22 | with open('get_reqId.js', 'r', encoding='utf-8') as f:
23 | req_id_js = f.read()
24 | req_id = execjs.compile(req_id_js).call('getReqId')
25 | return req_id
26 |
27 |
28 | def get_kw_token(music_name):
29 | headers = {"User-Agent": UA}
30 | params = {"key": music_name}
31 | response = session.get(url=index_url, params=params, headers=headers)
32 | kw_token = response.cookies.get_dict()["kw_token"]
33 | return kw_token
34 |
35 |
36 | def search_music(music_name, req_id, kw_token):
37 | headers = {
38 | "Referer": index_url,
39 | "csrf": kw_token,
40 | "Host": host,
41 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
42 | }
43 | params = {
44 | "key": music_name,
45 | "httpsStatus": 1,
46 | "pn": 1,
47 | "rn": 30,
48 | "reqId": req_id
49 | }
50 | response = session.get(url=search_url, params=params, headers=headers)
51 | print(response.text)
52 |
53 |
54 | def main():
55 | music_name = input("请输入音乐名称:")
56 | req_id = get_get_req_id()
57 | kw_token = get_kw_token(music_name)
58 | search_music(music_name, req_id, kw_token)
59 |
60 |
61 | if __name__ == '__main__':
62 | main()
63 |
--------------------------------------------------------------------------------
/www_lagou_com/main.py:
--------------------------------------------------------------------------------
1 | # =============================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2022-03-03
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: main.py
6 | # @Software: PyCharm
7 | # @notice : 有些参数并不是必须的,写死或者不要都行,
8 | # 文章中有说明,可根据你实际情况自行修改
9 | # =============================================
10 |
11 |
12 | import time
13 | import json
14 | import execjs
15 | import requests
16 | from lxml import etree
17 | from urllib import parse
18 |
19 |
20 | aes_key = ""
21 | secret_key_value = ""
22 |
23 | with open('lagou.js', 'r', encoding='utf-8') as f:
24 | lagou_js = execjs.compile(f.read())
25 |
26 | UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
27 |
28 | x_anit = {
29 | "x-anit-forge-code": "0",
30 | "x-anit-forge-token": None
31 | }
32 |
33 | global_cookies = {
34 | # - 如果 IP 被拉黑,访问需要登录,或者提示太频繁,那么就需要那么就需要补全登录后的 cookie!
35 | # - 以下所有值都必须在登录后再复制过来,特别是 JSESSIONID,没登录得到的 JSESSIONID 是无效的!
36 | # - 经过测试主要是以下三个 cookie 起作用,能保持登录:login、gate_login_token、_putrc
37 | # - 还有一个 JSESSIONID 值,主要是用来获取请求头 x-anit-forge-code 和 x-anit-forge-token
38 |
39 | # "login": "true",
40 | # "gate_login_token": "",
41 | # "_putrc": "",
42 | # "JSESSIONID": ""
43 | }
44 |
45 |
46 | def get_user_trace_token() -> str:
47 | # 获取 cookie 中的 user_trace_token
48 | json_url = "https://a.lagou.com/json"
49 | headers = {
50 | "Host": "a.lagou.com",
51 | "Referer": "https://www.lagou.com/",
52 | "User-Agent": UA
53 | }
54 | params = {
55 | "lt": "trackshow",
56 | "t": "ad",
57 | "v": 0,
58 | "dl": "https://www.lagou.com/",
59 | "dr": "https://www.lagou.com",
60 | "time": str(int(time.time() * 1000))
61 | }
62 | response = requests.get(url=json_url, headers=headers, params=params)
63 | user_trace_token = response.cookies.get_dict()["user_trace_token"]
64 | return user_trace_token
65 |
66 |
67 | def get_lg_stoken(original_data: dict) -> str:
68 | # 获取 cookie 中的 __lg_stoken__
69 | token_url = "https://www.lagou.com/wn/jobs"
70 | token_headers = {
71 | "Host": "www.lagou.com",
72 | "Referer": "https://www.lagou.com/",
73 | "User-Agent": UA
74 | }
75 | params = {
76 | "kd": original_data["kd"],
77 | "city": original_data["city"]
78 | }
79 | token_response = requests.get(url=token_url, params=params, headers=token_headers, cookies=global_cookies, allow_redirects=False)
80 | if token_response.status_code != 302:
81 | raise Exception("获取跳转链接异常!检查 global_cookies 是否已包含 __lg_stoken__!")
82 | # 获取 302 跳转的地址
83 | security_check_url = token_response.headers["Location"]
84 | if "login" in security_check_url:
85 | raise Exception("IP 被关进小黑屋啦!需要登录!请补全登录后的 Cookie,或者自行添加代理!")
86 | parse_result = parse.urlparse(security_check_url)
87 | # url 的参数为待加密对象
88 | security_check_params = parse_result.query
89 | # 取 name 参数,为混淆 js 的文件名
90 | security_check_js_name = parse.parse_qs(security_check_params)["name"][0]
91 |
92 | # 发送请求,获取混淆的 js
93 | js_url = "https://www.lagou.com/common-sec/dist/" + security_check_js_name + ".js"
94 | js_headers = {
95 | "Host": "www.lagou.com",
96 | "Referer": security_check_url,
97 | "User-Agent": UA
98 | }
99 | js_response = requests.get(url=js_url, headers=js_headers, cookies=global_cookies).text
100 | # 补全 js,添加 window 参数和一个方法,用于获取 __lg_stoken__ 的值
101 | lg_js = """
102 | window = {
103 | "location": {
104 | "hostname": "www.lagou.com",
105 | "search": '?%s'
106 | }
107 | }
108 | function getLgStoken(){
109 | return window.gt.prototype.a()
110 | }
111 | """ % security_check_params + js_response
112 |
113 | lg_stoken = execjs.compile(lg_js).call("getLgStoken")
114 | return lg_stoken
115 |
116 |
117 | def update_cookies(original_data: dict) -> None:
118 | global global_cookies
119 | # 获取 user_trace_token
120 | user_trace_token = get_user_trace_token()
121 | # 获取 X_HTTP_TOKEN
122 | x_http_token = lagou_js.call("getXHttpToken", "user_trace_token=" + user_trace_token)
123 | # 第一次更新全局 cookies,后续获取 __lg_stoken__ 会用到
124 | global_cookies.update({
125 | "user_trace_token": user_trace_token,
126 | "X_HTTP_TOKEN": x_http_token
127 | })
128 |
129 | # 获取 __lg_stoken__
130 | lg_stoken = get_lg_stoken(original_data)
131 | # 第二次更新全局 cookies
132 | global_cookies.update({
133 | "__lg_stoken__": lg_stoken,
134 | })
135 |
136 |
137 | def update_aes_key() -> None:
138 | # 通过JS获取 AES Key,并通过接口激活,接口激活后会返回一个 secretKeyValue,后续请求头会用到
139 | global aes_key, secret_key_value
140 | url = "https://gate.lagou.com/system/agreement"
141 | headers = {
142 | "Content-Type": "application/json",
143 | "Host": "gate.lagou.com",
144 | "Origin": "https://www.lagou.com",
145 | "Referer": "https://www.lagou.com/",
146 | "User-Agent": UA
147 | }
148 | encrypt_data = lagou_js.call("getAesKeyAndRsaEncryptData")
149 | aes_key = encrypt_data["aesKey"]
150 | rsa_encrypt_data = encrypt_data["rsaEncryptData"]
151 | data = {"secretKeyDecode": rsa_encrypt_data}
152 | response = requests.post(url=url, headers=headers, json=data).json()
153 | secret_key_value = response["content"]["secretKeyValue"]
154 |
155 |
156 | def update_x_anit(original_data: dict) -> None:
157 | # 更新 x-anit-forge-code 和 x-anit-forge-token
158 | url = "https://www.lagou.com/wn/jobs"
159 | headers = {
160 | "Host": "www.lagou.com",
161 | "Referer": "https://www.lagou.com/",
162 | "User-Agent": UA
163 | }
164 | params = {
165 | "kd": original_data["kd"],
166 | "city": original_data["city"]
167 | }
168 | response = requests.get(url=url, params=params, headers=headers, cookies=global_cookies)
169 | tree = etree.HTML(response.text)
170 | next_data_json = json.loads(tree.xpath("//script[@id='__NEXT_DATA__']/text()")[0])
171 | submit_code = next_data_json["props"]["tokenData"]["submitCode"]
172 | submit_token = next_data_json["props"]["tokenData"]["submitToken"]
173 | # 注意 JSESSIONID 必须是登录验证后的!
174 | if not submit_code or not submit_token:
175 | raise Exception("submitCode & submitToken 为空,请检查 JSESSIONID 是否正确!")
176 | global x_anit
177 | x_anit["x-anit-forge-code"] = submit_code
178 | x_anit["x-anit-forge-token"] = submit_token
179 |
180 |
181 | def get_header_params(original_data: dict) -> dict:
182 | # 后续请求数据所需的请求头参数
183 | # 职位搜索 URL,如果是搜索公司,那就是 https://www.lagou.com/jobs/companyAjax.json,根据实际情况更改
184 | u = "https://www.lagou.com/jobs/v2/positionAjax.json"
185 | return {
186 | "traceparent": lagou_js.call("getTraceparent"),
187 | "X-K-HEADER": secret_key_value,
188 | "X-S-HEADER": lagou_js.call("getXSHeader", aes_key, original_data, u),
189 | "X-SS-REQ-HEADER": json.dumps({"secret": secret_key_value})
190 | }
191 |
192 |
193 | def get_encrypted_data(original_data: dict) -> str:
194 | # AES 加密原始数据
195 | encrypted_data = lagou_js.call("getRequestData", aes_key, original_data)
196 | return encrypted_data
197 |
198 |
199 | def get_data(original_data: dict, encrypted_data: str, header_params: dict) -> dict:
200 | # 携带加密后的请求数据和完整请求头,拿到密文,AES 解密得到明文职位信息
201 | url = "https://www.lagou.com/jobs/v2/positionAjax.json"
202 | referer = parse.urljoin("https://www.lagou.com/wn/jobs?", parse.urlencode(original_data))
203 | headers = {
204 | # "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
205 | "Host": "www.lagou.com",
206 | "Origin": "https://www.lagou.com",
207 | "Referer": referer,
208 | "traceparent": header_params["traceparent"],
209 | "User-Agent": UA,
210 | "X-K-HEADER": header_params["X-K-HEADER"],
211 | "X-S-HEADER": header_params["X-S-HEADER"],
212 | "X-SS-REQ-HEADER": header_params["X-SS-REQ-HEADER"],
213 | }
214 | # 添加 x-anit-forge-code 和 x-anit-forge-token
215 | headers.update(x_anit)
216 |
217 | data = {"data": encrypted_data}
218 | response = requests.post(url=url, headers=headers, cookies=global_cookies, data=data).json()
219 | if "status" in response:
220 | if not response["status"] and "操作太频繁" in response["msg"]:
221 | raise Exception("获取数据失败!msg:%s!可以尝试补全登录后的 Cookies,或者添加代理!" % response["msg"])
222 | else:
223 | raise Exception("获取数据异常!请检查数据是否完整!")
224 | else:
225 | response_data = response["data"]
226 | decrypted_data = lagou_js.call("getResponseData", response_data, aes_key)
227 | return decrypted_data
228 |
229 |
230 | def main():
231 | # 初始化设置标识
232 | need_init = True
233 |
234 | # 要搜索的原始数据,例如爬取最新的10页全国Java岗位
235 | for pn in range(1, 10):
236 | original_data = {
237 | "city": "全国", # 城市范围
238 | "pn": pn, # 页码
239 | "kd": "Java", # 关键词
240 | "px": "new" # 排序方式,new:最新,default:默认
241 | }
242 |
243 | while need_init:
244 | # 初始化设置各项参数,这些参数只需要设置一次就行了,后续请求可以复用
245 | # 获取必要的 cookies,主要是 user_trace_token、X_HTTP_TOKEN、__lg_stoken__
246 | update_cookies(original_data)
247 | # 获取并激活 AES Key,不激活无法使用
248 | update_aes_key()
249 | # 如果登录了账号,则获取职位的请求 header 多了两个参数,x-anit-forge-code 和 x-anit-forge-token
250 | # 在实际测试中,不加这两个值,或者随机值都行,严谨起见还是正常获取一下
251 | if "login" in global_cookies:
252 | update_x_anit(original_data)
253 | need_init = False
254 |
255 | # 获取请求头各参数:X-K-HEADER、X-S-HEADER、X-SS-REQ-HEADER、traceparent
256 | header_params = get_header_params(original_data)
257 | # 将要搜索的原始数据进行 AES 加密
258 | encrypted_data = get_encrypted_data(original_data)
259 | # 发起请求,获取加密数据并解密成明文
260 | data = get_data(original_data, encrypted_data, header_params)
261 | print(data)
262 |
263 |
264 | if __name__ == '__main__':
265 | main()
266 |
--------------------------------------------------------------------------------
/www_xinshangmeng_com/xinshangmeng_encrypt.js:
--------------------------------------------------------------------------------
1 | /*
2 | # ==================================
3 | # --*-- coding: utf-8 --*--
4 | # @Time : 2021-09-07
5 | # @Author : 微信公众号:K哥爬虫
6 | # @FileName: xinshangmeng_encrypt.js
7 | # @Software: PyCharm
8 | # ==================================
9 | */
10 |
11 | function getEncryptedPassword(a, b, c) {
12 | // a: 用户名, b: 密码, c: 验证码
13 | function d(a) {
14 | return n(e(o(m(a + "{1#2$3%4(5)6@7!poeeww$3%4(5)djjkkldss}")), 32))
15 | }
16 |
17 | function e(a, b) {
18 | for (var c = 1732584193, d = -271733879, e = -1732584194, f = 271733878, l = 0; l < a.length; l += 16) {
19 | var m = c
20 | , n = d
21 | , o = e
22 | , p = f;
23 | c = g(c, d, e, f, a[l + 0], 7, -680876936),
24 | f = g(f, c, d, e, a[l + 1], 12, -389564586),
25 | e = g(e, f, c, d, a[l + 2], 17, 606105819),
26 | d = g(d, e, f, c, a[l + 3], 22, -1044525330),
27 | c = g(c, d, e, f, a[l + 4], 7, -176418897),
28 | f = g(f, c, d, e, a[l + 5], 12, 1200080426),
29 | e = g(e, f, c, d, a[l + 6], 17, -1473231341),
30 | d = g(d, e, f, c, a[l + 7], 22, -45705983),
31 | c = g(c, d, e, f, a[l + 8], 7, 1770035416),
32 | f = g(f, c, d, e, a[l + 9], 12, -1958414417),
33 | e = g(e, f, c, d, a[l + 10], 17, -42063),
34 | d = g(d, e, f, c, a[l + 11], 22, -1990404162),
35 | c = g(c, d, e, f, a[l + 12], 7, 1804603682),
36 | f = g(f, c, d, e, a[l + 13], 12, -40341101),
37 | e = g(e, f, c, d, a[l + 14], 17, -1502002290),
38 | d = g(d, e, f, c, a[l + 15], 22, 1236535329),
39 | c = h(c, d, e, f, a[l + 1], 5, -165796510),
40 | f = h(f, c, d, e, a[l + 6], 9, -1069501632),
41 | e = h(e, f, c, d, a[l + 11], 14, 643717713),
42 | d = h(d, e, f, c, a[l + 0], 20, -373897302),
43 | c = h(c, d, e, f, a[l + 5], 5, -701558691),
44 | f = h(f, c, d, e, a[l + 10], 9, 38016083),
45 | e = h(e, f, c, d, a[l + 15], 14, -660478335),
46 | d = h(d, e, f, c, a[l + 4], 20, -405537848),
47 | c = h(c, d, e, f, a[l + 9], 5, 568446438),
48 | f = h(f, c, d, e, a[l + 14], 9, -1019803690),
49 | e = h(e, f, c, d, a[l + 3], 14, -187363961),
50 | d = h(d, e, f, c, a[l + 8], 20, 1163531501),
51 | c = h(c, d, e, f, a[l + 13], 5, -1444681467),
52 | f = h(f, c, d, e, a[l + 2], 9, -51403784),
53 | e = h(e, f, c, d, a[l + 7], 14, 1735328473),
54 | d = h(d, e, f, c, a[l + 12], 20, -1926607734),
55 | c = i(c, d, e, f, a[l + 5], 4, -378558),
56 | f = i(f, c, d, e, a[l + 8], 11, -2022574463),
57 | e = i(e, f, c, d, a[l + 11], 16, 1839030562),
58 | d = i(d, e, f, c, a[l + 14], 23, -35309556),
59 | c = i(c, d, e, f, a[l + 1], 4, -1530992060),
60 | f = i(f, c, d, e, a[l + 4], 11, 1272893353),
61 | e = i(e, f, c, d, a[l + 7], 16, -155497632),
62 | d = i(d, e, f, c, a[l + 10], 23, -1094730640),
63 | c = i(c, d, e, f, a[l + 13], 4, 681279174),
64 | f = i(f, c, d, e, a[l + 0], 11, -358537222),
65 | e = i(e, f, c, d, a[l + 3], 16, -722521979),
66 | d = i(d, e, f, c, a[l + 6], 23, 76029189),
67 | c = i(c, d, e, f, a[l + 9], 4, -640364487),
68 | f = i(f, c, d, e, a[l + 12], 11, -421815835),
69 | e = i(e, f, c, d, a[l + 15], 16, 530742520),
70 | d = i(d, e, f, c, a[l + 2], 23, -995338651),
71 | c = j(c, d, e, f, a[l + 0], 6, -198630844),
72 | f = j(f, c, d, e, a[l + 7], 10, 1126891415),
73 | e = j(e, f, c, d, a[l + 14], 15, -1416354905),
74 | d = j(d, e, f, c, a[l + 5], 21, -57434055),
75 | c = j(c, d, e, f, a[l + 12], 6, 1700485571),
76 | f = j(f, c, d, e, a[l + 3], 10, -1894986606),
77 | e = j(e, f, c, d, a[l + 10], 15, -1051523),
78 | d = j(d, e, f, c, a[l + 1], 21, -2054922799),
79 | c = j(c, d, e, f, a[l + 8], 6, 1873313359),
80 | f = j(f, c, d, e, a[l + 15], 10, -30611744),
81 | e = j(e, f, c, d, a[l + 6], 15, -1560198380),
82 | d = j(d, e, f, c, a[l + 13], 21, 1309151649),
83 | c = j(c, d, e, f, a[l + 4], 6, -145523070),
84 | f = j(f, c, d, e, a[l + 11], 10, -1120210379),
85 | e = j(e, f, c, d, a[l + 2], 15, 718787259),
86 | d = j(d, e, f, c, a[l + 9], 21, -343485551),
87 | c = k(c, m),
88 | d = k(d, n),
89 | e = k(e, o),
90 | f = k(f, p)
91 | }
92 | return new Array(c, d, e, f)
93 | }
94 |
95 | function f(a, b, c, d, e, f) {
96 | return k(l(k(k(b, a), k(d, f)), e), c)
97 | }
98 |
99 | function g(a, b, c, d, e, g, h) {
100 | return f(b & c | ~b & d, a, b, e, g, h)
101 | }
102 |
103 | function h(a, b, c, d, e, g, h) {
104 | return f(b & d | c & ~d, a, b, e, g, h)
105 | }
106 |
107 | function i(a, b, c, d, e, g, h) {
108 | return f(b ^ c ^ d, a, b, e, g, h)
109 | }
110 |
111 | function j(a, b, c, d, e, g, h) {
112 | return f(c ^ (b | ~d), a, b, e, g, h)
113 | }
114 |
115 | function k(a, b) {
116 | var c = (65535 & a) + (65535 & b);
117 | return (a >> 16) + (b >> 16) + (c >> 16) << 16 | 65535 & c
118 | }
119 |
120 | function l(a, b) {
121 | return a << b | a >>> 32 - b
122 | }
123 |
124 | function m(a) {
125 | for (var b = a.length, c = new Array(b), d = 0; d < b; d++) {
126 | var e = a.charCodeAt(d);
127 | c[d] = 255 & e
128 | }
129 | return c
130 | }
131 |
132 | function n(a) {
133 | for (var b = "0123456789abcdef", c = "", d = 0; d < 4 * a.length; d++)
134 | c += b.charAt(a[d >> 2] >> d % 4 * 8 + 4 & 15) + b.charAt(a[d >> 2] >> d % 4 * 8 & 15);
135 | return c
136 | }
137 |
138 | function o(a) {
139 | for (var b = 1 + (a.length + 8 >> 6), c = new Array(16 * b), d = 0; d < 16 * b; d++)
140 | c[d] = 0;
141 | for (var e = 0; e < a.length; e++)
142 | c[e >> 2] |= (255 & a[e]) << e % 4 * 8;
143 | return c[e >> 2] |= 128 << e % 4 * 8,
144 | c[16 * b - 2] = 8 * a.length,
145 | c
146 | }
147 |
148 | c.hex_md5 = d
149 | b = d(d(b) + c);
150 | return b
151 | }
152 |
153 | // 测试样例
154 | // console.log(getEncryptedPassword('123123', '1231234', '6798'))
155 |
--------------------------------------------------------------------------------
/www_xinshangmeng_com/xinshangmeng_login.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-09-07
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: xinshangmeng_login.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import time
11 | import random
12 |
13 | import execjs
14 | import requests
15 | from PIL import Image
16 |
17 |
18 | index_url = 'http://www.xinshangmeng.com/xsm2/?Version=2021061900'
19 | login_url = 'http://login.xinshangmeng.com/login/users/dologin/dfaup'
20 | ver_code_url = 'https://login.xinshangmeng.com/login/users/forlogin/img'
21 | headers = {
22 | 'Referer': 'http://www.xinshangmeng.com/',
23 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'
24 | }
25 | session = requests.session()
26 |
27 |
28 | def get_verification_code():
29 | response = session.get(url=ver_code_url, headers=headers)
30 | with open('code.png', 'wb') as f:
31 | f.write(response.content)
32 | image = Image.open('code.png')
33 | image.show()
34 | code = input('请输入验证码: ')
35 | return code
36 |
37 |
38 | def get_encrypted_password(username, password, code):
39 | with open('xinshangmeng_encrypt.js', 'r', encoding='utf-8') as f:
40 | xinshangmeng_js = f.read()
41 | encrypted_password = execjs.compile(xinshangmeng_js).call('getEncryptedPassword', username, password, code)
42 | return encrypted_password
43 |
44 |
45 | def login(username, encrypted_password, code):
46 | timestamp = str(round(time.time() * 1000))
47 | jsonp = ''
48 | for _ in range(20):
49 | jsonp += str(random.randint(0, 9))
50 | jsonp = 'jQuery' + jsonp + '_' + timestamp
51 | params = {
52 | 'jsonp': jsonp,
53 | 'protocol': ' http:',
54 | 'loginIndex': index_url,
55 | 'j_mmrm': username,
56 | 'j_mcmm': encrypted_password,
57 | 'j_valcode': code,
58 | '_': timestamp
59 | }
60 | response = session.get(url=login_url, params=params, headers=headers)
61 | response.encoding = 'utf-8'
62 | print(response.text)
63 |
64 |
65 | def main():
66 | username = input('请输入登录账号: ')
67 | password = input('请输入登录密码: ')
68 | code = get_verification_code()
69 | encrypted_pwd = get_encrypted_password(username, password, code)
70 | login(username, encrypted_pwd, code)
71 |
72 |
73 | if __name__ == '__main__':
74 | main()
75 |
--------------------------------------------------------------------------------
/xueqiu_com/get_acw_sc_v2.js:
--------------------------------------------------------------------------------
1 | /* ==================================
2 | # @Time : 2021-12-29
3 | # @Author : 微信公众号:K哥爬虫
4 | # @FileName: get_acw_sc_v2.js
5 | # @Software: PyCharm
6 | # ================================== */
7 |
8 | var _0x5e8b26 = '3000176000856006061501533003690027800375'
9 |
10 | var getAcwScV2 = function (arg1) {
11 | String['prototype']['hexXor'] = function (_0x4e08d8) {
12 | var _0x5a5d3b = '';
13 | for (var _0xe89588 = 0x0; _0xe89588 < this['length'] && _0xe89588 < _0x4e08d8['length']; _0xe89588 += 0x2) {
14 | var _0x401af1 = parseInt(this['slice'](_0xe89588, _0xe89588 + 0x2), 0x10);
15 | var _0x105f59 = parseInt(_0x4e08d8['slice'](_0xe89588, _0xe89588 + 0x2), 0x10);
16 | var _0x189e2c = (_0x401af1 ^ _0x105f59)['toString'](0x10);
17 | if (_0x189e2c['length'] == 0x1) {
18 | _0x189e2c = '0' + _0x189e2c;
19 | }
20 | _0x5a5d3b += _0x189e2c;
21 | }
22 | return _0x5a5d3b;
23 | };
24 | String['prototype']['unsbox'] = function () {
25 | var _0x4b082b = [0xf, 0x23, 0x1d, 0x18, 0x21, 0x10, 0x1, 0x26, 0xa, 0x9, 0x13, 0x1f, 0x28, 0x1b, 0x16, 0x17, 0x19, 0xd, 0x6, 0xb, 0x27, 0x12, 0x14, 0x8, 0xe, 0x15, 0x20, 0x1a, 0x2, 0x1e, 0x7, 0x4, 0x11, 0x5, 0x3, 0x1c, 0x22, 0x25, 0xc, 0x24];
26 | var _0x4da0dc = [];
27 | var _0x12605e = '';
28 | for (var _0x20a7bf = 0x0; _0x20a7bf < this['length']; _0x20a7bf++) {
29 | var _0x385ee3 = this[_0x20a7bf];
30 | for (var _0x217721 = 0x0; _0x217721 < _0x4b082b['length']; _0x217721++) {
31 | if (_0x4b082b[_0x217721] == _0x20a7bf + 0x1) {
32 | _0x4da0dc[_0x217721] = _0x385ee3;
33 | }
34 | }
35 | }
36 | _0x12605e = _0x4da0dc['join']('');
37 | return _0x12605e;
38 | };
39 | var _0x23a392 = arg1['unsbox']();
40 | arg2 = _0x23a392['hexXor'](_0x5e8b26);
41 | return arg2
42 | };
43 |
44 | // 测试输出
45 | // var arg1 = '2410463826D86A52A5BB43A13A80BAE6C4122A73';
46 | // console.log(getAcwScV2(arg1))
47 |
--------------------------------------------------------------------------------
/xueqiu_com/main.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-12-29
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: main.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import re
11 | import execjs
12 | import requests
13 |
14 |
15 | index_url = "https://xueqiu.com/today"
16 | news_test_url = "https://xueqiu.com/statuses/hot/listV2.json?since_id=-1&max_id=294528&size=15"
17 | headers = {
18 | "Host": "xueqiu.com",
19 | "Referer": "https://xueqiu.com/today",
20 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
21 | }
22 |
23 |
24 | def get_complete_cookie():
25 | complete_cookie = {}
26 | # 第一次不带参数访问首页,获取 acw_tc 和 acw_sc__v2
27 | response = requests.get(url=index_url, headers=headers)
28 | complete_cookie.update(response.cookies.get_dict())
29 | arg1 = re.findall("arg1='(.*?)'", response.text)[0]
30 | with open('get_acw_sc_v2.js', 'r', encoding='utf-8') as f:
31 | acw_sc_v2_js = f.read()
32 | acw_sc__v2 = execjs.compile(acw_sc_v2_js).call('getAcwScV2', arg1)
33 | complete_cookie.update({"acw_sc__v2": acw_sc__v2})
34 | # 第二次访问首页,获取其他 cookies
35 | response2 = requests.get(url=index_url, headers=headers, cookies=complete_cookie)
36 | complete_cookie.update(response2.cookies.get_dict())
37 | return complete_cookie
38 |
39 |
40 | def news_test(cookies):
41 | response = requests.get(url=news_test_url, headers=headers, cookies=cookies)
42 | print(response.json())
43 |
44 |
45 | if __name__ == '__main__':
46 | complete_cookie = get_complete_cookie()
47 | news_test(complete_cookie)
48 |
--------------------------------------------------------------------------------
/yrx_2/yrx2.py:
--------------------------------------------------------------------------------
1 | # =======================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2022/9/8
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: yrx5.py
6 | # @Software: PyCharm
7 | # =======================
8 |
9 | import execjs
10 | import requests
11 | import re
12 |
13 |
14 | def get_cookie_m():
15 | heat_total = 0
16 | for page_num in range(1, 6):
17 | with open('yrx2.js', 'r', encoding='utf-8') as f:
18 | encrypt = f.read()
19 | cookie_m = execjs.compile(encrypt).call('getCookie')
20 | headers = {
21 | "user-agent": "yuanrenxue,project",
22 | }
23 | cookies = {
24 | # 填入自己的 sessionid
25 | "sessionid": " your sessionid ",
26 | "m": cookie_m
27 | }
28 | url = "https://match.yuanrenxue.com/api/match/2?page=%s" % page_num
29 | response = requests.get(url, headers=headers, cookies=cookies)
30 | for i in range(10):
31 | value = response.json()['data'][i]
32 | heat = re.findall(r"'value': (.*?)}", str(value))[0]
33 | heat_total += int(heat)
34 | print(heat_total)
35 |
36 |
37 | if __name__ == '__main__':
38 | get_cookie_m()
39 |
--------------------------------------------------------------------------------
/yrx_5/yrx5.js:
--------------------------------------------------------------------------------
1 | var _0x4e96b4 = window = {};
2 | var _0x1171c8 = 0x67452301;
3 | var _0x4dae05 = -0x10325477;
4 | var _0x183a1d = -0x67452302;
5 | var _0xcfa373 = 0x10325476;
6 | var _0x30bc70 = String;
7 |
8 | function _0x48d200(_0x4b706e, _0x3c3a85, _0x111154, _0x311f9f, _0x5439cf, _0x38cac7, _0x26bd2e) {
9 | return _0xaaef84(_0x3c3a85 & _0x111154 | ~_0x3c3a85 & _0x311f9f, _0x4b706e, _0x3c3a85, _0x5439cf, _0x38cac7, _0x26bd2e);
10 | }
11 |
12 | function _0x12e4a8(_0x7542c8, _0x5eada0) {
13 | var _0x41f81f = (0xffff & _0x7542c8) + (0xffff & _0x5eada0);
14 | return (_0x7542c8 >> 0x10) + (_0x5eada0 >> 0x10) + (_0x41f81f >> 0x10) << 0x10 | 0xffff & _0x41f81f;
15 | }
16 |
17 | function _0x3634fc(_0x5803ba, _0x1ce5b2) {
18 | return _0x5803ba << _0x1ce5b2 | _0x5803ba >>> 0x20 - _0x1ce5b2;
19 | }
20 |
21 | function _0x3180ec(_0x401705, _0x240e6a, _0x56b131, _0x5a5c20, _0x1f2a72, _0x2bfc1, _0x19741a) {
22 | return _0xaaef84(_0x240e6a & _0x5a5c20 | _0x56b131 & ~_0x5a5c20, _0x401705, _0x240e6a, _0x1f2a72, _0x2bfc1, _0x19741a);
23 | }
24 |
25 | function _0x32032f(_0x520fdf, _0x13921d, _0x1af9d5, _0x4a2311, _0xb6d40a, _0x1d58da, _0x361df0) {
26 | return _0xaaef84(_0x13921d ^ _0x1af9d5 ^ _0x4a2311, _0x520fdf, _0x13921d, _0xb6d40a, _0x1d58da, _0x361df0);
27 | }
28 |
29 | function _0x4b459d(_0x8d8f2a, _0x406d34, _0x53e7d7, _0x26c827, _0xec41ea, _0x52dead, _0x3f66e7) {
30 | return _0xaaef84(_0x53e7d7 ^ (_0x406d34 | ~_0x26c827), _0x8d8f2a, _0x406d34, _0xec41ea, _0x52dead, _0x3f66e7);
31 | }
32 |
33 | function _0xaaef84(_0xaf3112, _0x2a165a, _0x532fb4, _0x10aa40, _0x41c4e7, _0x1cb4da) {
34 | return _0x12e4a8(_0x3634fc(_0x12e4a8(_0x12e4a8(_0x2a165a, _0xaf3112), _0x12e4a8(_0x10aa40, _0x1cb4da)), _0x41c4e7), _0x532fb4);
35 | }
36 |
37 | function _0x11a7a2(_0x193f00, _0x1cfe89) {
38 | _0x193f00[_0x1cfe89 >> 0x5] |= 0x80 << _0x1cfe89 % 0x20,
39 | _0x193f00[0xe + (_0x1cfe89 + 0x40 >>> 0x9 << 0x4)] = _0x1cfe89;
40 | try {
41 | var _0x42fb36 = 16;
42 | } catch (_0x1b1b35) {
43 | var _0x42fb36 = 0x1;
44 | }
45 | try {
46 | _0x4e96b4['$_z2'][0x0] = 'Q';
47 | } catch (_0x4c574d) {
48 | try {
49 | var op = 26;;
50 | } catch (_0x58af26) {
51 | var _0x3b7935 = 0x0;
52 | for (var _0x1badc3 = 0x0; _0x1badc3 < 0xf4240; _0x1badc3++) {
53 | _0x3b7935 = _0x3b7935 + _0x1badc3["toString"]();
54 | history['pushState'](0x0, 0x0, _0x3b7935);
55 | }
56 | }
57 | if (op > 0x14) {
58 | eval('b64pad = 1;');
59 | } else if (op < 0xa) {
60 | _0x4e96b4['$_zw'] = [0x1, 0x8, 0x2, 0x4, 0x17, 0x2d, 0x8, 0xf, 0x51, 0x44, 0xd, 0x48, 0x46];
61 | }
62 | }
63 | var _0x1badc3, _0x38ca59, _0x431764, _0x43f1b4, _0x5722c0, _0x3e0c38 = _0x1171c8, _0xdb4d2c = _0x4dae05, _0x1724c5 = _0x183a1d, _0x257ec6 = _0xcfa373;
64 | window['_$6_'] = -389564586;
65 | window['_$tT'] = -660478335;
66 | window['_$Jy'] = -405537848;
67 | for (_0x1badc3 = 0x0; _0x1badc3 < _0x193f00['length']; _0x1badc3 += _0x42fb36)
68 | _0x38ca59 = _0x3e0c38,
69 | _0x431764 = _0xdb4d2c,
70 | _0x43f1b4 = _0x1724c5,
71 | _0x5722c0 = _0x257ec6,
72 | _0x3e0c38 = _0x48d200(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3], 0x7, 0x7d60c),
73 | _0x257ec6 = _0x48d200(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x1], 0xc, _0x4e96b4['_$6_']),
74 | _0x1724c5 = _0x48d200(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x2], 0x11, 0x242070db),
75 | _0xdb4d2c = _0x48d200(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x3], 0x16, -0x3e423112),
76 | _0x3e0c38 = _0x48d200(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x4], 0x7, -0xa83f051),
77 | _0x257ec6 = _0x48d200(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x5], 0xc, 0x4787c62a),
78 | _0x1724c5 = _0x48d200(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x6], 0x11, -0x57cfb9ed),
79 | _0xdb4d2c = _0x48d200(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x7], 0x16, -0x2b96aff),
80 | _0x3e0c38 = _0x48d200(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x8], 0x7, 0x698098d8),
81 | _0x257ec6 = _0x48d200(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x9], 0xc, -0x74bb0851),
82 | _0x1724c5 = _0x48d200(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xa], 0x11, -0xa44f),
83 | _0xdb4d2c = _0x48d200(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0xb], 0x16, -0x76a32842),
84 | _0x3e0c38 = _0x48d200(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0xc], 0x7, 0x6b901122),
85 | _0x257ec6 = _0x48d200(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0xd], 0xc, -0x2678e6d),
86 | _0x1724c5 = _0x48d200(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xe], 0x11, -0x5986bc72),
87 | _0xdb4d2c = _0x48d200(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0xf], 0x16, 0x49b40821),
88 | _0x3e0c38 = _0x3180ec(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x1], 0x5, -0x9e1da9e),
89 | _0x257ec6 = _0x3180ec(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x6], 0x9, -0x3fbf4cc0),
90 | _0x1724c5 = _0x3180ec(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xb], 0xe, 0x265e5a51),
91 | _0xdb4d2c = _0x3180ec(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3], 0x14, -0x16493856),
92 | _0x3e0c38 = _0x3180ec(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x5], 0x5, -0x29d0efa3),
93 | _0x257ec6 = _0x3180ec(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0xa], 0x9, 0x2441453),
94 | _0x1724c5 = _0x3180ec(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xf], 0xe, _0x4e96b4['_$tT']),
95 | _0xdb4d2c = _0x3180ec(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x4], 0x14, _0x4e96b4['_$Jy']),
96 | _0x3e0c38 = _0x3180ec(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x9], 0x5, 0x21e1cde6),
97 | _0x257ec6 = _0x3180ec(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0xe], 0x9, -0x3cc8aa0a),
98 | _0x1724c5 = _0x3180ec(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x3], 0xe, -0xb2af279),
99 | _0xdb4d2c = _0x3180ec(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x8], 0x14, 0x455a14ed),
100 | _0x3e0c38 = _0x3180ec(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0xd], 0x5, -0x5caa8e7b),
101 | _0x257ec6 = _0x3180ec(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x2], 0x9, -0x3105c08),
102 | _0x1724c5 = _0x3180ec(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x7], 0xe, 0x676f02d9),
103 | _0xdb4d2c = _0x3180ec(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0xc], 0x14, -0x72d5b376),
104 | _0x3e0c38 = _0x32032f(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x5], 0x4, -0x241282e),
105 | _0x257ec6 = _0x32032f(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x8], 0xb, -0x788e097f),
106 | _0x1724c5 = _0x32032f(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xb], 0x10, 0x6d9d6122),
107 | _0xdb4d2c = _0x32032f(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0xe], 0x17, -0x21ac7f4),
108 | _0x3e0c38 = _0x32032f(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x1], 0x4, -0x5b4115bc * b64pad),
109 | _0x257ec6 = _0x32032f(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x4], 0xb, 0x4bdecfa9),
110 | _0x1724c5 = _0x32032f(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x7], 0x10, -0x944b4a0),
111 | _0xdb4d2c = _0x32032f(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0xa], 0x17, -0x41404390),
112 | _0x3e0c38 = _0x32032f(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0xd], 0x4, 0x289b7ec6),
113 | _0x257ec6 = _0x32032f(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3], 0xb, -0x155ed806),
114 | _0x1724c5 = _0x32032f(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x3], 0x10, -0x2b10cf7b),
115 | _0xdb4d2c = _0x32032f(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x6], 0x17, 0x2d511fd9),
116 | _0x3e0c38 = _0x32032f(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x9], 0x4, -0x3d12017),
117 | _0x257ec6 = _0x32032f(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0xc], 0xb, -0x1924661b),
118 | _0x1724c5 = _0x32032f(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xf], 0x10, 0x1fa27cf8),
119 | _0xdb4d2c = _0x32032f(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x2], 0x17, -0x3b53a99b),
120 | _0x3e0c38 = _0x4b459d(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3], 0x6, -0xbd6ddbc),
121 | _0x257ec6 = _0x4b459d(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x7], 0xa, 0x432aff97),
122 | _0x1724c5 = _0x4b459d(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xe], 0xf, -0x546bdc59),
123 | _0xdb4d2c = _0x4b459d(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x5], 0x15, -0x36c5fc7),
124 | _0x3e0c38 = _0x4b459d(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0xc], 0x6, 0x655b59c3),
125 | _0x257ec6 = _0x4b459d(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0x3], 0xa, -0x70ef89ee),
126 | _0x1724c5 = _0x4b459d(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0xa], 0xf, -0x644f153),
127 | _0xdb4d2c = _0x4b459d(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x1], 0x15, -0x7a7ba22f),
128 | _0x3e0c38 = _0x4b459d(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x8], 0x6, 0x6fa87e4f),
129 | _0x257ec6 = _0x4b459d(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0xf], 0xa, -0x1d31920),
130 | _0x1724c5 = _0x4b459d(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x6], 0xf, -0x5cfebcec),
131 | _0xdb4d2c = _0x4b459d(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0xd], 0x15, 0x4e0811a1),
132 | _0x3e0c38 = _0x4b459d(_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6, _0x193f00[_0x1badc3 + 0x4], 0x6, -0x8ac817e),
133 | _0x257ec6 = _0x4b459d(_0x257ec6, _0x3e0c38, _0xdb4d2c, _0x1724c5, _0x193f00[_0x1badc3 + 0xb], 0xa, -1120211379),
134 | _0x1724c5 = _0x4b459d(_0x1724c5, _0x257ec6, _0x3e0c38, _0xdb4d2c, _0x193f00[_0x1badc3 + 0x2], 0xf, 0x2ad7d2bb),
135 | _0xdb4d2c = _0x4b459d(_0xdb4d2c, _0x1724c5, _0x257ec6, _0x3e0c38, _0x193f00[_0x1badc3 + 0x9], 0x15, -0x14792c01),
136 | _0x3e0c38 = _0x12e4a8(_0x3e0c38, _0x38ca59),
137 | _0xdb4d2c = _0x12e4a8(_0xdb4d2c, _0x431764),
138 | _0x1724c5 = _0x12e4a8(_0x1724c5, _0x43f1b4),
139 | _0x257ec6 = _0x12e4a8(_0x257ec6, _0x5722c0);
140 | return [_0x3e0c38, _0xdb4d2c, _0x1724c5, _0x257ec6];
141 | }
142 |
143 | function _0x12b47d(_0x149183) {
144 | var _0xabbcb3, _0x1145c3 = '', _0x4fce58 = 0x20 * _0x149183['length'];
145 | for (_0xabbcb3 = 0x0; _0xabbcb3 < _0x4fce58; _0xabbcb3 += 0x8)
146 | _0x1145c3 += _0x30bc70['fromCharCode'](_0x149183[_0xabbcb3 >> 0x5] >>> _0xabbcb3 % 0x20 & 0xff);
147 | return _0x1145c3;
148 | }
149 |
150 | function _0x35f5f2(_0x243853) {
151 | var _0x139b8b, _0xa791a1 = [];
152 | for (_0xa791a1[(_0x243853['length'] >> 0x2) - 0x1] = void 0x0,
153 | _0x139b8b = 0x0; _0x139b8b < _0xa791a1['length']; _0x139b8b += 0x1)
154 | _0xa791a1[_0x139b8b] = 0x0;
155 | var _0x41a533 = 0x8 * _0x243853['length'];
156 | for (_0x139b8b = 0x0; _0x139b8b < _0x41a533; _0x139b8b += 0x8)
157 | _0xa791a1[_0x139b8b >> 0x5] |= (0xff & _0x243853['charCodeAt'](_0x139b8b / 0x8)) << _0x139b8b % 0x20;
158 | return _0xa791a1;
159 | }
160 |
161 | function _0x2b8a17(_0x36f847) {
162 | return unescape(encodeURIComponent(_0x36f847));
163 | }
164 |
165 | function _0x1ee7ec(_0x206333) {
166 | return _0x12b47d(_0x11a7a2(_0x35f5f2(_0x206333), 8 * 13));
167 | }
168 |
169 | function _0x499969(_0x82fe7e) {
170 | var _0x5bdda4, _0x322a73, _0xd0b5cd = '0123456789abcdef', _0x21f411 = '';
171 | for (_0x322a73 = 0x0; _0x322a73 < _0x82fe7e['length']; _0x322a73 += 0x1)
172 | _0x5bdda4 = _0x82fe7e['charCodeAt'](_0x322a73),
173 | _0x21f411 += _0xd0b5cd['charAt'](_0x5bdda4 >>> 0x4 & 0xf) + _0xd0b5cd['charAt'](0xf & _0x5bdda4);
174 | return _0x21f411;
175 | }
176 |
177 | function _0x41873d(_0x5a6962) {
178 | return _0x1ee7ec(_0x2b8a17(_0x5a6962));
179 | }
180 |
181 | function _0x37614a(_0x32e7c1) {
182 | return _0x499969(_0x41873d(_0x32e7c1));
183 | }
184 |
185 | function _0x474032(_0x233f82, _0xe2ed33, _0x3229f9) {
186 | return _0x37614a(_0x233f82);
187 | }
188 |
189 | var CryptoJS = require('crypto-js');
190 |
191 | function rm4Encrypt(_$yw, pr){
192 | var value = Buffer.from(_$yw).toString('base64').slice(0, 16);
193 | var _$Ww = CryptoJS.enc.Utf8.parse(pr);
194 | var key = CryptoJS.enc.Utf8.parse(value);
195 | var encrypted = CryptoJS.AES.encrypt(_$Ww, key, {
196 | mode: CryptoJS.mode.ECB,
197 | padding: CryptoJS.pad.Pkcs7
198 | });
199 | return encrypted.toString();
200 | }
201 |
202 | function getParamers() {
203 | pr = [];
204 | for (i = 1; i < 5; i++) {
205 | var _$Wa = Date.parse(new Date());
206 | pr.push(_0x474032(_$Wa))
207 | }
208 | var _$yw = new Date().valueOf().toString();
209 | pr.push(_0x474032(_$yw));
210 | cookie_m = pr[4];
211 | cookie_rm4 = rm4Encrypt(_$yw, pr.toString());
212 | return{
213 | "cookie_m": cookie_m,
214 | "cookie_rm4": cookie_rm4,
215 | "m": _$yw,
216 | "f": Date.parse(new Date()).toString()
217 | }
218 | }
219 |
220 | // console.log(getParamers());
--------------------------------------------------------------------------------
/yrx_5/yrx5.py:
--------------------------------------------------------------------------------
1 | # =======================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2022/9/8
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: yrx5.py
6 | # @Software: PyCharm
7 | # =======================
8 |
9 | import execjs
10 | import requests
11 | import re
12 |
13 |
14 | def encrypt_yrx5():
15 | room_heat_all = []
16 | for page_num in range(1, 6):
17 | with open('yrx5.js', 'r', encoding='utf-8') as f:
18 | encrypt = f.read()
19 | encrypt_params = execjs.compile(encrypt).call('getParamers')
20 | print(encrypt_params['f'])
21 | headers = {
22 | "user-agent": "yuanrenxue,project",
23 | }
24 | cookies = {
25 | # 填入自己的 sessionid
26 | "sessionid": " your sessionid ",
27 | "m": encrypt_params['cookie_m'],
28 | "RM4hZBv0dDon443M": encrypt_params['cookie_rm4']
29 | }
30 | params = {
31 | "m": encrypt_params['m'],
32 | "f": encrypt_params['f']
33 | }
34 | url = "https://match.yuanrenxue.com/api/match/5?page=%s" % page_num
35 | response = requests.get(url, headers=headers, cookies=cookies, params=params)
36 | for i in range(10):
37 | value = response.json()['data'][i]
38 | room_heat = re.findall(r"'value': (.*?)}", str(value))[0]
39 | room_heat_all.append(room_heat)
40 | room_heat_all.sort(reverse=True)
41 | top_five_total = 0
42 | for i in range(5):
43 | top_five_total += int(room_heat_all[i])
44 | print(top_five_total)
45 |
46 |
47 | if __name__ == '__main__':
48 | encrypt_yrx5()
49 |
--------------------------------------------------------------------------------
/zwfw_san-he_gov_cn/zwfw_san_he.py:
--------------------------------------------------------------------------------
1 | # ==================================
2 | # --*-- coding: utf-8 --*--
3 | # @Time : 2021-09-01
4 | # @Author : 微信公众号:K哥爬虫
5 | # @FileName: zwfw_san_he.py
6 | # @Software: PyCharm
7 | # ==================================
8 |
9 |
10 | import re
11 |
12 | import execjs
13 | import requests
14 |
15 |
16 | index_url = 'http://zwfw.san-he.gov.cn/icity/icity/guestbook/interact'
17 | data_url = 'http://zwfw.san-he.gov.cn/icity/api-v2/app.icity.guestbook.WriteCmd/getList'
18 | headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}
19 | session = requests.session()
20 |
21 |
22 | def get_encrypted_parameters(signature):
23 | with open('zwfw_san_he_encrypt.js', 'r', encoding='utf-8') as f:
24 | zwfw_san_he_js = f.read()
25 | encrypted_parameters = execjs.compile(zwfw_san_he_js).call('getDecryptedParameters', signature)
26 | return encrypted_parameters
27 |
28 |
29 | def get_signature_and_cookies():
30 | response = session.get(url=index_url, headers=headers)
31 | cookies = response.cookies.get_dict()
32 | cookie = cookies['ICITYSession']
33 | signature = re.findall(r'signature = "(.*)"', response.text)[0]
34 | return cookie, signature
35 |
36 |
37 | def get_data(cookie, parameters, page):
38 | payload_data = {'start': page*7, 'limit': 7, 'TYPE@=': '2', 'OPEN@=': '1'}
39 | params = {'s': parameters['s'], 't': parameters['t']}
40 | cookies = {'ICITYSession': cookie}
41 | response = session.post(url=data_url, headers=headers, json=payload_data, params=params, cookies=cookies).json()
42 | print(payload_data, response)
43 |
44 |
45 | def main():
46 | ck, sig = get_signature_and_cookies()
47 | for page in range(10):
48 | # 采集10页数据
49 | param = get_encrypted_parameters(sig)
50 | get_data(ck, param, page)
51 |
52 |
53 | if __name__ == '__main__':
54 | main()
55 |
--------------------------------------------------------------------------------
/zwfw_san-he_gov_cn/zwfw_san_he_encrypt.js:
--------------------------------------------------------------------------------
1 | /*
2 | # ==================================
3 | # --*-- coding: utf-8 --*--
4 | # @Time : 2021-09-01
5 | # @Author : 微信公众号:K哥爬虫
6 | # @FileName: zwfw_san_he_encrypt.js
7 | # @Software: PyCharm
8 | # ==================================
9 | */
10 |
11 | isNotNull = function (obj) {
12 | if (obj === undefined || obj === null || obj == "null" || obj === "" || obj == "undefined")
13 | return false;
14 | return true;
15 | };
16 |
17 | function getDecryptedParameters(__signature) {
18 | var sig = "";
19 | var chars = "0123456789abcdef";
20 | if (!isNotNull(__signature)) {
21 | var curTime = parseInt(Math.random() * (9999 - 1000 + 1) + 1000) + "" + Date.parse(new Date());
22 | sig = chars.charAt(parseInt(Math.random() * (15 - 15 + 1) + 10)) + chars.charAt(curTime.length) + "" + curTime;
23 | } else {
24 | sig = __signature;
25 | }
26 |
27 | var key = "";
28 | var keyIndex = -1;
29 | for (var i = 0; i < 6; i++) {
30 | var c = sig.charAt(keyIndex + 1);
31 | key += c;
32 | keyIndex = chars.indexOf(c);
33 | if (keyIndex < 0 || keyIndex >= sig.length) {
34 | keyIndex = i;
35 | }
36 | }
37 |
38 | var timestamp = parseInt(Math.random() * (9999 - 1000 + 1) + 1000) + "_" + key + "_" + Date.parse(new Date());
39 | var t = timestamp;
40 | //LEx.azdg.encrypt(timestamp,key);
41 | t = t.replace(/\+/g, "_");
42 | return {"s": sig, "t": t};
43 | }
44 |
45 | // 测试样例
46 | // console.log(getDecryptedParameters("c988121626057020055"))
47 |
--------------------------------------------------------------------------------