A Frida agent template built with TypeScript and esbuild
. This project provides an optimized way to develop Frida hooks for Android applications, offering a modern TypeScript-based workflow.
-
Clone the repo
git clone https://github.com/giacomoferretti/frida-agent-typescript-esbuild
-
Install dependencies
pnpm i
-
Build packages
pnpm --filter frida-hooks build
-
Build agent
pnpm --filter com.example.app build
-
Run agent
python scripts/run.py run -w -f apps/com.example.app/dist/agent.js com.example.app
import { hookActivity } from "frida-hooks";
import { sendDataAndLog } from "frida-hooks/log";
import { parseBundle } from "frida-hooks/utils";
const main = () => {
try {
hookActivity({
beforeSet: (bundle, activity) => {
const intent = activity.getIntent();
let data = intent.getData();
if (data != null) {
data = data.toString();
}
sendDataAndLog("Activity.onCreate", {
activity: activity.$className,
action: intent.getAction(),
data,
bundle: parseBundle(bundle),
extras: parseBundle(intent.getExtras()),
});
// Return unmodified
return bundle;
},
});
} catch (e) {
sendDataAndLog("Couldn't hook Activitys", e);
}
};
Java.perform(main);
I used frida-compile
until recently when I started encountering unable to resolve
error messages. That's when I came across this comment from @kursattkorkmazzz: frida/frida-compile#61 (comment). Simply switching to esbuild made everything work—and it's faster too!