diff --git a/README.md b/README.md index f7404b1..14f97f9 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ > **参数生成** -[拼多多](https://github.com/wkunzhi/Python3-Spider/tree/master/【拼多多】登陆参数生成) | [小牛在线](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【小牛在线】登录参数生成) | [开鑫贷](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【开鑫贷】登陆参数生成) | [时光网](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【时光网】登陆参数生成) | [百度](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度】自动登录) | [公众号密码加密](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【微信】登录参数生成) | [移动](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【移动】登录参数生成) | [好莱客](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【好莱客】参数解析) | [青海移动](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【青海移动】登陆参数生成) | [新浪微博](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【新浪微博】密码解密) | [汽车之家](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【汽车之家】参数解密) | [steam](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【steam】登录) | [百度wap端sig生成](https://github.com/wkunzhi/Python3-Spider/tree/master/%E5%85%B6%E4%BB%96%E5%AE%9E%E6%88%98/%E3%80%90%E7%99%BE%E5%BA%A6%E3%80%91wap%E7%AB%AFsig%E7%94%9F%E6%88%90) +[拼多多](https://github.com/wkunzhi/Python3-Spider/tree/master/【拼多多】登陆参数生成) 失效! | [小牛在线](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【小牛在线】登录参数生成) | [开鑫贷](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【开鑫贷】登陆参数生成) | [时光网](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【时光网】登陆参数生成) | [百度](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度】自动登录) | [公众号密码加密](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【微信】登录参数生成) | [移动](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【移动】登录参数生成) | [好莱客](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【好莱客】参数解析) | [青海移动](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【青海移动】登陆参数生成) | [新浪微博](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【新浪微博】密码解密) | [汽车之家](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【汽车之家】参数解密) | [steam](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【steam】登录) | [百度wap端sig生成](https://github.com/wkunzhi/Python3-Spider/tree/master/%E5%85%B6%E4%BB%96%E5%AE%9E%E6%88%98/%E3%80%90%E7%99%BE%E5%BA%A6%E3%80%91wap%E7%AB%AFsig%E7%94%9F%E6%88%90) > **自动登录** @@ -64,13 +64,10 @@ > **其他实战** -[抖音无水印视频解析](https://github.com/wkunzhi/Python3-Spider/tree/master/【抖音】无水印视频解析) | [企业名片查询](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【企业名片】企业查询) | [百度找回密码](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度】网页找回密码) | [美女壁纸下载](https://github.com/wkunzhi/Python3-Spider/tree/master/【双色球】头奖分布) | [美女壁纸下载](https://github.com/wkunzhi/Python3-Spider/tree/master/【壁纸】美女壁纸下载器) | [美团 解析与token生成](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【美团】数据解析、token生成) | [bilibili 视频下载](https://github.com/wkunzhi/Python3-Spider/tree/master/【bilibili】视频下载) | [51job 查岗位](https://github.com/wkunzhi/Python3-Spider/tree/master/【51Job】查岗位) | [百度 翻译](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度】翻译) | [美团 全国区域](https://github.com/wkunzhi/Python3-Spider/tree/master/各站案例/MeiTuanArea) | [企业名片查询](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【餐饮】查询信息) | [快递查询](https://github.com/wkunzhi/Python3-Spider/tree/master/【快递】单号查询) | [金逸电影 注册](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【金逸电影】自动注册) | [Python加密库Demo](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【Python加密库】Demo) | [百度街拍图片下载](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度街拍】图片下载) | [京东商品数据爬取](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【京东】商品数据爬取) | [房价获取](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【房价】房价获取) +[文书网app查询接口](https://github.com/wkunzhi/Python3-Spider/tree/master/【文书】app查询接口) | [抖音无水印视频解析](https://github.com/wkunzhi/Python3-Spider/tree/master/【抖音】无水印视频解析) | [企业名片查询](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【企业名片】企业查询) | [百度找回密码](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度】网页找回密码) | [美女壁纸下载](https://github.com/wkunzhi/Python3-Spider/tree/master/【双色球】头奖分布) | [美女壁纸下载](https://github.com/wkunzhi/Python3-Spider/tree/master/【壁纸】美女壁纸下载器) | [美团 解析与token生成](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【美团】数据解析、token生成) | [bilibili 视频下载](https://github.com/wkunzhi/Python3-Spider/tree/master/【bilibili】视频下载) | [51job 查岗位](https://github.com/wkunzhi/Python3-Spider/tree/master/【51Job】查岗位) | [百度 翻译](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度】翻译) | [美团 全国区域](https://github.com/wkunzhi/Python3-Spider/tree/master/各站案例/MeiTuanArea) | [企业名片查询](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【餐饮】查询信息) | [金逸电影 注册](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【金逸电影】自动注册) | [Python加密库Demo](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【Python加密库】Demo) | [百度街拍图片下载](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【百度街拍】图片下载) | [京东商品数据爬取](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【京东】商品数据爬取) | [房价获取](https://github.com/wkunzhi/Python3-Spider/tree/master/其他实战/【房价】房价获取) -## 抖音视频解析器 -![](https://zok-blog.oss-cn-hangzhou.aliyuncs.com/images/20200210/317223745.png) - ## 原创工具 > 此工具包在我另外一个项目中,欢迎 star @@ -101,6 +98,17 @@ - 打开 `auto_login_pyppeteer.py` Run 代码,输入淘宝账号、密码即可自动登录 +---- + + +##文书网app + +[《入门级安卓逆向 - 文书网app爬虫教程》](https://www.zhangkunzhi.com/index.php/archives/162/) + +![](https://static.zhangkunzhi.com/typecho/2020/07/24/603402218498341/1595560337.png) + + + ---- ### 美女壁纸下载器 diff --git "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/AiCha.py" "b/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/AiCha.py" deleted file mode 100644 index 7be4b93..0000000 --- "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/AiCha.py" +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = "zok" 362416272@qq.com -# Date: 2019-05-30 Python: 3.7 - -import js2py -import requests -import json - - -class AiCha(object): - headers = { - 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', - 'Referer': 'https://www.ickd.cn/' - } - context = js2py.EvalJs() # python中使用js - - def __init__(self, express): - self.express = express # 快递单号 - - with open("make.js", "r", encoding="utf-8") as f: - self.context.execute(f.read()) - - def make_tm(self): - mt = self.context.make_tm() - return mt - - def make_tk(self, mt): - _str = self.express + str(mt) - tk = self.context.sign(_str) - return tk - - def test_get_tk(self, _str): - print(self.context.sign(_str)) - - def start(self): - self.login() - tm = self.make_tm() - tk = self.make_tk(tm) - _tm = '_' + str(tm) - params = { - 'mailNo': self.express, - 'spellName': '', - 'exp-textName': '', - 'tk': tk, - 'tm': tm, - 'callback': '_jqjsp', - _tm: '' - } - - url = 'https://biz.trace.ickd.cn/auto/' + self.express - - response = requests.get(url, headers=self.headers, params=params) - print(response.url) - if response.status_code == 200: - self.parse(response.text) - else: - print('获取失败') - - def parse(self, text): - info = json.loads(text[text.find('(')+1: -2]) - msg = """ - 快递: {expTextName} - 单号: {mailNo} - """.format(expTextName=info.get('expTextName'), mailNo=info.get('mailNo')) - print(msg) - for node in info.get('data'): - print(node) - - def login(self): - url = 'https://i.ickd.cn/userLog.do?add&callback=jQuery110209561380635635104_{tm}&com={type}&mailNo={key}&status=3&_={tm}' - target_url = url.format(tm=self.make_tm(), type='zhongtong', key=self.express) - requests.get(target_url, headers=self.headers) - - -if __name__ == '__main__': - # 5 月 20 日 可用 - # 在查询之前还需要做一个请求登陆验证 - ac = AiCha('75150911849051') - ac.start() - diff --git "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/__init__.py" "b/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/__init__.py" deleted file mode 100644 index 01514cc..0000000 --- "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/__init__.py" +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = "zok" 362416272@qq.com -# Date: 2019-05-27 Python: 3.7 - diff --git "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/kuaidi110.py" "b/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/kuaidi110.py" deleted file mode 100644 index e162904..0000000 --- "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/kuaidi110.py" +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# __author__ = "zok" 362416272@qq.com -# Date: 2019-05-27 Python: 3.7 - -import requests -import json - - -class CheckExpress(object): - headers = { - 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', - 'Referer': 'https://www.kuaidi100.com/' - } - - def __init__(self, post_id): - self.post_id = post_id - self.index_url = 'https://www.kuaidi100.com/' - self.select_url = 'https://www.kuaidi100.com/query' - - self.session = requests.session() - self.to_index() - - def to_index(self): - self.session.get(self.index_url, headers=self.headers) - - def express(self): - params = { - 'type': 'zhongtong', # companyCode - 'postid': self.post_id, # kuaidiNumber - 'temp': '0.8067971039628283', # Math.random # 此处混淆随机小数 - 'phone': '', # 可空 - } - - response = self.session.get(self.select_url, headers=self.headers, params=params) - self.parse(response.text) - - @staticmethod - def parse(data): - """解析""" - try: - for node in json.loads(data).get('data'): - print(node.get('time'), node.get('context')) - except Exception as e: - print('获取出错') - - -if __name__ == '__main__': - """params 中 需要设置快递代码+快递单号, temp 是随机小数用来做混淆的,不用管。 需要先进入首页拿到session再进行请求查询。 - 否则会返回一些假数据给你 - """ - # 此处只是写了一个 中通快递 Demo - ck = CheckExpress('75150911849051') - ck.express() diff --git "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/make.js" "b/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/make.js" deleted file mode 100644 index 114dc4a..0000000 --- "a/\343\200\220\345\277\253\351\200\222\343\200\221\345\215\225\345\217\267\346\237\245\350\257\242/make.js" +++ /dev/null @@ -1,68 +0,0 @@ -const _url = 'https://www.ickd.cn/'; - - -function make_tm() { - return (new Date).getTime() -} - - -sign = function() { - function s(t) { - var e, i, s, a, o = -1; - for (e = 0, - s = t.length; e < s; e += 1) { - for (a = 255 & (o ^ t[e]), - i = 0; i < 8; i += 1) - 1 == (1 & a) ? a = a >>> 1 ^ n : a >>>= 1; - o = o >>> 8 ^ a - } - return -1 ^ o - } - function o(t, e) { - var i, s, a; - if ("undefined" != typeof o._x1l0o && e &&t t || (o._x1l0o = -1, - t)) { - for (i = o._x1l0o, - s = 0, - a = t.length; s < a; s += 1) - i = i >>> 8 ^ r[255 & (i ^ t[s])]; - return -1 ^ (o._x1l0o = i) - } - } - function t(t) { - var e, i, s, a, o, r = typeof t, n = 16, l = 0; - if ("string" !== r && "number" !== r) - return NaN; - if (!(e = (t = (t + "").replace(/\s/g, "").split(".")[0]).length)) - return NaN; - if (n || (n = 10), - "number" != typeof n || n < 2 || 36 < n) - return NaN; - for (i = t.split("").reverse(), - s = 0; s < e; s++) - 97 <= (o = (a = i[s]).charCodeAt(0)) && (a = o - 87), - l += Math.floor(a) * Math.pow(n, s); - return l - } - var e, r = [], n = t("edb" + t(15900)); - return function a() { - var t, e, i; - for (e = 0; e < 256; e += 1) { - for (t = e, - i = 0; i < 8; i += 1) - 1 & t ? t = n ^ t >>> 1 : t >>>= 1; - r[e] = t >>> 0 - } - }(), - (e = function(t, e) { - t = "string" == typeof t ? function i(t) { - return Array.prototype.map.call(t, function(t) { - return t.charCodeAt(0) - }) - }(t + _url) : t; - return ((e ? s(t) : o(t)) >>> 0).toString(16) - } - ).direct = s, - e.table = o, - e -}() \ No newline at end of file diff --git "a/\343\200\220\346\226\207\344\271\246\343\200\221app\346\237\245\350\257\242\346\216\245\345\217\243/main.py" "b/\343\200\220\346\226\207\344\271\246\343\200\221app\346\237\245\350\257\242\346\216\245\345\217\243/main.py" new file mode 100644 index 0000000..d83e84f --- /dev/null +++ "b/\343\200\220\346\226\207\344\271\246\343\200\221app\346\237\245\350\257\242\346\216\245\345\217\243/main.py" @@ -0,0 +1,162 @@ +# __author__ = "zok" 362416272@qq.com +# Date: 2020/7/24 Python:3.7 + +import requests +import time +import random +import json +import base64 +import pyDes +from datetime import datetime + + +class TripleDesUtils: + + def encryption(self, data: str, key, iv) -> str: + """3des 加密 + """ + _encryption_result = pyDes.triple_des(key, pyDes.CBC, iv, None, pyDes.PAD_PKCS5).encrypt(data) + _encryption_result = self._base64encode(_encryption_result).decode() + return _encryption_result + + def decrypt(self, data: str, key, iv) -> str: + """3des 解密 + """ + data = self._base64decode(data) + _decrypt_result = pyDes.triple_des(key, pyDes.CBC, iv, None, pyDes.PAD_PKCS5).decrypt(data).decode('utf-8') + return _decrypt_result + + @staticmethod + def _base64encode(data): + try: + _b64encode_result = base64.b64encode(data) + except Exception as e: + raise Exception(f"base64 encode error:{e}") + return _b64encode_result + + @staticmethod + def _base64decode(data): + try: + _b64decode_result = base64.b64decode(data) + except Exception as e: + raise Exception(f"base64 decode error:{e}") + return _b64decode_result + + +class WenShu: + + def __init__(self): + self.js = None + + @staticmethod + def get_now_data(): + """时间 + """ + return datetime.now().strftime('%Y%m%d') + + @staticmethod + def random_key(): + """字符串 + """ + random_str = '' + base_str = 'ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789' + length = len(base_str) - 1 + for i in range(24): + random_str += base_str[random.randint(0, length)] + return random_str + + @staticmethod + def make_id(): + """id + """ + return datetime.now().strftime('%Y%m%d%H%M%S') + + def make_cipher_text(self): + """生成 ciphertext + """ + time_13 = str(int(round(time.time() * 1000))) + key = self.random_key() + now = self.get_now_data() + _str = des3.encryption(time_13, key, now) + _str = key + now + _str + new_str = '' + for i in _str: + if i != 1: + new_str += " " + new_str += str(bin(ord(i))[2:]) + + msg = """【key生成】: {key}\n【now生成】: {now}\n【_str生成】: {_str}\n【ciphertext生成】: {ciphertext}""".format(key=key, + now=now, + _str=_str, + ciphertext=new_str) + print(msg) + + return new_str.strip() + + def make_request(self): + """生成明文的请求 data 内容 + 【这里需要根据实际需求修改请求内容】自行抓包研究!! + """ + info = { + "id": self.make_id(), # 年月日时分秒 + "command": "queryDoc", # 固定 + "params": { + "devid": "41d861ffe5b347d28454dc3f07dd4212", # 设备号 + "devtype": "1", + "ciphertext": self.make_cipher_text(), + "pageSize": "20", + "sortFields": "s50:desc", # 固定 + "pageNum": "1", + "queryCondition": [{ + "key": "s8", + "value": "02" + }] # 关键词 + 搜索文本的类型; + } + } + return info + + def to_index(self): + url = 'http://wenshuapp.court.gov.cn/appinterface/rest.q4w' + headers = { + 'Content-Type': 'application/x-www-form-urlencoded', + 'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9; MIX 2 MIUI/V11.0.2.0.PDECNXM)', + 'Host': 'wenshuapp.court.gov.cn', + 'Connection': 'Keep-Alive', + 'Accept-Encoding': 'gzip', + } + txt = str(self.make_request()) + + request = base64.b64encode(txt.encode('utf-8')).decode('utf-8') + data = { + 'request': request + } + msg = """【明文请求体】: {txt}\n【密文请求体】: {data}\n【官网速度较慢,耐心等待】....""".format(txt=txt, data=data) + print(msg) + response = requests.post(url, headers=headers, data=data) + if 'HTTP Status 503' in response.text: + print('【服务器繁忙】 爬的人太多了, 请重试') + exit() + data = json.loads(response.text) + content = data.get('data').get('content') + key = data.get('data').get('secretKey') + iv = self.get_now_data() + msg = """【页面访问结果】: {text}\n【捕获key】:{key}\n【捕获iv】:{iv}\n【捕获content】:{content}""".format(text=response.text, + key=key, iv=iv, + content=content) + print(msg) + self.parse_html(content, key, iv) + + def parse_html(self, content, key, iv): + _str = des3.decrypt(content, key, iv) + print("【解密返回结果】:", _str) + + +des3 = TripleDesUtils() + +if __name__ == '__main__': + """ + 《入门级安卓逆向 - 文书网app爬虫》 + https://www.zhangkunzhi.com/index.php/archives/162/ + """ + ws = WenShu() + ws.to_index()