本帖最后由 yur0 于 2025-12-13 22:53 编辑
内存中有解密的代码dump出来,去一下混淆,调试打断点在CMP那直接改了一下,对比的hash应该是0xd9c56b0e
frida crack脚本,密码flag
const mod = Process.enumerateModules().find(m => {
const n = m.name.toLowerCase();
return n.startsWith('python') || n.startsWith('libpython');
});
if (!mod) throw new Error("Python module not found");
const exp = name => Module.getExportByName(mod.name, name);
const PyObject_RichCompare = exp('PyObject_RichCompare');
const PyBool_FromLong = new NativeFunction(exp('PyBool_FromLong'), 'pointer', ['long']);
const PyObject_Str = new NativeFunction(exp('PyObject_Str'), 'pointer', ['pointer']);
const PyUnicode_AsUTF8 = new NativeFunction(exp('PyUnicode_AsUTF8'), 'pointer', ['pointer']);
const PY_FALSE = PyBool_FromLong(0);
const T_RIGHT = "3653593870"; // 0xd9c56b0e
const T_LEFT = "3957603931"; // 0xebe43e5b
// PyObject -> decimal string
function toDecStr(obj) {
if (obj.isNull()) return null;
const s = PyObject_Str(obj);
if (s.isNull()) return null;
const p = PyUnicode_AsUTF8(s);
return p.isNull() ? null : Memory.readUtf8String(p);
}
console.log(`[+] Hook PyObject_RichCompare @ ${mod.name}`);
Interceptor.attach(PyObject_RichCompare, {
onEnter(args) {
this.hit = false;
const left = toDecStr(args[0]);
const right = toDecStr(args[1]);
if (right === T_RIGHT || left === T_LEFT) {
this.hit = true;
}
},
onLeave(retval) {
if (this.hit) {
retval.replace(PY_FALSE);
}
}
});
|