Rudra-ravi/frida-skills / frida-native-hooks
frida-native-hooks
VerifiedBuild Frida native hooks for C/C++/Objective-C functions, exports, imports, symbols, memory, Interceptor, NativeFunction, Stalker, and CModule.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.5 KB |
| agents/openai.yaml | config | 184 B |
| references/native-patterns.md | markdown | 1.4 KB |
references/native-patterns.md
View on GitHub# Native Patterns
## Export Hook
```js
const mod = Process.getModuleByName("libtarget.so");
const fn = mod.getExportByName("target");
Interceptor.attach(fn, {
onEnter(args) {
console.log("arg0", args[0]);
},
onLeave(retval) {
console.log("ret", retval);
}
});
```
## Import Hook
```js
for (const imp of Process.getModuleByName("app").enumerateImports()) {
if (imp.name === "strcmp") console.log(imp);
}
```
## Pattern Scan
```js
const m = Process.getModuleByName("libtarget.so");
Memory.scan(m.base, m.size, "13 37 ?? ??", {
onMatch(address) { console.log("match", address); },
onError(reason) { console.log("scan error", reason); },
onComplete() { console.log("scan done"); }
});
```
## Backtrace
```js
console.log(Thread.backtrace(this.context, Backtracer.ACCURATE)
.map(DebugSymbol.fromAddress)
.join("\n"));
```
## Replacement
```js
const openPtr = Process.getModuleByName("libc.so").getExportByName("open");
const open = new NativeFunction(openPtr, "int", ["pointer", "int"]);
Interceptor.replace(openPtr, new NativeCallback((pathPtr, flags) => {
const path = pathPtr.readUtf8String();
console.log("open", path);
return open(pathPtr, flags);
}, "int", ["pointer", "int"]));
```
## Performance
- Avoid expensive stringification in hot hooks.
- Sample or gate logs when functions fire frequently.
- Use `CModule` or `replaceFast()` only after a normal hook proves the target and overhead problem.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |