mirror of
https://github.com/frida/frida-node.git
synced 2026-11-07 09:35:57 -10:00
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]>
33 lines
767 B
TypeScript
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);
|
|
});
|
|
}
|