42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Read-only: dump instance entry from indexUserConfig.xml + autorun-ish attrs
|
|
from userdata Config.xml. All output unicode-escaped (console is GBK)."""
|
|
import os
|
|
import re
|
|
|
|
d = open(r"C:\sanguo_bigqmt\qmt_install_dir.txt", encoding="utf-8").read().strip()
|
|
root = os.path.dirname(d)
|
|
|
|
|
|
def esc(s):
|
|
return s.encode("unicode_escape").decode("ascii")
|
|
|
|
|
|
# --- 1) indexUserConfig.xml: element(s) containing the instance name ---
|
|
p1 = os.path.join(root, "config", "indexUserConfig.xml")
|
|
t1 = open(p1, encoding="utf-8", errors="replace").read()
|
|
name = "新建策略文件3"
|
|
for m in re.finditer(re.escape(name), t1):
|
|
a = max(0, m.start() - 1500)
|
|
b = min(len(t1), m.end() + 1500)
|
|
print("=== indexUserConfig ctx ===")
|
|
print(esc(t1[a:b]))
|
|
print("=== end ===")
|
|
break # first occurrence with wide context
|
|
|
|
# also list all attribute names seen in file for flag hunting
|
|
attrs = sorted(set(re.findall(r'([A-Za-z][A-Za-z0-9_]{2,30})\s*=', t1)))
|
|
print("ATTRS", esc(",".join(attrs)))
|
|
|
|
# --- 2) userdata Config.xml: every line with boot/autorun/mod flags ---
|
|
p2 = os.path.join(root, "userdata", "users", "66639661", "Config.xml")
|
|
t2 = open(p2, encoding="utf-8", errors="replace").read()
|
|
print("=== Config.xml flag lines ===")
|
|
pat = re.compile(r"(modbootstart|autorun|auto_run|bootstart|selfstart|autostart)", re.I)
|
|
for m in pat.finditer(t2):
|
|
a = max(0, m.start() - 300)
|
|
b = min(len(t2), m.end() + 300)
|
|
print(esc(t2[a:b]))
|
|
print("---")
|
|
print("DONE")
|