Documentation
¶
Index ¶
- Variables
- func CheckForR2Pipe() bool
- type Client
- func (c *Client) AnalyzeAll() error
- func (c *Client) AnalyzeFunction(name string, addr uint64) error
- func (c *Client) AnalyzeFunctionRecursive(name string, addr uint64) error
- func (c *Client) GetActiveOpenFile() (*OpenFile, error)
- func (c *Client) GetClipboard() (*Clipboard, error)
- func (c *Client) GetCurrentAddress() (uint64, error)
- func (c *Client) GetCurrentFunction() (*Function, error)
- func (c *Client) GetFlags() ([]*Flag, error)
- func (c *Client) GetFunctionAtOffset(offset uint64) (*Function, error)
- func (c *Client) GetSymbolOffset(sym string) (uint64, error)
- func (c *Client) ListOpenFiles() ([]*OpenFile, error)
- func (c *Client) NewFlag(name string, offset uint64) error
- func (c *Client) NewFlagWithLength(name string, offset, length uint64) error
- func (c *Client) Run(cmd string) ([]byte, error)
- func (c *Client) SeekTo(addr uint64) error
- func (c *Client) ZignatureFunction(symbol string) (*Zignature, error)
- func (c *Client) ZignatureFunctionOffset(offset uint64) (*Zignature, error)
- type Clipboard
- type CommandHandler
- type Flag
- type Function
- type Graph
- type Op
- type OpenFile
- type XRef
- type Zignature
Constants ¶
This section is empty.
Variables ¶
var ( // ErrR2PipeNotAvailable indicates that R2's pipes are not available. ErrR2PipeNotAvailable = errors.New("R2PIPEs are not available") // ErrPipeOutNotAvailable indicates that R2's out pipe is not available. ErrPipeOutNotAvailable = errors.New("could not connect to Pipe out FD") // ErrPipeInNotAvailable indicates that R2's in pipe is not available. ErrPipeInNotAvailable = errors.New("could not connect to Pipe in FD") )
var ( // ErrNoActiveFile is returned if no active file is found. ErrNoActiveFile = errors.New("no active file") )
Functions ¶
func CheckForR2Pipe ¶
func CheckForR2Pipe() bool
CheckForR2Pipe returns true if the Environment variables R2PIPE_IN and R2PIPE_OUT has been set. This indicates that the process has been invoked from within r2 via "#!pipe".
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for interacting with radare2.
func New ¶ added in v0.2.0
New opens the given file with Radare2 and returns a Client handler to the instance.
func OpenPipe ¶
OpenPipe connects to Radare2 via the pipe interface and returns a Client. This should be used for applications called from with in Radare2 using the "#!pipe" command.
func (*Client) AnalyzeAll ¶ added in v0.2.0
AnalyzeAll performs the "aaa" command.
func (*Client) AnalyzeFunction ¶
AnalyzeFunction analyzing the function starting at the address addr.
func (*Client) AnalyzeFunctionRecursive ¶ added in v0.2.0
AnalyzeFunctionRecursive analyzing the function recursivly starting at the address addr.
func (*Client) GetActiveOpenFile ¶
GetActiveOpenFile returns the current active file in radare.
func (*Client) GetClipboard ¶ added in v0.3.0
GetClipboard returns the value in radare's clipboard.
func (*Client) GetCurrentAddress ¶
GetCurrentAddress returns the current address.
func (*Client) GetCurrentFunction ¶
GetCurrentFunction returns information about the current function.
func (*Client) GetFunctionAtOffset ¶ added in v0.2.0
GetFunctionAtOffset returns function information about a function located at the given offset.
func (*Client) GetSymbolOffset ¶ added in v0.2.0
GetSymbolOffset returns the offset of a symbol.
func (*Client) ListOpenFiles ¶
ListOpenFiles returns a list of open files.
func (*Client) NewFlagWithLength ¶
NewFlagWithLength creates a flag with the name at the offset with the length.
func (*Client) ZignatureFunction ¶ added in v0.2.0
ZignatureFunction creates a Zignature for a function at the given symbol.
type Clipboard ¶ added in v0.3.0
type Clipboard struct {
// Address is the address the bytes were yanked from.
Address int64 `json:"addr"`
// Bytes are the bytes yanked.
Bytes string `json:"bytes"`
}
Clipboard is a representation of radare's clipboard.
type CommandHandler ¶
CommandHandler can send commands to radare and return the output.
type Flag ¶ added in v0.2.0
type Flag struct {
Name string `json:"name"`
RealName string `json:"realname"`
Size uint64 `json:"size"`
Offset uint64 `json:"offset"`
}
Flag is a representation of an radare2 flag.
type Function ¶
type Function struct {
Name string `json:"name"`
Size uint64 `json:"size"`
Addr uint64 `json:"addr"`
Ops []*Op `json:"ops"`
}
Function holds information about a radare function.
type Graph ¶ added in v0.2.0
type Graph struct {
CC int `json:"cc"`
Nbbs int `json:"nbbs"`
Edges int `json:"edges"`
Ebbs int `json:"ebbs"`
BBSum int `json:"bbsum"`
}
Graph is a graph summary of a function.
type Op ¶
type Op struct {
Offset uint64 `json:"offset"`
Ptr uint64 `json:"ptr"`
ESIL string `json:"esil"`
RefPtr bool `json:"refptr"`
FcnAddr uint64 `json:"fcn_addr"`
FcnLast uint64 `json:"fcn_last"`
Size uint64 `json:"size"`
OpCode string `json:"opcode"`
Disasm string `json:"disasm"`
Bytes string `json:"bytes"`
Family string `json:"family"`
Type string `json:"type"`
TypeNum uint64 `json:"type_num"`
Type2Num uint64 `json:"type2_num"`
Flags []string `json:"flags"`
Jump uint64 `json:"jump"`
Fail uint64 `json:"fail"`
XRefs []*XRef `json:"xrefs"`
}
Op holds information about an operation.
type OpenFile ¶
type OpenFile struct {
Active bool `json:"raised"`
FileDescriptor int `json:"fd"`
Path string `json:"uri"`
From int `json:"from"`
Writable bool `json:"writable"`
Size uint64 `json:"size"`
}
OpenFile holds information about an open file.
type Zignature ¶ added in v0.2.0
type Zignature struct {
Name string `json:"name"`
Bytes string `json:"bytes"`
Mask string `json:"mask"`
Graph Graph `json:"graph"`
Addr uint64 `json:"addr"`
RealName string `json:"realname"`
Refs []string `json:"refs"`
XRefs []string `json:"xrefs"`
Vars []string `json:"vars"`
Hash map[string]string `json:"hash"`
}
Zignature is a signature type used by Radare2