diff --git a/GetJDUser.py b/GetJDUser.py new file mode 100755 index 0000000..87bcd05 Binary files /dev/null and b/GetJDUser.py differ diff --git a/USER_AGENTS.py b/USER_AGENTS.py new file mode 100644 index 0000000..8255a33 --- /dev/null +++ b/USER_AGENTS.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -* +''' +项目名称: JD-Script / USER_AGENTS +活动名称: User-agent +Author: SheYu09 +''' +# from uuid import uuid4 +from string import hexdigits +from time import time, sleep, localtime, strftime +from random import random, sample, randint, uniform + +def uuid(e=40): + return ((e == 0) and '0') or (uuid(e - 1).lstrip('0') + sample(hexdigits[:-6], 1)[0]) + +def userAgent(): + e = { + '11.0.2': '168095', + '10.5.4': '168074', + '10.5.2': '168069', + '10.5.0': '168052', + '10.4.6': '168014', + '10.4.5': '168001', + '10.4.4': '167991', + '10.4.0': '167968', + '10.3.4': '167945' + } + v = ''.join(sample(e.keys(), 1)) + i = ''.join(sample(['14,5', '14,4', '14,3', '14,2', '13,4', '13,3', '13,2', '13,1', '12.5'], 1)) + iv = ''.join(sample(['15.5', '15.4.1', '15.4', '15.3.1', '15.3', '15.2.1', '15.2', '15.1.1', '15.1'], 1)) + return f"jdapp;iPhone;{v};{iv};{uuid()};network/{''.join(sample(['3g', '4g', 'wifi'], 1))};model/iPhone{i};addressid/;appBuild/{e[v]};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iv.replace('.', '_')} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1" + diff --git a/jdCookie.py b/jdCookie.py new file mode 100644 index 0000000..57bbd2a --- /dev/null +++ b/jdCookie.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -* +''' +项目名称: JdScript / jdCookie +活动名称: 读取COOKIE / WSKEY +Author: SheYu09 +''' +import requests +s = requests.session() +s.keep_alive = False +from os import environ +from inspect import stack +from USER_AGENTS import * +from re import compile, findall, split + +def Name(): + try: + if len(environ["Name"]): + Name = environ["Name"].split('&') + print("已获取并使用Env环境 Name:", Name, "\n") + return Name + except: + print("自行添加环境变量:Name, 不同好友中间用&符号隔开\n") + exit() + +def re_pin(r): + try: return compile(r'pin=(.*?);wskey=.*?;').findall(r)[0] if 'wskey=' in r else compile(r'pt_key=.*?;pt_pin=(.*?);').findall(r)[0] + except: print(r, '\nck格式不正确,请检查\n') + +def re_key(r, e): + try: return compile(rf'{r}').findall(e) if 'pin=' in r else compile(rf'{r}').findall(e)[0] + except: pass + +def JD_API_HOST(C): + try: + if len(environ[f'JD_{C}']): + print(f" ****** 已获取并使用Env环境 {C} ******\n") + return environ[f'JD_{C}'] + except: + print(f" ****** 获取Env环境 {C} 失败 ******") + print(f"自行添加环境变量:JD_{C}\n") + return + +def COOKIE(): + global ptkeyList, ptpinList + ck = JD_API_HOST(stack()[0][3]) + ptkeyList = re_key('pt_key=.*?;pt_pin=.*?;', ck) + ptpinList = re_key('pt_pin=(.*?);', ck) + +def WSKEY(): + global wskeyList, wspinList + ck = JD_API_HOST(stack()[0][3]) + wskeyList = re_key('pin=.*?;wskey=.*?;', ck) + wspinList = re_key('pin=(.*?);', ck) + +def jdCookie(): + COOKIE(); WSKEY() + wskeyList and wspinList and [ptkeyList.remove(i) for i in [c for c in ptkeyList if re_pin(c) in wspinList]] + cookiesList = (ptkeyList and wskeyList and [wskeyList + ptkeyList] or ptkeyList and not wskeyList and [ptkeyList] or not ptkeyList and wskeyList and [wskeyList])[0] + print(f"====================共{len(cookiesList)}个京东账号Cookie=====================\n") + print(f"==================脚本执行- 北京时间(UTC+8):{strftime('%Y-%m-%d %H:%M:%S', localtime())}==================\n") + cookiesList or exit() + return cookiesList diff --git a/jd_jlhb.py b/jd_jlhb.py new file mode 100755 index 0000000..b239bb2 Binary files /dev/null and b/jd_jlhb.py differ