• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Go
  • License
    ISC License
  • Created about 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Frida Go bindings

frida-go

Go bindings for frida.

For the documentation, visit https://pkg.go.dev/github.com/frida/frida-go/frida.

Installation

  • GO111MODULE needs to be set to on or auto.
  • Download the frida-core-devkit from the Frida releases page for you operating system and architecture.
  • Extract the downloaded archive
  • Copy frida-core.h inside your systems include directory(inside /usr/local/include/) and libfrida-core.a inside your lib directory (usually /usr/local/lib).

To use in your project, just execute:

$ go get github.com/frida/frida-go/frida@latest

Supported OS:

  • MacOS
  • Linux
  • Android
  • Windows

The reason why windows is not supported it the problem compiling frida-core with mingw because mingw(needed by cgo) can't link with MSVC .lib files. If you manage to do it, feel free to submit your PR, also if you found any issues please submit new issue or create PR with the fix.

Small example

package main

import (
  "bufio"
  "fmt"
  "github.com/frida/frida-go/frida"
  "os"
)

var script = `
Interceptor.attach(Module.getExportByName(null, 'open'), {
	onEnter(args) {
		const what = args[0].readUtf8String();
		console.log("[*] open(" + what + ")");
	}
});
Interceptor.attach(Module.getExportByName(null, 'close'), {
	onEnter(args) {
		console.log("close called");
	}
});
`

func main() {
  mgr := frida.NewDeviceManager()

  devices, err := mgr.EnumerateDevices()
  if err != nil {
    panic(err)
  }

  for _, d := range devices {
    fmt.Println("[*] Found device with id:", d.ID())
  }

  localDev, err := mgr.LocalDevice()
  if err != nil {
    fmt.Println("Could not get local device: ", err)
    // Let's exit here because there is no point to do anything with nonexistent device
    os.Exit(1)
  }

  fmt.Println("[*] Chosen device: ", localDev.Name())

  fmt.Println("[*] Attaching to Telegram")
  session, err := localDev.Attach("Telegram", nil)
  if err != nil {
	  fmt.Println("Error occurred attaching:", err)
	  os.Exit(1)
  }

  script, err := session.CreateScript(script)
  if err != nil {
    fmt.Println("Error occurred creating script:", err)
	os.Exit(1)
  }

  script.On("message", func(msg string) {
    fmt.Println("[*] Received", msg)
  })

  if err := script.Load(); err != nil {
    fmt.Println("Error loading script:", err)
    os.Exit(1)
  }

  r := bufio.NewReader(os.Stdin)
  r.ReadLine()
}

Build and run it, output will look something like this:

$ go build example.go && ./example
[*] Found device with id: local
[*] Found device with id: socket
[*] Chosen device:  Local System
[*] Attaching to Telegram
[*] Received {"type":"log","level":"info","payload":"[*] open(/Users/daemon1/Library/Application Support/Telegram Desktop/tdata/user_data/cache/0/25/0FDE3ED70BCA)"}
[*] Received {"type":"log","level":"info","payload":"[*] open(/Users/daemon1/Library/Application Support/Telegram Desktop/tdata/user_data/cache/0/8E/FD728183E115)"}

More Repositories

1

frida

Clone this repo to build Frida
Meson
15,418
star
2

frida-python

Frida Python bindings
C
770
star
3

frida-gum

Cross-platform instrumentation and introspection library written in C
C
714
star
4

frida-core

Frida core library intended for static linking into bindings
Vala
599
star
5

cryptoshark

Self-optimizing cross-platform code tracer based on dynamic recompilation
C++
589
star
6

frida-tools

Frida CLI tools
Python
335
star
7

frida-java-bridge

Java runtime interop from Frida
JavaScript
324
star
8

frida-node

Frida Node.js bindings
C++
278
star
9

frida-compile

Compile a Frida script comprised of one or more Node.js modules
TypeScript
184
star
10

frida-rust

Frida Rust bindings
Rust
173
star
11

frida-swift

Frida Swift bindings
Swift
139
star
12

