This commit is contained in:
Faker 2022-09-26 10:32:03 +08:00
parent 7ace774e6f
commit 5d3c816b22
28 changed files with 282 additions and 121 deletions

View File

@ -2,21 +2,21 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
File: jd_check_dependent.py(Harbour库依赖一键检测安装(不可禁用)小时检测一次) File: jd_check_dependent.py(Harbour库依赖一键检测安装(不可禁用)2小时检测一次)
Author: HarbourJ Author: HarbourJ
Date: 2022/8/12 20:37 Date: 2022/8/12 20:37
TG: https://t.me/HarbourToulu TG: https://t.me/HarbourToulu
TgChat: https://t.me/HarbourSailing TgChat: https://t.me/HarbourSailing
cron: 7 7 7 7 7 cron: 7 7 7 7 7
new Env('Faker库本地Sign依赖检测'); new Env('Faker库依赖一键安装');
Description:1.Faker库jd_sign本地算法依赖一键检测安装脚本; Description:1.HarbourToulu库jd_sign本地算法依赖一键检测安装脚本;
2.自动识别机器系统/架构,拉取最新依赖文件; 2.自动识别机器系统/架构,拉取最新依赖文件;
3.本地sign算法已编译支持Windows(amd64)Linux(amd64/arm64/arm)Macos(x86_64)系统/架构; 3.本地sign算法已编译支持Windows(amd64)Linux(amd64/arm64/arm)Macos(x86_64)系统/架构;
4.默认支持python3版本为3.8-3.9,过高或过低可能会报错; 4.默认支持python3版本为3.8-3.10,过低可能会报错;
5.若本一键配置脚本无法安装所需jd_sign依赖文件,请前往https://github.com/HarbourJ/HarbourToulu/releases自行下载系统对应的jd_sign依赖压缩文件,解压并放置/scripts/HarbourJ_HarbourToulu_main文件夹内即可 5.若本一键配置脚本无法安装所需jd_sign依赖文件,请前往https://github.com/HarbourJ/HarbourToulu/releases自行下载系统对应的jd_sign依赖压缩文件,解压并放置/scripts/HarbourJ_HarbourToulu_main文件夹内即可
6.初次拉库必须先运行本脚本
""" """
import sys import sys
import requests, os, platform import requests, os, platform
from functools import partial from functools import partial
print = partial(print, flush=True) print = partial(print, flush=True)
@ -27,101 +27,112 @@ def updateDependent():
更新依赖的主函数 更新依赖的主函数
""" """
system = platform.system().lower() system = platform.system().lower()
PyVersion_ = platform.python_version()
PyVersion = ''.join(PyVersion_.split('.')[:2])
if system == "windows": if system == "windows":
print("识别本机设备为Windows amd64") fileName = f"jd_sign-win-amd64-py{PyVersion}.zip"
rtu = repoTreeUpdate() print(f"✅识别本机设备为Windows amd64,Py版本为{PyVersion_}\n")
rtu = signReleaseUpdate()
if rtu == 9: if rtu == 9:
sys.exit() sys.exit()
if rtu: if rtu:
removeOldSign() removeOldSign()
if download("jd_sign-win-amd64.zip"): if download(rtu, fileName):
import zipfile import zipfile
f = zipfile.ZipFile("jd_sign-win-amd64.zip", 'r') f = zipfile.ZipFile(fileName, 'r')
for file in f.namelist(): for file in f.namelist():
f.extract(file, os.getcwd()) f.extract(file, os.getcwd())
f.close() f.close()
return True return True
elif system == "darwin": elif system == "darwin":
print("识别本机设备为MacOS x86_64") fileName = f"jd_sign-darwin-x86_64-py{PyVersion}.tar.gz"
rtu = repoTreeUpdate() print(f"✅识别本机设备为MacOS x86_64,Py版本为{PyVersion_}\n")
rtu = signReleaseUpdate()
if rtu == 9: if rtu == 9:
sys.exit() sys.exit()
if rtu: if rtu:
removeOldSign() removeOldSign()
if download("jd_sign-darwin-x86_64.tar.gz"): if download(rtu, fileName):
os.system('tar xvf jd_sign-darwin-x86_64.tar.gz') os.system(f'tar xvf {fileName}')
os.system('rm -rf jd_sign-darwin-x86_64.tar.gz') os.system(f'rm -rf {fileName}')
return True return True
else: else:
print("识别本机设备为Linux") rtu = signReleaseUpdate()
rtu = repoTreeUpdate()
if rtu == 9: if rtu == 9:
sys.exit() sys.exit()
if rtu: if rtu:
removeOldSign() removeOldSign()
framework = os.uname().machine framework = os.uname().machine
if framework == "x86_64": if framework == "x86_64":
if download("jd_sign-linux-amd64.tar.gz"): fileName = f"jd_sign-linux-amd64-py{PyVersion}.tar.gz"
os.system('tar xvf jd_sign-linux-amd64.tar.gz') print(f"✅识别本机设备为Linux {framework},Py版本为{PyVersion_}\n")
os.system('rm -rf jd_sign-linux-amd64.tar.gz') if download(rtu, fileName):
os.system(f'tar xvf {fileName}')
os.system(f'rm -rf {fileName}')
return True return True
elif framework == "aarch64" or framework == "arm64": elif framework == "aarch64" or framework == "arm64":
check_ld_libc() fileName = f"jd_sign-linux-arm64-py{PyVersion}.tar.gz"
if download("jd_sign-linux-arm64.tar.gz"): print(f"✅识别本机设备为Linux {framework},Py版本为{PyVersion_}\n")
os.system('tar xvf jd_sign-linux-arm64.tar.gz') check_ld_libc(rtu)
os.system('rm -rf jd_sign-linux-arm64.tar.gz') if download(rtu, fileName):
os.system(f'tar xvf {fileName}')
os.system(f'rm -rf {fileName}')
return True return True
elif framework == "armv7l": elif framework == "armv7l":
check_ld_libc() fileName = f"jd_sign-linux-arm-py{PyVersion}.tar.gz"
if download("jd_sign-linux-arm.tar.gz"): print(f"✅识别本机设备为Linux {framework},Py版本为{PyVersion_}\n")
os.system('tar xvf jd_sign-linux-arm.tar.gz') check_ld_libc(rtu)
os.system('rm -rf jd_sign-linux-arm.tar.gz') if download(rtu, fileName):
os.system(f'tar xvf {fileName}')
os.system(f'rm -rf {fileName}')
return True return True
else: else:
if download("jd_sign-linux-amd64.tar.gz"): fileName = f"jd_sign-linux-amd64-py{PyVersion}.tar.gz"
os.system('tar xvf jd_sign-linux-amd64.tar.gz') print(f"⚠️无法识别本机设备操作系统,默认本机设备为Linux x86_64,Py版本为{PyVersion_}\n")
os.system('rm -rf jd_sign-linux-amd64.tar.gz') if download(rtu, fileName):
os.system(f'tar xvf {fileName}')
os.system(f'rm -rf {fileName}')
return True return True
def check_ld_libc(): def check_ld_libc(version):
""" """
检测是否存在ld-linux-aarch64.so.1libc.musl-aarch64.so.1动态依赖文件 检测是否存在ld-linux-aarch64.so.1libc.musl-aarch64.so.1动态依赖文件
""" """
if "ld-linux-aarch64.so.1" in (os.listdir('/lib')): if "ld-linux-aarch64.so.1" in (os.listdir('/lib')):
print("已存在arm64-ld依赖") print("🗣已存在arm64-ld依赖\n")
pass pass
else: else:
if download("ld-linux-aarch64.tar.gz"): if download(version, "ld-linux-aarch64.tar.gz"):
os.system('tar xvf ld-linux-aarch64.tar.gz') os.system('tar xvf ld-linux-aarch64.tar.gz')
os.system('cp ld-linux-aarch64.so.1 /lib') os.system('cp ld-linux-aarch64.so.1 /lib')
if "ld-linux-aarch64.so.1" in (os.listdir('/lib')): if "ld-linux-aarch64.so.1" in (os.listdir('/lib')):
print("arm64-ld依赖安装完成~") print("arm64-ld依赖安装完成~\n")
os.system('rm -rf ld-linux-aarch64.tar.gz') os.system('rm -rf ld-linux-aarch64.tar.gz')
os.system('rm -rf ld-linux-aarch64.so.1') os.system('rm -rf ld-linux-aarch64.so.1')
else: else:
print("arm64-ld依赖安装失败,网络连接失败,请按依赖教程自行下载依赖文件") print("❌arm64-ld依赖安装失败,请前往Faker TG群查看安装教程\n")
if "libc.musl-aarch64.so.1" in (os.listdir('/lib')): if "libc.musl-aarch64.so.1" in (os.listdir('/lib')):
print("已存在arm64-libc依赖") print("🗣已存在arm64-libc依赖\n")
pass pass
else: else:
if download("libc.musl-aarch64.tar.gz"): if download(version, "libc.musl-aarch64.tar.gz"):
os.system('tar xvf libc.musl-aarch64.tar.gz') os.system('tar xvf libc.musl-aarch64.tar.gz')
os.system('cp libc.musl-aarch64.so.1 /lib') os.system('cp libc.musl-aarch64.so.1 /lib')
if "libc.musl-aarch64.so.1" in (os.listdir('/lib')): if "libc.musl-aarch64.so.1" in (os.listdir('/lib')):
print("arm64-libc依赖安装完成~") print("arm64-libc依赖安装完成~\n")
os.system('rm -rf libc.musl-aarch64.tar.gz') os.system('rm -rf libc.musl-aarch64.tar.gz')
os.system('rm -rf libc.musl-aarch64.so.1') os.system('rm -rf libc.musl-aarch64.so.1')
else: else:
print("arm64-libc依赖安装失败,网络连接失败,请按依赖教程自行下载依赖文件") print("❌arm64-libc依赖安装失败,请前往Faker TG群查看安装教程\n")
def download(systemFile): def download(version, systemFile):
raw_url = f"https://git.metauniverse-cn.com/https://raw.githubusercontent.com/shufflewzc/faker2/main/utils/{systemFile}" raw_url = f"https://ghproxy.com/https://github.com/HarbourJ/HarbourToulu/releases/download/{version}/{systemFile}"
try: try:
fileList = os.listdir() fileList = os.listdir()
if systemFile in fileList: if systemFile in fileList:
os.remove(systemFile) os.remove(systemFile)
except: except:
print(f"删除{fileList}失败") print(f"删除{fileList}失败\n")
try: try:
try: try:
import wget import wget
@ -131,11 +142,11 @@ def download(systemFile):
os.system("pip install wget") os.system("pip install wget")
import wget import wget
wget.download(raw_url) wget.download(raw_url)
print(f"{systemFile}下载成功") print(f"{systemFile}下载成功\n")
return True return True
except Exception as e: except Exception as e:
print(e) print(e)
print(f"{systemFile}下载失败") print(f"{systemFile}下载失败\n")
return False return False
def removeOldSign(): def removeOldSign():
@ -143,82 +154,84 @@ def removeOldSign():
if "jd_sign.so" in fileList: if "jd_sign.so" in fileList:
try: try:
os.remove("jd_sign.so") os.remove("jd_sign.so")
print("成功删除历史jd_sign依赖文件") print("成功删除历史jd_sign依赖文件\n")
except: except:
pass pass
elif "jd_sign_x86.so" in fileList: elif "jd_sign_x86.so" in fileList:
try: try:
os.remove("jd_sign_x86.so") os.remove("jd_sign_x86.so")
print("成功删除历史jd_sign依赖文件") print("成功删除历史jd_sign依赖文件\n")
except: except:
pass pass
elif "jd_sign_arm64.so" in fileList: elif "jd_sign_arm64.so" in fileList:
try: try:
os.remove("jd_sign_arm64.so") os.remove("jd_sign_arm64.so")
print("成功删除历史jd_sign依赖文件") print("成功删除历史jd_sign依赖文件\n")
except: except:
pass pass
def repoTreeUpdate(): def signReleaseUpdate():
""" """
判断utils内的主要文件是否更新(sha值是否变化) 判断Release内的主要文件是否更新(判断utils内版本更新log文件-signUpdateLog.log)
""" """
GitAPI = 'https://api.github.com/repos/shufflewzc/faker2/git/trees/main' GitAPI = "https://ghproxy.com/https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/utils/signUpdateLog.log"
# try:
headers = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9',
'referer': 'https://github.com/HarbourJ/HarbourToulu/blob/main/jdCookie.py',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
response = requests.request("GET", url=GitAPI, headers=headers, timeout=20)
if response.status_code == 200:
res = response.text.split('\n')
print(f'📝最新sign为 {res[-1]}版本\n')
new_version = res[-1].split(' v')[-1]
# 获取上一次检查所记录的version值
try: try:
session = requests.session() with open('signUpdate.log', "r") as f0:
headers = {"Content-Type": "application/json"} last_version = f0.read()
res = session.get(url=GitAPI, headers=headers, timeout=20)
if res.status_code == 200:
for x in res.json()["tree"]:
if "utils" == x["path"]:
new_sha = x["sha"]
print(new_sha)
# 获取上一次检查所记录的sha值
try:
with open('repoUpdate.log', "r") as f0:
last_sha = f0.read()
except Exception as e: except Exception as e:
# print(e) # print(e)
# 以log格式写入文件 # 以log格式写入文件
with open("repoUpdate.log", "w") as f1: with open("signUpdate.log", "w") as f1:
f1.write('') f1.write('')
with open("repoUpdate.log", "w") as f2: last_version = ''
f2.write(new_sha) with open("signUpdate.log", "w") as f2:
if new_sha != last_sha: f2.write(new_version)
print("检测到依赖版本有更新,自动更新...") if new_version != last_version:
print("*" * 30) print("⏰检测到依赖版本有更新,自动更新...\n")
return True return new_version
else: else:
print("检测到依赖版本无更新") print("📝检测到依赖版本无更新\n")
try: try:
from jd_sign import remote_redis from jd_sign import remote_redis
result = remote_redis(export_name="Test01", db_index=15) result = remote_redis(export_name="Test01", db_index=15)
print(result) print(f'🎉{result}\n')
print("依赖正常,退出程序") print("依赖正常,退出程序")
return 9 return 9
except: except:
print("依赖不正常,自动修复中...") print("⏰依赖不正常,自动修复中...\n")
print("*" * 30) return new_version
return True
else: else:
print(f'请求失败:{GitAPI}') print(f'❌请求失败:{GitAPI}\n')
if "message" in res.json(): print(f'❌错误信息:{response.txt}\n')
print(f'错误信息:{res.json()["message"]}')
return False
except:
print(f'请求URL失败{GitAPI}')
return False return False
# except:
# print(f'❌请求URL失败{GitAPI}\n')
# return False
def main(): def main():
updateDependent() updateDependent()
try: try:
from jd_sign import remote_redis from jd_sign import remote_redis
result = remote_redis(export_name="Test01", db_index=15) result = remote_redis(export_name="Test01", db_index=15)
print(result) print(f'🎉{result}\n')
if result: if result:
print("依赖安装/更新完成") print("依赖安装/更新完成")
except: except:
print("依赖安装/更新失败,网络连接失败,请按依赖教程自行下载依赖文件") print("‼️依赖安装/更新失败,依赖安装失请前往Faker TG群查看安装教程")
if __name__ == '__main__': if __name__ == '__main__':
main() main()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

