Files
Ole André Vadla RavnåsandHåvard Sørbø e2ffd0aa6c Auto-generate Node-API bindings from .gir
Which means API changes in frida-core are instantly reflected, with only
customizations needing tweaking, if applicable.

And, since we now target Node-API there will now only be one prebuilt
binary per OS/ABI.

Co-authored-by: Håvard Sørbø <[email protected]>
2025-05-08 10:05:20 +02:00

33 lines
767 B
TypeScript

import frida from "frida";
import { targetProgram } from "./data/index.js";
export class LabRat {
private constructor(private _pid: number) {
}
get pid(): number {
return this._pid;
}
static async start(): Promise<LabRat> {
const pid = await frida.spawn(targetProgram(), {
stdio: frida.Stdio.Pipe
});
await frida.resume(pid);
// TODO: improve injectors to handle injection into a process that hasn't yet finished initializing
await sleep(50);
return new LabRat(pid);
}
stop(): void {
frida.kill(this._pid);
}
}
function sleep(delay: number): Promise<void> {
return new Promise(resolve => {
setTimeout(() => { resolve(); }, delay);
});
}