| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- """Deep string analysis of cq.exe (launcher shell) to find how it spawns cq2.exe.
- cq.exe (1.6MB) reads env.json (gameid/token) and spawns cq2.exe.
- Hunt for:
- - CreateProcess command templates (e.g. "cq2.exe %s")
- - Quote/percent format strings near 'cq2' or 'exe'
- - Full command lines in adjacent data
- """
- import re
- import struct
- import sys
- from pathlib import Path
- EXE = Path(r"D:\ProgramFiles\996box\GameBoxDownload\1\cq.exe")
- data = EXE.read_bytes()
- print(f"cq.exe: {len(data)} bytes")
- # 1. All strings containing cq2
- print("=== strings containing 'cq2' ===")
- for m in re.finditer(rb"[\x20-\x7e]{4,200}", data):
- s = m.group()
- if b"cq2" in s.lower():
- print(f" @{m.index:#x}: {s.decode('ascii', errors='replace')}")
- print()
- # 2. Strings containing env.json (context of reading)
- print("=== strings near 'env.json' ===")
- for m in re.finditer(rb"env\.json", data):
- start = max(0, m.start() - 100)
- end = min(len(data), m.end() + 200)
- window = data[start:end]
- txt = window.decode("ascii", errors="replace")
- txt = "".join(c if 32 <= ord(c) < 127 else "·" for c in txt)
- print(f" @{m.start():#x}: {txt}")
- print()
- # 3. Format-string-like patterns (%s with exe/dll neighbors)
- print("=== printf-style templates mentioning exe ===")
- for m in re.finditer(rb"[\x20-\x7e]{6,120}", data):
- s = m.group().decode("ascii", errors="replace")
- if ("%s" in s or "%d" in s) and ("exe" in s.lower() or "game" in s.lower() or "open" in s.lower()):
- print(f" @{m.index:#x}: {s}")
- print()
- # 4. Command-line-ish: strings with quotes and .exe
- print("=== strings with .exe inside quotes ===")
- for m in re.finditer(rb'"[\x20-\x7e]{4,150}\.exe[\x20-\x7e]{0,100}"', data):
- print(f" @{m.index:#x}: {m.group().decode('ascii', errors='replace')}")
- print()
- # 5. URL-like strings (http/https)
- print("=== http(s) URLs ===")
- seen = set()
- for m in re.finditer(rb"https?://[\x21-\x7e]{6,100}", data):
- u = m.group().decode("ascii", errors="replace")
- if u not in seen:
- seen.add(u)
- print(f" {u}")
|