22
jd_cjhy_wxGameActivity.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

22
jd_joy_park_run.js Normal file

File diff suppressed because one or more lines are too long

21
jd_joy_park_run_reward.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

21
jd_lzkj_wxGameActivity.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ try:
except ImportError as e: except ImportError as e:
print(e) print(e)
if "No module" in str(e): if "No module" in str(e):
print("请先运行Faker库依赖一键安装脚本(jd_check_dependent.py)安装jd_sign.so依赖") print("请先运行HarbourJ库依赖一键安装脚本(jd_check_dependent.py)安装jd_sign.so依赖")
try: try:
from jdCookie import get_cookies from jdCookie import get_cookies
getCk = get_cookies() getCk = get_cookies()
@ -383,6 +383,8 @@ def followShop(venderId, pin, activityType):
return hasFollowShop return hasFollowShop
else: else:
print(f"{res['errorMessage']}") print(f"{res['errorMessage']}")
if "店铺会员" in res['errorMessage']:
return 99
def getInfo(): def getInfo():
url = f"https://lzkj-isv.isvjcloud.com/miniProgramShareInfo/getInfo?activityId={activityId}" url = f"https://lzkj-isv.isvjcloud.com/miniProgramShareInfo/getInfo?activityId={activityId}"
@ -585,7 +587,9 @@ if __name__ == '__main__':
getInfo() getInfo()
if needFollow: if needFollow:
if not hasFollow: if not hasFollow:
followShop(venderId, secretPin, activityType) FS = followShop(venderId, secretPin, activityType)
if FS == 99:
continue
time.sleep(0.2) time.sleep(0.2)
addSkuNums = needCollectionSize - hasCollectionSize addSkuNums = needCollectionSize - hasCollectionSize
if oneKeyAddCart == 1: if oneKeyAddCart == 1:

12
jd_xbhdl.js Normal file

File diff suppressed because one or more lines are too long