8000 GitHub - frida/frida-go: Frida Go bindings · GitHub
[go: up one dir, main page]

Skip to content
{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2Fgithub.com%2Ffrida%2Ffrida-go%2F","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E\u0026source=header-repo\u0026source_repo=frida%2Ffrida-go","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://github.com/frida/frida-go\",\"user_id\":null}}","auth_hydro_click_hmac":"9128099924cee7d62e83085093d11a37aaee4ed562dd0c4f66557e57b4d9b4b5"}}
fridaPublic

About

Frida Go bindings

Resources

Stars

221 stars

Watchers

7 watching

Forks

Latest commit

 

History

241 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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)"}

About

Frida Go bindings

Resources

Stars

221 stars

Watchers

7 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

0