| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- """Decrypt the OTHER game caches (218620, 2912) and search for
- Encode6BitBuf Lua implementations or network protocol details.
- cache_218620 = 千河微变三职业 (same engine, 1844 lua)
- cache_2912 = unknown game (44 lua)
- """
- import sys
- from pathlib import Path
- sys.path.insert(0, str(Path(__file__).parent))
- from decrypt_client_lua import decrypt_file
- BASE = Path(r"D:\ProgramFiles\996box\GameBoxDownload\1\cq")
- OUT = Path("lua-dec2")
- for cache, label in [("cache_218620", "千河微变"), ("cache_2912", "game2912")]:
- src_root = BASE / cache
- files = list(src_root.rglob("*.lua"))
- print(f"=== {label} ({cache}): {len(files)} lua files ===")
- out_root = OUT / cache
- ok = 0
- for f in files:
- rel = f.relative_to(src_root)
- if decrypt_file(f, out_root / rel):
- ok += 1
- print(f" decrypted {ok}/{len(files)}")
- print()
- print("=== grep Encode6BitBuf in newly decrypted caches ===")
- for cache in ["cache_218620", "cache_2912"]:
- root = OUT / cache
- if not root.exists():
- continue
- for f in root.rglob("*.lua"):
- try:
- txt = f.read_text(encoding="utf-8", errors="replace")
- except Exception:
- continue
- if "Encode6BitBuf" in txt:
- idx = txt.find("Encode6BitBuf")
- # find function definition (not just call)
- window = txt[max(0, idx - 200) : idx + 500]
- if "function" in window[:250]:
- print(f"*** DEFINITION: {f.relative_to(OUT)} @ {idx} ***")
- print(window)
- print()
- else:
- print(f"call site: {f.relative_to(OUT)} @ {idx}")
- print()
- print("=== also grep 'function Encode' / 'Encode6' as definition ===")
- for f in OUT.rglob("*.lua"):
- try:
- txt = f.read_text(encoding="utf-8", errors="replace")
- except Exception:
- continue
- for needle in ("function Encode6", "Encode6BitBuf =", "Encode6BitBuf=function"):
- idx = txt.find(needle)
- if idx >= 0:
- print(f"*** {f.relative_to(OUT)} @ {idx}: {needle} ***")
- print(txt[idx : idx + 500])
- print()
|