Skip to content

A Frida agent template written in TypeScript, using esbuild for fast and efficient builds. Includes hooks for Android applications and a streamlined development workflow.

Notifications You must be signed in to change notification settings

giacomoferretti/frida-agent-typescript-esbuild

Repository files navigation

Frida Agent TypeScript - esbuild

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.

Usage

  1. Clone the repo

    git clone https://github.com/giacomoferretti/frida-agent-typescript-esbuild
  2. Install dependencies

    pnpm i
  3. Build packages

    pnpm --filter frida-hooks build
  4. Build agent

    pnpm --filter com.example.app build
  5. Run agent

    python scripts/run.py run -w -f apps/com.example.app/dist/agent.js com.example.app

Hooks

android.app.Activity.onCreate

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);

Frequently Asked Questions

Why don't you use frida-compile?

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!

About

A Frida agent template written in TypeScript, using esbuild for fast and efficient builds. Includes hooks for Android applications and a streamlined development workflow.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published