frida-itrace

Instruction tracer powered by Frida
TypeScript
129
star
13

frida-swift-bridge

Frida's finally getting Swifty
TypeScript
120
star
14

frida-presentations

Public presentations given on Frida at conferences
JavaScript
100
star
15

frida-website

Frida's website
CSS
84
star
16

frida-clr

Frida .NET bindings
C++
75
star
17

frida-objc-bridge

Objective-C runtime interop from Frida
JavaScript
48
star
18

tinycc

Frida depends on TinyCC
C
45
star
19

gumjs-net

Node.js's net module for Frida
JavaScript
41
star
20

frida-qml

Frida Qml plugin
C++
38
star
21

frida-web-client

Frida web client
TypeScript
36
star
22

v8

Frida depends on V8
C++
33
star
23

aurora

Proof-of-concept web app built on top of Frida
JavaScript
29
star
24

lwip

A Lightweight TCP/IP stack
C
25
star
25

glib

Frida depends on GLib
C
21
star
26

docker-images

Docker images for building portable binaries
C
20
star
27

gumjs-http

Node.js's http module for Frida
JavaScript
19
star
28

cloudspy

Proof-of-concept web app built on top of Frida
JavaScript
19
star
29

frida-codeshare

SCSS
18
star
30

libunwind

Frida uses libunwind for generating backtraces on some platforms
C
17
star
31

v8-build

Frida depends on V8
Python
11
star
32

frida-amiga-bridge

Amiga emulator instrumentation using Frida
TypeScript
10
star
33

stlport

Frida depends on stlport for building with older QNX toolchains
C++
9
star
34

frida-load

Load a Frida script comprised of one or more Node.js modules
JavaScript
9
star
35

geoshark

Tutorial: Build a debugger in 5 minutes
JavaScript
9
star
36

vala

Frida depends on Vala
Vala
9
star
37

corellium-action

GitHub Action for testing code on Corellium
JavaScript
8
star
38

releng

Frida release engineering tools
Python
8
star
39

frida-npapi

Frida browser plugin for NPAPI-compatible browsers
C++
7
star
40

frida-ci

Tools for running and setting up the continuous integration server
C
7
star
41

xz

Frida depends on liblzma on OSes where it uses libunwind for generating backtraces
C
5
star
42

elfutils

Frida depends on elfutils for libelf on some platforms
C
5
star
43

proxy-libintl

Proxy for a dynamically loaded optional libintl
C
5
star
44

libxml2

Frida depends on libsoup, which depends on libxml2
C
4
star
45

glib-openssl

Frida used to depend on glib-openssl on some platforms, now uses glib-networking instead
C
4
star
46

corellium-gateway

Corellium gateway used by corellium-action
JavaScript
4
star
47

libtool

Frida depends on libtool for its UNIX build system
Shell
3
star
48

openssl

Frida (optionally) depends on OpenSSL
C
3
star
49

gumjs-https

Node.js's https module for Frida
JavaScript
2
star
50

frida-process

Node.js compatible “process” module for Frida
JavaScript
2
star
51

json-glib

Frida depends on json-glib
C
2
star
52

frida-buffer

Frida compatibility shim for the “buffer” module
JavaScript
2
star
53

glib-networking

Frida depends on glib-networking on some platforms
C
2
star
54

web-shims

Meta-package pulling in shims needed for web apps
JavaScript
2
star
55

libsoup

Frida depends on libsoup
C
2
star
56

libiconv

Frida depends on libiconv on some systems
C
2
star
57

v8-zlib

Frida depends on V8
C
1
star
58

gumjs-stream

Node.js's stream module for Frida
JavaScript
1
star
59

frida-any-promise

Frida compatibility shim for the “any-promise” module
JavaScript
1
star
60

libgee

Frida depends on libgee
Vala
1
star
61

pcre

Frida depends on GLib, which used to depend on PCRE (these days it depends on PCRE2)
C
1
star
62

pkg-config

Frida uses pkg-config during its build process
C
1
star