Install Node.js 5.x, then:
npm install frida co uuid
and run:
node app.js
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/syspage.h> | |
int | |
main(int argc, char *argv[]) | |
{ | |
struct asinfo_entry *entries = SYSPAGE_ENTRY(asinfo); | |
size_t count = SYSPAGE_ENTRY_SIZE(asinfo) / sizeof(struct asinfo_entry); |
const Java = require('frida-java-bridge'); | |
const { getApi, withRunnableArtThread, ArtStackVisitor, translateMethod } = require('frida-java-bridge/lib/android'); | |
Java.perform(() => { | |
const AccountManager = Java.use('android.accounts.AccountManager'); | |
const m = AccountManager.getAccounts; | |
m.implementation = function (...args) { | |
console.log('getAccounts() called from: ' + JSON.stringify(captureBacktrace(), null, 2)); | |
return m.apply(this, args); |
[CCode (cheader_filename = "frida-core.h", cprefix = "Frida", lower_case_cprefix = "frida_")] | |
namespace Frida { | |
public static void init (); | |
public static void shutdown (); | |
public static void deinit (); | |
public static unowned GLib.MainContext get_main_context (); | |
public class DeviceManager : GLib.Object { | |
public DeviceManager (); |
Install Node.js 5.x, then:
npm install frida co uuid
and run:
node app.js
const THUMB_HOOK_REDIRECT_SIZE = 8; | |
const THUMB_BIT_REMOVAL_MASK = ptr(1).not(); | |
const trampolines: NativePointer[] = []; | |
const replacements: NativePointer[] = []; | |
export function makeTrampoline(target: NativePointer): NativePointer { | |
const targetAddress = target.and(THUMB_BIT_REMOVAL_MASK); | |
const trampoline = Memory.alloc(Process.pageSize); |
'use strict'; | |
var TrustManager; | |
var manager; | |
Java.perform(function () { | |
var X509TrustManager = Java.use('javax.net.ssl.X509TrustManager'); | |
TrustManager = Java.registerClass({ | |
name: 'com.example.TrustManager', |
'use strict'; | |
const slowCallback = new NativeCallback(value => { | |
console.log('slowCallback hit'); | |
return 43; | |
}, 'int', ['int']); | |
const fastCallback = Memory.alloc(Process.pageSize); | |
Memory.patchCode(fastCallback, 128, code => { | |
const cw = new X86Writer(code, { pc: fastCallback }); |
$ clang -Wall -Os -pipe -g3 frida-gum-example.c -o frida-gum-example -L. -lfrida-gum -lresolv -Wl,-dead_strip -Wl,-no_compact_unwind
$ ./frida-gum-example
[*] open("/etc/hosts")
[*] close(3)
[*] open("/etc/fstab")
[*] close(-1)
[*] listener got 4 calls
[*] listener still has 4 calls
For adding temporary logging to help understand behavior. For when it is impractical to use Frida to instrument Frida.
Choose one of these and copy-paste it into e.g. lib/interfaces/session.vala
,
then use log_event ("name='%s'", name);
to log.
When something appears to be hanging, try applying: x-async-debug.patch
.