41 lines
1.8 KiB
Python
41 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
import zipfile, os, subprocess
|
|
|
|
jars = [
|
|
r"e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\sa_core-forge-1.20.1-1.0.1.jar",
|
|
r"e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\sa_lib-forge-1.20.1-1.0.1.jar",
|
|
r"e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\sa_decor-forge-1.20.1-1.0.3.jar",
|
|
r"e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\sa_essentials-forge-1.20.1-1.0.0.jar",
|
|
]
|
|
|
|
TARGET = "com/ogaba/sacore/content/item/tool/MatchboxItem.class"
|
|
OUT = r"C:\Users\30272\AppData\Local\Temp\sa_check\javap_jar\out"
|
|
|
|
found = None
|
|
for j in jars:
|
|
if os.path.exists(j):
|
|
try:
|
|
with zipfile.ZipFile(j) as z:
|
|
for n in z.namelist():
|
|
if n.endswith("MatchboxItem.class") and "tool" in n:
|
|
found = (j, n)
|
|
print("FOUND in", j, "->", n)
|
|
break
|
|
except Exception as e:
|
|
print("ERR", j, e)
|
|
|
|
if found:
|
|
jar, name = found
|
|
dstdir = os.path.join(OUT, "com", "ogaba", "sacore", "content", "item", "tool")
|
|
os.makedirs(dstdir, exist_ok=True)
|
|
dst = os.path.join(dstdir, "MatchboxItem.class")
|
|
with zipfile.ZipFile(jar) as z:
|
|
with z.open(name) as src, open(dst, "wb") as out_f:
|
|
out_f.write(src.read())
|
|
print("EXTRACTED to", dst)
|
|
cfr = r"C:\Users\30272\AppData\Local\Temp\sa_check\javap_jar\cfr.jar"
|
|
r = subprocess.run(["java", "-jar", cfr, dst, "--outputdir", dstdir],
|
|
capture_output=True, text=True, timeout=120)
|
|
print("CFR stdout:", r.stdout[-2000:] if r.stdout else "")
|
|
print("CFR stderr:", r.stderr[-2000:] if r.stderr else "")
|