Documentation ¶
Overview ¶
Package frida provides Go bindings for frida. Some of the provided functionality includes:
* Listing devices/applications/processes * Attaching to applications/processes * Fetching information about devices/applications/processes
Example ¶
manager := NewDeviceManager() devices, err := manager.EnumerateDevices() if err != nil { panic(err) } fmt.Printf("[*] Frida version: %s\n", Version()) fmt.Println("[*] Devices: ") for _, device := range devices { fmt.Printf("[*] %s => %s\n", device.Name(), device.ID()) }
Output:
Index ¶
- Variables
- func GValueToGo(val *C.GValue) any
- func PatchAndroidSELinux()
- func Version() string
- type Address
- type Application
- type AuthenticationFn
- type Bus
- type Cancellable
- type Certificate
- type Child
- type ChildOrigin
- type Compiler
- type Crash
- type Device
- func (d *Device) Attach(val any, sessionOpts *SessionOptions, opts ...OptFunc) (*Session, error)
- func (d *Device) AttachWithContext(ctx context.Context, val any, sessionOpts *SessionOptions) (*Session, error)
- func (d *Device) Bus() *Bus
- func (d *Device) Clean()
- func (d *Device) DeviceIcon() any
- func (d *Device) DeviceType() DeviceType
- func (d *Device) DisableSpawnGating() error
- func (d *Device) EnableSpawnGating() error
- func (d *Device) EnumerateApplications(identifier string, scope Scope, opts ...OptFunc) ([]*Application, error)
- func (d *Device) EnumeratePendingChildren() ([]*Child, error)
- func (d *Device) EnumeratePendingSpawn() ([]*Spawn, error)
- func (d *Device) EnumerateProcesses(scope Scope) ([]*Process, error)
- func (d *Device) FindProcessByName(name string, scope Scope) (*Process, error)
- func (d *Device) FindProcessByPID(pid int, scope Scope) (*Process, error)
- func (d *Device) FrontmostApplication(scope Scope) (*Application, error)
- func (d *Device) ID() string
- func (d *Device) InjectLibraryBlob(target any, byteData []byte, entrypoint, data string) (uint, error)
- func (d *Device) InjectLibraryFile(target any, path, entrypoint, data string) (uint, error)
- func (d *Device) Input(pid int, data []byte) error
- func (d *Device) IsLost() bool
- func (d *Device) Kill(pid int) error
- func (d *Device) Manager() *DeviceManager
- func (d *Device) Name() string
- func (d *Device) On(sigName string, fn any)
- func (d *Device) OpenChannel(address string) (*IOStream, error)
- func (d *Device) OpenService(address string) (*Service, error)
- func (d *Device) Params(opts ...OptFunc) (map[string]any, error)
- func (d *Device) ParamsWithContext(ctx context.Context) (map[string]any, error)
- func (d *Device) ProcessByName(name string, scope Scope) (*Process, error)
- func (d *Device) ProcessByPID(pid int, scope Scope) (*Process, error)
- func (d *Device) Resume(pid int) error
- func (d *Device) Spawn(name string, opts *SpawnOptions) (int, error)
- type DeviceInt
- type DeviceManager
- func (d *DeviceManager) AddRemoteDevice(address string, remoteOpts *RemoteDeviceOptions) (DeviceInt, error)
- func (d *DeviceManager) Clean()
- func (d *DeviceManager) Close() error
- func (d *DeviceManager) DeviceByID(id string) (DeviceInt, error)
- func (d *DeviceManager) DeviceByType(devType DeviceType) (DeviceInt, error)
- func (d *DeviceManager) EnumerateDevices() ([]DeviceInt, error)
- func (d *DeviceManager) FindDeviceByID(id string) (DeviceInt, error)
- func (d *DeviceManager) FindDeviceByType(devType DeviceType) (DeviceInt, error)
- func (d *DeviceManager) LocalDevice() (DeviceInt, error)
- func (d *DeviceManager) On(sigName string, fn any)
- func (d *DeviceManager) RemoteDevice() (DeviceInt, error)
- func (d *DeviceManager) RemoveRemoteDevice(address string) error
- func (d *DeviceManager) USBDevice() (DeviceInt, error)
- type DeviceManagerInt
- type DeviceType
- type EParams
- type EndpointParameters
- func (e *EndpointParameters) Address() string
- func (e *EndpointParameters) AssetRoot() string
- func (e *EndpointParameters) Certificate() *Certificate
- func (e *EndpointParameters) Clean()
- func (e *EndpointParameters) Origin() string
- func (e *EndpointParameters) Port() uint16
- func (e *EndpointParameters) SetAssetRoot(assetPath string)
- type FileMonitor
- type IOStream
- func (ios *IOStream) Clean()
- func (ios *IOStream) Close() error
- func (ios *IOStream) IsClosed() bool
- func (ios *IOStream) Read(data *[]byte) (int, error)
- func (ios *IOStream) ReadAll(count int) ([]byte, error)
- func (ios *IOStream) Write(data []byte) (int, error)
- func (ios *IOStream) WriteAll(data []byte) error
- type LevelType
- type Message
- type MessageType
- type OptFunc
- type PeerOptions
- type Portal
- func (p *Portal) Broadcast(json string, data []byte)
- func (p *Portal) Clean()
- func (p *Portal) ClusterParams() *EndpointParameters
- func (p *Portal) ControlParams() *EndpointParameters
- func (p *Portal) Device() DeviceInt
- func (p *Portal) EnumerateTags(connectionID uint) []string
- func (p *Portal) Kick(connectionID uint)
- func (p *Portal) Narrowcast(tag, json string, data []byte)
- func (p *Portal) On(sigName string, fn any)
- func (p *Portal) Post(connectionID uint, json string, data []byte)
- func (p *Portal) Start() error
- func (p *Portal) Stop() error
- func (p *Portal) TagConnection(connectionID uint, tag string)
- func (p *Portal) UntagConnection(connectionID uint, tag string)
- type PortalMembership
- type PortalOptions
- func (p *PortalOptions) ACL() []string
- func (p *PortalOptions) Certificate() *Certificate
- func (p *PortalOptions) Clean()
- func (p *PortalOptions) SetACL(acls []string)
- func (p *PortalOptions) SetCertificate(certPath string) error
- func (p *PortalOptions) SetToken(token string)
- func (p *PortalOptions) Token() string
- type Process
- type Realm
- type Relay
- type RelayKind
- type RemoteDeviceOptions
- func (r *RemoteDeviceOptions) Certificate() *Certificate
- func (r *RemoteDeviceOptions) Clean()
- func (r *RemoteDeviceOptions) KeepAliveInterval() int
- func (r *RemoteDeviceOptions) Origin() string
- func (r *RemoteDeviceOptions) SetCertificate(certPath string) error
- func (r *RemoteDeviceOptions) SetKeepAlive(interval int)
- func (r *RemoteDeviceOptions) SetOrigin(origin string)
- func (r *RemoteDeviceOptions) SetToken(token string)
- func (r *RemoteDeviceOptions) Token() string
- type Runtime
- type Scope
- type Script
- func (s *Script) Clean()
- func (s *Script) DisableDebugger() error
- func (s *Script) EnableDebugger(port uint16) error
- func (s *Script) Eternalize() error
- func (s *Script) ExportsCall(fn string, args ...any) any
- func (s *Script) ExportsCallWithContext(ctx context.Context, fn string, args ...any) any
- func (s *Script) IsDestroyed() bool
- func (s *Script) Load() error
- func (s *Script) On(sigName string, fn any)
- func (s *Script) Post(jsonString string, data []byte)
- func (s *Script) Unload() error
- type ScriptOptions
- func (s *ScriptOptions) Clean()
- func (s *ScriptOptions) Name() string
- func (s *ScriptOptions) SetName(name string)
- func (s *ScriptOptions) SetRuntime(rt ScriptRuntime)
- func (s *ScriptOptions) SetSnapshot(value []byte)
- func (s *ScriptOptions) SetSnapshotTransport(tr SnapshotTransport)
- func (s *ScriptOptions) Snapshot() []byte
- func (s *ScriptOptions) SnapshotTransport() SnapshotTransport
- type ScriptRuntime
- type Service
- type ServiceInt
- type Session
- func (s *Session) Clean()
- func (s *Session) CompileScript(script string, opts *ScriptOptions) ([]byte, error)
- func (s *Session) CreateScript(script string) (*Script, error)
- func (s *Session) CreateScriptBytes(script []byte, opts *ScriptOptions) (*Script, error)
- func (s *Session) CreateScriptWithOptions(script string, opts *ScriptOptions) (*Script, error)
- func (s *Session) CreateScriptWithSnapshot(script string, snapshot []byte) (*Script, error)
- func (s *Session) Detach(opts ...OptFunc) error
- func (s *Session) DetachWithContext(ctx context.Context) error
- func (s *Session) DisableChildGating() error
- func (s *Session) EnableChildGating() error
- func (s *Session) IsDetached() bool
- func (s *Session) JoinPortal(address string, opts *PortalOptions) (*PortalMembership, error)
- func (s *Session) On(sigName string, fn any)
- func (s *Session) Resume() error
- func (s *Session) SetupPeerConnection(opts *PeerOptions) error
- func (s *Session) SnapshotScript(embedScript string, snapshotOpts *SnapshotOptions) ([]byte, error)
- type SessionDetachReason
- type SessionOptions
- type SnapshotOptions
- type SnapshotTransport
- type Spawn
- type SpawnOptions
- func (s *SpawnOptions) Argv() []string
- func (s *SpawnOptions) Aux() map[string]any
- func (s *SpawnOptions) Clean()
- func (s *SpawnOptions) Cwd() string
- func (s *SpawnOptions) Env() []string
- func (s *SpawnOptions) Envp() []string
- func (s *SpawnOptions) SetArgv(argv []string)
- func (s *SpawnOptions) SetCwd(cwd string)
- func (s *SpawnOptions) SetEnv(env map[string]string)
- func (s *SpawnOptions) SetEnvp(envp map[string]string)
- func (s *SpawnOptions) SetStdio(stdio Stdio)
- func (s *SpawnOptions) Stdio() Stdio
- type Stdio
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrContextCancelled = errors.New("context cancelled")
)
Functions ¶
func GValueToGo ¶ added in v0.8.0
GValueToGo is the function that is called upon unmarshalling glib values into go corresponding ones.
func PatchAndroidSELinux ¶
func PatchAndroidSELinux()
PatchAndroidSELinux tries to patch selinux; root access is required.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application represents the main application installed on the device
func (*Application) Clean ¶
func (a *Application) Clean()
Clean will clean resources held by the application.
func (*Application) Identifier ¶
func (a *Application) Identifier() string
Identifier returns application bundle identifier
func (*Application) PID ¶
func (a *Application) PID() int
PID returns application PID or "-" if it could not be obtained when application is not running
func (*Application) Params ¶
func (a *Application) Params() map[string]any
Params return the application parameters, like version, path etc
func (*Application) String ¶
func (a *Application) String() string
String returns the string representation of Application printing identifier, name and pid
type AuthenticationFn ¶
AuthenticationFn is a callback function passed to the endpoint params. Function does authentication and in the case the user is authenticated, non-empty string is returned. If the user is not authenticated, empty string should be returned.
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus represent bus used to communicate with the devices.
func (*Bus) IsDetached ¶
IsDetached returns whether the bus is detached from the device or not.
type Cancellable ¶ added in v0.11.0
type Cancellable struct {
// contains filtered or unexported fields
}
func NewCancellable ¶ added in v0.11.0
func NewCancellable() *Cancellable
NewCancellable wraps GCancellable used to provide ability to cancel frida funcs. Reminder that the caller must either `Cancellable.Cancel()` or `Cancellable.Unref()` to unref the underlying C data.
func (*Cancellable) Cancel ¶ added in v0.11.0
func (c *Cancellable) Cancel()
Cancel sends the cancel signal to GCancellable as well unrefs
func (*Cancellable) Unref ¶ added in v0.11.0
func (c *Cancellable) Unref()
Unref unrefs the wrapped GCancellable
type Certificate ¶
type Certificate struct {
// contains filtered or unexported fields
}
Certificate represents the GTlsCertificate.
func (*Certificate) IssuerName ¶ added in v0.3.0
func (c *Certificate) IssuerName() string
IssuerName returns the issuer name for the certificate.
func (*Certificate) NotValidAfter ¶ added in v0.3.0
func (c *Certificate) NotValidAfter() (time.Time, error)
NotValidAfter returns the time after which certificate is not valid.
func (*Certificate) NotValidBefore ¶ added in v0.3.0
func (c *Certificate) NotValidBefore() (time.Time, error)
NotValidBefore returns the time before which certificate is not valid.
func (*Certificate) SubjectName ¶ added in v0.3.0
func (c *Certificate) SubjectName() string
SubjectName returns the subject name for the certificate.
type Child ¶
type Child struct {
// contains filtered or unexported fields
}
Child type represents child when child gating is enabled.
func (*Child) Identifier ¶
Identifier returns string identifier of the child.
type ChildOrigin ¶
type ChildOrigin int
const ( ChildOriginFork ChildOrigin = iota ChildOriginExec ChildOriginSpawn )
func (ChildOrigin) String ¶
func (origin ChildOrigin) String() string
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
Compiler type is used to compile scripts.
func (*Compiler) Clean ¶
func (c *Compiler) Clean()
Clean will clean resources held by the compiler.
func (*Compiler) On ¶
On connects compiler to specific signals. Once sigName is triggered, fn callback will be called with parameters populated.
Signals available are:
- "starting" with callback as func() {}
- "finished" with callback as func() {}
- "output" with callback as func(bundle string) {}
- "diagnostics" with callback as func(diag string) {}
- "file_changed" with callback as func() {}
type Crash ¶
type Crash struct {
// contains filtered or unexported fields
}
Crash represents crash of frida.
func (*Crash) ProcessName ¶
ProcessName returns the name of the process that crashed
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents Device struct from frida-core
func DeviceByID ¶ added in v0.7.0
DeviceByID tries to get the device by id on the default manager
func LocalDevice ¶
func LocalDevice() *Device
LocalDevice is a wrapper around DeviceByType(DeviceTypeLocal).
func USBDevice ¶
func USBDevice() *Device
USBDevice is a wrapper around DeviceByType(DeviceTypeUsb).
func (*Device) Attach ¶
Attach will attach on specified process name or PID. You can pass the nil as SessionOptions or you can create it if you want the session to persist for specific timeout.
func (*Device) AttachWithContext ¶ added in v0.12.0
func (d *Device) AttachWithContext(ctx context.Context, val any, sessionOpts *SessionOptions) (*Session, error)
AttachWithContext runs Attach but with context. This function will properly handle cancelling the frida operation. It is advised to use this rather than handling Cancellable yourself.
func (*Device) DeviceIcon ¶
DeviceIcon will return the device icon.
func (*Device) DeviceType ¶
func (d *Device) DeviceType() DeviceType
DeviceType returns type of the device.
func (*Device) DisableSpawnGating ¶
DisableSpawnGating will disable spawn gating on the device.
func (*Device) EnableSpawnGating ¶
EnableSpawnGating will enable spawn gating on the device.
func (*Device) EnumerateApplications ¶
func (d *Device) EnumerateApplications(identifier string, scope Scope, opts ...OptFunc) ([]*Application, error)
EnumerateApplications will return slice of applications on the device You can add an option with the variadic opts argument
Example:
apps, err := device.EnumerateApplications("", frida.ScopeFull) // or providing the option to cancel cancel := frida.NewCancellable() apps, err := device.EnumerateApplications("", frida.ScopeFull, frida.WithCancel(c)) // ... cancel.Cancel()
func (*Device) EnumeratePendingChildren ¶
EnumeratePendingChildren will return the slice of pending children.
func (*Device) EnumeratePendingSpawn ¶
EnumeratePendingSpawn will return the slice of pending spawns.
func (*Device) EnumerateProcesses ¶
EnumerateProcesses will slice of processes running with scope provided
func (*Device) FindProcessByName ¶
FindProcessByName will try to find the process with name specified.
func (*Device) FindProcessByPID ¶
FindProcessByPID will try to find the process with given pid.
func (*Device) FrontmostApplication ¶
func (d *Device) FrontmostApplication(scope Scope) (*Application, error)
FrontmostApplication will return the frontmost application or the application in focus on the device.
func (*Device) InjectLibraryBlob ¶
func (d *Device) InjectLibraryBlob(target any, byteData []byte, entrypoint, data string) (uint, error)
InjectLibraryBlob will inject the library in the target with byteData path. Entrypoint is the entrypoint to the library and the data is any data you need to pass to the library.
func (*Device) InjectLibraryFile ¶
InjectLibraryFile will inject the library in the target with path to library specified. Entrypoint is the entrypoint to the library and the data is any data you need to pass to the library.
func (*Device) Manager ¶
func (d *Device) Manager() *DeviceManager
Manager returns device manager for the device.
func (*Device) On ¶
On connects device to specific signals. Once sigName is triggered, fn callback will be called with parameters populated.
Signals available are:
- "spawn_added" with callback as func(spawn *frida.Spawn) {}
- "spawn_removed" with callback as func(spawn *frida.Spawn) {}
- "child_added" with callback as func(child *frida.Child) {}
- "child_removed" with callback as func(child *frida.Child) {}
- "process_crashed" with callback as func(crash *frida.Crash) {}
- "output" with callback as func(pid, fd int, data []byte) {}
- "uninjected" with callback as func(id int) {}
- "lost" with callback as func() {}
func (*Device) OpenChannel ¶
OpenChannel open channel with the address and returns the IOStream
func (*Device) OpenService ¶ added in v0.8.0
func (*Device) Params ¶
Params returns system parameters of the device You can add an option with the variadic opts argument.
Example:
params, err := device.Params() // or WithCancel cancel := frida.NewCancellable() params, err := device.Params(frida.WithCancel(c)) // ... cancel.Cancel()
func (*Device) ParamsWithContext ¶ added in v0.12.0
ParamsWithContext runs Params but with context. This function will properly handle cancelling the frida operation. It is advised to use this rather than handling Cancellable yourself.
func (*Device) ProcessByName ¶
ProcessByName returns the process by passed name.
func (*Device) ProcessByPID ¶
ProcessByPID returns the process by passed pid.
type DeviceInt ¶ added in v0.7.1
type DeviceInt interface { ID() string Name() string DeviceIcon() any DeviceType() DeviceType Bus() *Bus Manager() *DeviceManager IsLost() bool Params(opts ...OptFunc) (map[string]any, error) ParamsWithContext(ctx context.Context) (map[string]any, error) FrontmostApplication(scope Scope) (*Application, error) EnumerateApplications(identifier string, scope Scope, opts ...OptFunc) ([]*Application, error) ProcessByPID(pid int, scope Scope) (*Process, error) ProcessByName(name string, scope Scope) (*Process, error) FindProcessByPID(pid int, scope Scope) (*Process, error) FindProcessByName(name string, scope Scope) (*Process, error) EnumerateProcesses(scope Scope) ([]*Process, error) EnableSpawnGating() error DisableSpawnGating() error EnumeratePendingSpawn() ([]*Spawn, error) EnumeratePendingChildren() ([]*Child, error) Spawn(name string, opts *SpawnOptions) (int, error) Input(pid int, data []byte) error Resume(pid int) error Kill(pid int) error Attach(val any, sessionOpts *SessionOptions, opts ...OptFunc) (*Session, error) AttachWithContext(ctx context.Context, val any, opts *SessionOptions) (*Session, error) InjectLibraryFile(target any, path, entrypoint, data string) (uint, error) InjectLibraryBlob(target any, byteData []byte, entrypoint, data string) (uint, error) OpenChannel(address string) (*IOStream, error) OpenService(address string) (*Service, error) Clean() On(sigName string, fn any) }
type DeviceManager ¶
type DeviceManager struct {
// contains filtered or unexported fields
}
DeviceManager is the main structure which holds on devices available to Frida Single instance of the DeviceManager is created when you call frida.Attach() or frida.LocalDevice().
func NewDeviceManager ¶
func NewDeviceManager() *DeviceManager
NewDeviceManager returns new frida device manager.
func (*DeviceManager) AddRemoteDevice ¶
func (d *DeviceManager) AddRemoteDevice(address string, remoteOpts *RemoteDeviceOptions) (DeviceInt, error)
AddRemoteDevice add a remote device from the provided address with remoteOpts populated
func (*DeviceManager) Clean ¶
func (d *DeviceManager) Clean()
Clean will clean the resources held by the manager.
func (*DeviceManager) Close ¶
func (d *DeviceManager) Close() error
Close method will close current manager.
func (*DeviceManager) DeviceByID ¶
func (d *DeviceManager) DeviceByID(id string) (DeviceInt, error)
DeviceByID will return device with id passed or an error if it can't find any. Note: the caller must call EnumerateDevices() to get devices that are of type usb
func (*DeviceManager) DeviceByType ¶
func (d *DeviceManager) DeviceByType(devType DeviceType) (DeviceInt, error)
DeviceByType will return device or an error by device type specified. Note: the caller must call EnumerateDevices() to get devices that are of type usb
func (*DeviceManager) EnumerateDevices ¶
func (d *DeviceManager) EnumerateDevices() ([]DeviceInt, error)
EnumerateDevices will return all connected devices.
func (*DeviceManager) FindDeviceByID ¶
func (d *DeviceManager) FindDeviceByID(id string) (DeviceInt, error)
FindDeviceByID will try to find the device by id specified Note: the caller must call EnumerateDevices() to get devices that are of type usb
func (*DeviceManager) FindDeviceByType ¶
func (d *DeviceManager) FindDeviceByType(devType DeviceType) (DeviceInt, error)
FindDeviceByType will try to find the device by device type specified Note: the caller must call EnumerateDevices() to get devices that are of type usb
func (*DeviceManager) LocalDevice ¶
func (d *DeviceManager) LocalDevice() (DeviceInt, error)
LocalDevice returns the device with type DeviceTypeLocal.
func (*DeviceManager) On ¶
func (d *DeviceManager) On(sigName string, fn any)
On connects manager to specific signals. Once sigName is triggered, fn callback will be called with parameters populated.
Signals available are:
- "added" with callback as func(device *frida.Device) {}
- "removed" with callback as func(device *frida.Device) {}
- "changed" with callback as func() {}
func (*DeviceManager) RemoteDevice ¶
func (d *DeviceManager) RemoteDevice() (DeviceInt, error)
RemoteDevice returns the device with type DeviceTypeRemote.
func (*DeviceManager) RemoveRemoteDevice ¶
func (d *DeviceManager) RemoveRemoteDevice(address string) error
RemoveRemoteDevice removes remote device available at address
func (*DeviceManager) USBDevice ¶
func (d *DeviceManager) USBDevice() (DeviceInt, error)
USBDevice returns the device with type DeviceTypeUsb.
type DeviceManagerInt ¶ added in v0.7.1
type DeviceManagerInt interface { Close() error EnumerateDevices() ([]DeviceInt, error) LocalDevice() (DeviceInt, error) USBDevice() (DeviceInt, error) RemoteDevice() (DeviceInt, error) DeviceByID(id string) (DeviceInt, error) DeviceByType(devType DeviceType) (DeviceInt, error) FindDeviceByID(id string) (DeviceInt, error) FindDeviceByType(devType DeviceType) (DeviceInt, error) AddRemoteDevice(address string, remoteOpts *RemoteDeviceOptions) (DeviceInt, error) RemoveRemoteDevice(address string) error Clean() On(sigName string, fn any) // contains filtered or unexported methods }
DeviceManagerInt is the device DeviceManagerInt interface
type DeviceType ¶
type DeviceType int
const ( DeviceTypeLocal DeviceType = iota DeviceTypeRemote DeviceTypeUsb )
func (DeviceType) String ¶
func (d DeviceType) String() string
type EParams ¶
type EParams struct { Address string Port uint16 Certificate string Origin string Token string AuthenticationCallback AuthenticationFn AssetRoot string }
EParams represent config needed to setup endpoint parameters that are used to setup Portal. Types of authentication includes:
- no authentication (not providing Token nor AuthenticationCallback)
- static authentication (providing token)
- authentication using callback (providing AuthenticationCallback)
If the Token and AuthenticationCallback are passed, static authentication will be used (token based)
type EndpointParameters ¶
type EndpointParameters struct {
// contains filtered or unexported fields
}
EndpointParameters represent internal FridaEndpointParameters
func NewEndpointParameters ¶
func NewEndpointParameters(params *EParams) (*EndpointParameters, error)
NewEndpointParameters returns *EndpointParameters needed to setup Portal by using provided EParams object.
func (*EndpointParameters) Address ¶
func (e *EndpointParameters) Address() string
Address returns the address of the endpoint parameters.
func (*EndpointParameters) AssetRoot ¶
func (e *EndpointParameters) AssetRoot() string
AssetRoot returns the asset root directory.
func (*EndpointParameters) Certificate ¶
func (e *EndpointParameters) Certificate() *Certificate
Certificate returns the certificate of the endpoint parameters.
func (*EndpointParameters) Clean ¶
func (e *EndpointParameters) Clean()
Clean will clean the resources held by the endpoint parameters.
func (*EndpointParameters) Origin ¶
func (e *EndpointParameters) Origin() string
Origin returns the origin of the endpoint parameters.
func (*EndpointParameters) Port ¶
func (e *EndpointParameters) Port() uint16
Port returns the port of the endpoint parameters.
func (*EndpointParameters) SetAssetRoot ¶
func (e *EndpointParameters) SetAssetRoot(assetPath string)
SetAssetRoot sets asset root directory for the portal.
type FileMonitor ¶
type FileMonitor struct {
// contains filtered or unexported fields
}
FileMonitor type is the type responsible for monitoring file changes
func NewFileMonitor ¶
func NewFileMonitor(path string) *FileMonitor
NewFileMonitor creates new FileMonito with the file path provided.
func (*FileMonitor) Clean ¶
func (mon *FileMonitor) Clean()
Clean will clean the resources held by the file monitor.
func (*FileMonitor) Disable ¶
func (mon *FileMonitor) Disable() error
Disable disables file monitoring.
func (*FileMonitor) On ¶
func (mon *FileMonitor) On(sigName string, fn any)
On connects file monitor to specific signals. Once sigName is triggered, fn callback will be called with parameters populated.
Signals available are:
- "change" with callback as func(changedFile, otherFile, changeType string) {}
func (*FileMonitor) Path ¶
func (mon *FileMonitor) Path() string
Path returns the path of the monitored file.
type IOStream ¶
type IOStream struct {
// contains filtered or unexported fields
}
IOStream type represents struct used to interact with the device using channels.
func NewIOStream ¶
NewIOStream creates new IOStream.
func (*IOStream) Clean ¶
func (ios *IOStream) Clean()
Clean will clean resources held by the iostream.
func (*IOStream) ReadAll ¶
ReadAll tries to read all the bytes provided with the count from the stream.
type LevelType ¶ added in v0.4.0
type LevelType string
LevelType represents possible levels when Message.Type == MessageTypeLog
type Message ¶ added in v0.4.0
type Message struct { Type MessageType `json:"type"` Level LevelType `json:"level,omitempty"` // populated when type==MessageTypeLog Description string `json:"description,omitempty"` // populated when type==MessageTypeError Stack string `json:"stack,omitempty"` // populated when type==MessageTypeError Filename string `json:"fileName,omitempty"` // populated when type==MessageTypeError LineNumber int `json:"lineNumber,omitempty"` // populated when type==MessageTypeError ColumnNumber int `json:"columnNumber,omitempty"` // populated when type==MessageTypeError Payload any `json:"payload,omitempty"` IsPayloadMap bool }
Message represents the data returned inside the message parameter in on_message script callback
func ScriptMessageToMessage ¶ added in v0.4.0
ScriptMessageToMessage returns the parsed Message from the message string received in script.On("message", func(msg string, data []byte) {}) callback.
type MessageType ¶ added in v0.4.0
type MessageType string
MessageType represents all possible message types populated in the first argument of the on_message callback.
const ( MessageTypeLog MessageType = "log" MessageTypeError MessageType = "error" MessageTypeSend MessageType = "send" )
type OptFunc ¶ added in v0.11.0
type OptFunc func(o *options)
func WithCancel ¶ added in v0.11.0
func WithCancel(cancel *Cancellable) OptFunc
WithCancel is inteded to be used a varadic option. Provides the ability to to pass GCancellable to frida functions.
Note: it is advisable to use the `FuncCtx` version of functions rather than handling this yourself.
type PeerOptions ¶
type PeerOptions struct {
// contains filtered or unexported fields
}
PeerOptions type represents struct used to setup p2p connection.
func NewPeerOptions ¶
func NewPeerOptions() *PeerOptions
NewPeerOptions creates new empty peer options.
func (*PeerOptions) AddRelay ¶
func (p *PeerOptions) AddRelay(relay *Relay)
AddRelay adds new relay to use for peer options.
func (*PeerOptions) Clean ¶
func (p *PeerOptions) Clean()
Clean will clean the resources held by the peer options.
func (*PeerOptions) ClearRelays ¶
func (p *PeerOptions) ClearRelays()
ClearRelays removes previously added relays.
func (*PeerOptions) SetStunServer ¶
func (p *PeerOptions) SetStunServer(stunServer string)
SetStunServer sets the stun server for peer options.
func (*PeerOptions) StunServer ¶
func (p *PeerOptions) StunServer() string
StunServer returns the stun server for peer options.
type Portal ¶
type Portal struct {
// contains filtered or unexported fields
}
Portal represents portal to collect exposed gadgets and sessions.
func NewPortal ¶
func NewPortal(clusterParams, controlParams *EndpointParameters) *Portal
NewPortal creates new Portal from the EndpointParameters provided.
func (*Portal) ClusterParams ¶
func (p *Portal) ClusterParams() *EndpointParameters
ClusterParams returns the cluster parameters for the portal.
func (*Portal) ControlParams ¶
func (p *Portal) ControlParams() *EndpointParameters
ControlParams returns the control parameters for the portal.
func (*Portal) EnumerateTags ¶
EnumerateTags returns all the tags that connection with connectionID is tagged with.
func (*Portal) Narrowcast ¶
Narrowcast sends the message to all controllers tagged with the tag.
func (*Portal) On ¶
On connects portal to specific signals. Once sigName is triggered, fn callback will be called with parameters populated.
Signals available are:
- "node_connected" with callback as func(connId uint, addr *frida.Address) {}
- "node_joined" with callback as func(connId uint, app *frida.Application) {}
- "node_left" with callback as func(connId uint, app *frida.Application) {}
- "node_disconnected" with callback as func(connId uint, addr *frida.Address) {}
- "controller_connected" with callback as func(connId uint, addr *frida.Address) {}
- "controller_disconnected" with callback as func(connId uint, addr *frida.Address) {}
- "authenticated" with callback as func(connId uint, sessionInfo string) {}
- "subscribe" with callback as func(connId uint) {}
- "message" with callback as func(connId uint, jsonData string, data []byte) {}
func (*Portal) TagConnection ¶
TagConnection tags the connection with connectionID with the tag provided.
func (*Portal) UntagConnection ¶
UntagConnection untags the connection with connectionID with the tag provided.
type PortalMembership ¶
type PortalMembership struct {
// contains filtered or unexported fields
}
PortalMembership type is used to join portal with session.
func (*PortalMembership) Clean ¶
func (p *PortalMembership) Clean()
Clean will clean the resources held by the portal membership.
func (*PortalMembership) ID ¶
func (p *PortalMembership) ID() uint
ID returns the ID of the membership
func (*PortalMembership) Terminate ¶
func (p *PortalMembership) Terminate() error
Terminate terminates the session membership
type PortalOptions ¶
type PortalOptions struct {
// contains filtered or unexported fields
}
PortalOptions type represents struct used to connect to the portal.
func NewPortalOptions ¶
func NewPortalOptions() *PortalOptions
NewPortalOptions creates new portal options.
func (*PortalOptions) ACL ¶
func (p *PortalOptions) ACL() []string
ACL returns the acls for the portal.
func (*PortalOptions) Certificate ¶
func (p *PortalOptions) Certificate() *Certificate
Certificate returns the tls certificate for portal options.
func (*PortalOptions) Clean ¶
func (p *PortalOptions) Clean()
Clean will clean the resources held by the portal options.
func (*PortalOptions) SetACL ¶
func (p *PortalOptions) SetACL(acls []string)
SetACL sets the acls from the string slice provided.
func (*PortalOptions) SetCertificate ¶
func (p *PortalOptions) SetCertificate(certPath string) error
SetCertificate sets the certificate for the portal.
func (*PortalOptions) SetToken ¶
func (p *PortalOptions) SetToken(token string)
SetToken sets the token for the authentication.
func (*PortalOptions) Token ¶
func (p *PortalOptions) Token() string
Token returns the token for the portal.
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process represents process on the device.
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
Relay type represents relay for setting up p2p.
type RemoteDeviceOptions ¶
type RemoteDeviceOptions struct {
// contains filtered or unexported fields
}
RemoteDeviceOptions type is used to configure the remote device.
func NewRemoteDeviceOptions ¶
func NewRemoteDeviceOptions() *RemoteDeviceOptions
NewRemoteDeviceOptions returns the new remote device options.
func (*RemoteDeviceOptions) Certificate ¶
func (r *RemoteDeviceOptions) Certificate() *Certificate
Certificate returns the certificate for the remote device options.
func (*RemoteDeviceOptions) Clean ¶
func (r *RemoteDeviceOptions) Clean()
Clean will clean the resources held by the remote device options.
func (*RemoteDeviceOptions) KeepAliveInterval ¶
func (r *RemoteDeviceOptions) KeepAliveInterval() int
KeepAliveInterval returns the keepalive interval for the remote device options.
func (*RemoteDeviceOptions) Origin ¶
func (r *RemoteDeviceOptions) Origin() string
Origin returns the origin for the remote device options.
func (*RemoteDeviceOptions) SetCertificate ¶
func (r *RemoteDeviceOptions) SetCertificate(certPath string) error
SetCertificate sets the certificate for the remote device.
func (*RemoteDeviceOptions) SetKeepAlive ¶
func (r *RemoteDeviceOptions) SetKeepAlive(interval int)
SetKeepAlive sets keepalive interval for the remote device options.
func (*RemoteDeviceOptions) SetOrigin ¶
func (r *RemoteDeviceOptions) SetOrigin(origin string)
SetOrigin sets the origin for the remote device options.
func (*RemoteDeviceOptions) SetToken ¶
func (r *RemoteDeviceOptions) SetToken(token string)
SetToken sets the token for the remote device options.
func (*RemoteDeviceOptions) Token ¶
func (r *RemoteDeviceOptions) Token() string
Token returns the token for the remote device options.
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
Script represents loaded string in the memory.
func (*Script) DisableDebugger ¶
DisableDebugger function disables debugging
func (*Script) EnableDebugger ¶
EnableDebugger function enables debugging on the port specified
func (*Script) Eternalize ¶
Eternalize function will keep the script loaded even after deataching from the process
func (*Script) ExportsCall ¶
ExportsCall will try to call fn from the rpc.exports with args provided
func (*Script) ExportsCallWithContext ¶ added in v0.6.0
ExportsCallWithContext will try to call fn from the rpc.exports with args provided using context provided.
func (*Script) IsDestroyed ¶
IsDestroyed function returns whether the script previously loaded is destroyed (could be caused by unload)
func (*Script) On ¶
On connects script to specific signals. Once sigName is triggered, fn callback will be called with parameters populated.
Signals available are:
- "destroyed" with callback as func() {}
- "message" with callback as func(message string, data []byte) {}
type ScriptOptions ¶
type ScriptOptions struct {
// contains filtered or unexported fields
}
ScriptOptions type represents options passed to the session to create script.
func NewScriptOptions ¶
func NewScriptOptions(name string) *ScriptOptions
NewScriptOptions creates new script options with the script name provided.
func (*ScriptOptions) Clean ¶
func (s *ScriptOptions) Clean()
Clean will clean the resources held by the script options.
func (*ScriptOptions) Name ¶
func (s *ScriptOptions) Name() string
Name returns the name for the script.
func (*ScriptOptions) SetName ¶
func (s *ScriptOptions) SetName(name string)
SetName sets the name of the script.
func (*ScriptOptions) SetRuntime ¶
func (s *ScriptOptions) SetRuntime(rt ScriptRuntime)
SetRuntime sets the runtime for the script.
func (*ScriptOptions) SetSnapshot ¶
func (s *ScriptOptions) SetSnapshot(value []byte)
SetSnapshot sets the snapshot for the script.
func (*ScriptOptions) SetSnapshotTransport ¶
func (s *ScriptOptions) SetSnapshotTransport(tr SnapshotTransport)
SetSnapshotTransport sets the transport for the snapshot
func (*ScriptOptions) Snapshot ¶
func (s *ScriptOptions) Snapshot() []byte
Snapshot returns the snapshot for the script.
func (*ScriptOptions) SnapshotTransport ¶
func (s *ScriptOptions) SnapshotTransport() SnapshotTransport
SnapshotTransport returns the transport for the script.
type ScriptRuntime ¶
type ScriptRuntime int
const ( ScriptRuntimeDefault ScriptRuntime = iota ScriptRuntimeQJS ScriptRuntimeV8 )
func (ScriptRuntime) String ¶
func (s ScriptRuntime) String() string
type Service ¶ added in v0.8.0
type Service struct {
// contains filtered or unexported fields
}
Service represents Service from frida-core
type ServiceInt ¶ added in v0.8.0
type ServiceInt interface { }
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session type represents the session with the device.
func (*Session) Clean ¶
func (s *Session) Clean()
Clean will clean the resources held by the session.
func (*Session) CompileScript ¶
func (s *Session) CompileScript(script string, opts *ScriptOptions) ([]byte, error)
CompileScript compiles the script from the script as string provided.
func (*Session) CreateScript ¶
CreateScript creates new string from the string provided.
func (*Session) CreateScriptBytes ¶
func (s *Session) CreateScriptBytes(script []byte, opts *ScriptOptions) (*Script, error)
CreateScriptBytes is a wrapper around CreateScript(script string)
func (*Session) CreateScriptWithOptions ¶
func (s *Session) CreateScriptWithOptions(script string, opts *ScriptOptions) (*Script, error)
CreateScriptWithOptions creates the script with the script options provided. Useful in cases where you previously created the snapshot.
func (*Session) CreateScriptWithSnapshot ¶
func (*Session) DetachWithContext ¶ added in v0.12.0
DetachWithContext runs Detach but with context. This function will properly handle cancelling the frida operation. It is advised to use this rather than handling Cancellable yourself.
func (*Session) DisableChildGating ¶
DisableChildGating disables child gating on the session.
func (*Session) EnableChildGating ¶
EnableChildGating enables child gating on the session.
func (*Session) IsDetached ¶
IsDetached returns bool whether session is detached or not.
func (*Session) JoinPortal ¶
func (s *Session) JoinPortal(address string, opts *PortalOptions) (*PortalMembership, error)
JoinPortal joins portal at the address with portal options provided.
func (*Session) On ¶
On connects session to specific signals. Once sigName is triggered, fn callback will be called with parameters populated.
Signals available are:
- "detached" with callback as func(reason frida.SessionDetachReason, crash *frida.Crash) {}
func (*Session) SetupPeerConnection ¶
func (s *Session) SetupPeerConnection(opts *PeerOptions) error
SetupPeerConnection sets up peer (p2p) connection with peer options provided.
func (*Session) SnapshotScript ¶
func (s *Session) SnapshotScript(embedScript string, snapshotOpts *SnapshotOptions) ([]byte, error)
SnapshotScript creates snapshot from the script.
type SessionDetachReason ¶
type SessionDetachReason int
const ( SessionDetachReasonApplicationRequested SessionDetachReason = iota + 1 SessionDetachReasonProcessReplaced SessionDetachReasonProcessTerminated SessionDetachReasonServerTerminated SessionDetachReasonDeviceLost )
func (SessionDetachReason) String ¶
func (reason SessionDetachReason) String() string
type SessionOptions ¶
type SessionOptions struct {
// contains filtered or unexported fields
}
SessionOptions type is used to configure session
func NewSessionOptions ¶
func NewSessionOptions(realm Realm, persistTimeout uint) *SessionOptions
NewSessionOptions create new SessionOptions with the realm and timeout to persist provided
func (*SessionOptions) Clean ¶
func (s *SessionOptions) Clean()
Clean will clean the resources held by the session options.
func (*SessionOptions) PersistTimeout ¶
func (s *SessionOptions) PersistTimeout() int
PersistTimeout returns the persist timeout of the script.s
func (*SessionOptions) Realm ¶
func (s *SessionOptions) Realm() Realm
Realm returns the realm of the options
type SnapshotOptions ¶
type SnapshotOptions struct {
// contains filtered or unexported fields
}
func NewSnapshotOptions ¶
func NewSnapshotOptions(warmupScript string, rt ScriptRuntime) *SnapshotOptions
NewSnapshotOptions creates new snapshot options with warmup script and script runtime provided.
func (*SnapshotOptions) Clean ¶
func (s *SnapshotOptions) Clean()
Clean will clean the resources held by the snapshot options.
func (*SnapshotOptions) Runtime ¶
func (s *SnapshotOptions) Runtime() ScriptRuntime
Runtime returns the runtime used to create the script options.
func (*SnapshotOptions) WarmupScript ¶
func (s *SnapshotOptions) WarmupScript() string
WarmupScript returns the warmup script used to create the script options.
type SnapshotTransport ¶
type SnapshotTransport int
const ( SnapshotTransportInline SnapshotTransport = iota )
type Spawn ¶
type Spawn struct {
// contains filtered or unexported fields
}
Spawn represents spawn of the device.
func (*Spawn) Identifier ¶
Identifier returns identifier of the spawn.
type SpawnOptions ¶
type SpawnOptions struct {
// contains filtered or unexported fields
}
SpawnOptions struct is responsible for setting/getting argv, envp etc
func NewSpawnOptions ¶
func NewSpawnOptions() *SpawnOptions
NewSpawnOptions create new instance of SpawnOptions.
func (*SpawnOptions) Aux ¶
func (s *SpawnOptions) Aux() map[string]any
Aux returns aux of the spawn.
func (*SpawnOptions) Clean ¶
func (s *SpawnOptions) Clean()
Clean will clean the resources held by the spawn options.
func (*SpawnOptions) Cwd ¶
func (s *SpawnOptions) Cwd() string
Cwd returns current working directory (CWD) of the spawn.
func (*SpawnOptions) SetArgv ¶
func (s *SpawnOptions) SetArgv(argv []string)
SetArgv set spawns argv with the argv provided.
func (*SpawnOptions) SetCwd ¶
func (s *SpawnOptions) SetCwd(cwd string)
SetCwd sets current working directory (CWD) for the spawn.
func (*SpawnOptions) SetEnv ¶
func (s *SpawnOptions) SetEnv(env map[string]string)
SetEnv set spawns env with the env provided.
func (*SpawnOptions) SetEnvp ¶
func (s *SpawnOptions) SetEnvp(envp map[string]string)
SetEnvp set spawns envp with the envp provided.
func (*SpawnOptions) SetStdio ¶
func (s *SpawnOptions) SetStdio(stdio Stdio)
SetStdio sets standard input/output of the spawn with the stdio provided.
Source Files ¶
- application.go
- bus.go
- certificate.go
- child.go
- cleanups.go
- closure.go
- comp.go
- crash.go
- device.go
- endpoint_parameters.go
- errors.go
- file_monitor.go
- frida.go
- go_to_variants.go
- iostream.go
- manager.go
- misc.go
- peer_options.go
- portal_membership.go
- portal_options.go
- portal_service.go
- process.go
- relay.go
- remote_device_options.go
- script.go
- script_options.go
- service.go
- session.go
- session_options.go
- snapshot_options.go
- spawn.go
- spawn_options.go
- types.go
- types_converter.go
- unmarshaller.go
- variants_to_go.go