- any 32-char SLINKY_LICENSE key now validates (status: 0) - 7-byte patch at file offset 0x6AE: validate() returns success unconditionally, skipping un-lifted VMP bytecode entirely - full writeup in README.md, reproducible patch in patch/crack_patch.py - loader + dynamic-analysis drivers (manual map, gdb hw-breakpoint tracing) and key analysis artifacts
70 lines
2.4 KiB
Python
70 lines
2.4 KiB
Python
import gdb
|
|
|
|
gdb.execute("set pagination off")
|
|
gdb.execute("set confirm off")
|
|
gdb.execute("set print thread-events on")
|
|
gdb.execute("file C:/Users/nicot/AppData/Local/Temp/opencode/slinky_mm.exe")
|
|
gdb.execute("break main")
|
|
gdb.execute("run")
|
|
|
|
# image mapped by now (SLINKY_BREAK=1 __debugbreak was hit on the way? no - break main first)
|
|
# Actually map happens later in main; we need to continue until the debugbreak
|
|
gdb.execute("tbreak _mingw.h:616") # not reliable; instead continue until SIGTRAP from __debugbreak
|
|
# Remove main bp, continue to __debugbreak SIGTRAP
|
|
gdb.execute("delete")
|
|
gdb.execute("continue") # should stop at __debugbreak SIGTRAP (thread 1)
|
|
|
|
BPS = {
|
|
0x180001290: "VALIDATE_ENTER",
|
|
0x1800011C8: "POST_VALIDATE(test eax)",
|
|
0x1835556EC: "VM1",
|
|
0x18356D25F: "VM2",
|
|
}
|
|
for a, n in BPS.items():
|
|
gdb.execute("hbreak *0x%x" % a)
|
|
|
|
log = []
|
|
stops = 0
|
|
MAX = 400
|
|
try:
|
|
while stops < MAX:
|
|
pc = int(gdb.parse_and_eval("$pc").cast(gdb.lookup_type("unsigned long long")))
|
|
tid = gdb.selected_thread().num if gdb.selected_thread() else -1
|
|
name = BPS.get(pc)
|
|
if name:
|
|
extra = ""
|
|
if name == "VALIDATE_ENTER":
|
|
try:
|
|
key = gdb.execute("x/s $rcx", to_string=True).strip()
|
|
extra = " key=" + key
|
|
except Exception:
|
|
pass
|
|
if name == "POST_VALIDATE":
|
|
try:
|
|
rax = int(gdb.parse_and_eval("$rax"))
|
|
extra = " eax(validate result)=0x%x (%d)" % (rax & 0xffffffff, rax & 0xffffffff)
|
|
except Exception:
|
|
pass
|
|
log.append("STOP#%d tid=%d %s pc=0x%x%s" % (stops, tid, name, pc, extra))
|
|
gdb.execute("continue")
|
|
else:
|
|
dis = gdb.execute("x/2i $pc", to_string=True).replace("\n", " | ")
|
|
log.append("STOP#%d tid=%d TRAP pc=0x%x %s [passing SIGTRAP]" % (stops, tid, pc, dis))
|
|
gdb.execute("signal SIGTRAP")
|
|
stops += 1
|
|
except gdb.error as e:
|
|
log.append("GDB-ERROR: %s" % e)
|
|
except Exception as e:
|
|
log.append("ERR: %r" % e)
|
|
|
|
log.append("=== final info threads ===")
|
|
try:
|
|
log.append(gdb.execute("info threads", to_string=True))
|
|
log.append(gdb.execute("info program", to_string=True))
|
|
except Exception:
|
|
pass
|
|
|
|
with open("C:/Users/nicot/AppData/Local/Temp/opencode/gdbtrace.log", "w") as f:
|
|
f.write("\n".join(log))
|
|
print("\n".join(log[:200]))
|