This commit is contained in:
upload
2026-11-11 22:25:40 +08:00
commit d87848d502
325 changed files with 3894 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
# 从小程序包缓存里提取签名 SDK(jsguard)到 mtgsig_js/
# 用法: python 提取jsguard.py [appid ...] 不带参数 = 提取本机所有已缓存的小程序
# 前提:该小程序在 PC 微信里被打开过(package 会缓存到 WMPF 的 applet/packages)
import os
import sys
import glob
import shutil
import tempfile
import subprocess
WECHAT_USERS = os.path.expandvars(r'%APPDATA%\Tencent\xwechat\radium\users')
UNVEILR = r'C:\Users\mjz\Downloads\unveilr.exe'
OUT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mtgsig_js')
def find_packages():
pkgs = {}
for appid_dir in glob.glob(os.path.join(WECHAT_USERS, '*', 'applet', 'packages', '*')):
appid = os.path.basename(appid_dir)
versions = sorted(d for d in glob.glob(os.path.join(appid_dir, '*')) if os.path.isdir(d))
if versions:
pkgs[appid] = versions[-1] # 取最大版本号
return pkgs
def extract(appid, pkg_dir):
tmp = tempfile.mkdtemp(prefix='jsg_')
try:
subprocess.run([UNVEILR, 'wx', '-o', tmp, '-d', '2', pkg_dir],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
hits = glob.glob(os.path.join(tmp, '**', 'wx-jsguard', 'dist', 'jsguard.js'), recursive=True)
if not hits:
print(' %s 里没有 jsguard(可能不是美团小程序)' % appid)
return False
dst = os.path.join(OUT_DIR, 'jsguard-%s.js' % appid)
shutil.copy(hits[0], dst)
print(' 已提取 %s -> %s (%d 字节)' % (appid, dst, os.path.getsize(dst)))
return True
finally:
shutil.rmtree(tmp, ignore_errors=True)
if __name__ == '__main__':
pkgs = find_packages()
targets = sys.argv[1:] or sorted(pkgs)
for appid in targets:
if appid not in pkgs:
print(' 跳过 %s:本机没有它的包缓存(先在 PC 微信里打开一次这个小程序)' % appid)
continue
print('处理 %s (%s)' % (appid, pkgs[appid]))
extract(appid, pkgs[appid])