Documentation ¶
Overview ¶
Implements a binary parsing system.
This implementation is roughly based on the one in Rekall.
Implements a binary parsing system.
Index ¶
- func AddModel(profile *Profile)
- func Associative(scope vfilter.Scope, a vfilter.Any, field string) vfilter.Any
- func Debug(arg interface{})
- func EndOf(obj interface{}) int64
- func EvalLambdaAsInt64(expression *vfilter.Lambda, scope vfilter.Scope) int64
- func EvalLambdaAsString(expression *vfilter.Lambda, scope vfilter.Scope) string
- func IsNil(v interface{}) bool
- func JsonDump(v interface{})
- func MakeScope() vfilter.Scope
- func ScopeDebug(scope vfilter.Scope, fmt string, args ...interface{})
- func SizeOf(obj interface{}) int
- func StartOf(obj interface{}) int64
- func StringIndent(v interface{}) string
- type ArrayAssociative
- type ArrayIterator
- type ArrayObject
- type ArrayParser
- type ArrayParserOptions
- type BitField
- type Ender
- type EnumerationParser
- type EnumerationParserOptions
- type EpochTimestamp
- type EpochTimestampOptions
- type FatTimestamp
- type FieldDefinition
- type Flags
- type FlagsOptions
- type IntParser
- func (self *IntParser) DebugString(scope vfilter.Scope, offset int64, reader io.ReaderAt) string
- func (self *IntParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
- func (self *IntParser) Parse(scope vfilter.Scope, reader io.ReaderAt, offset int64) interface{}
- func (self *IntParser) Size() int
- type NullParser
- type ParseAtOffset
- type Parser
- type PointerParser
- type PointerParserOptions
- type Profile
- func (self *Profile) AddParser(type_name string, parser Parser)
- func (self *Profile) GetParser(name string, options *ordereddict.Dict) (Parser, error)
- func (self *Profile) ObjectSize(scope vfilter.Scope, name string, reader io.ReaderAt, offset int64) int
- func (self *Profile) Parse(scope vfilter.Scope, type_name string, reader io.ReaderAt, offset int64) (interface{}, error)
- func (self *Profile) ParseStructDefinitions(definitions string) (err error)
- type ProfileParser
- type ProfileParserOptions
- type Sizer
- type Starter
- type StringParser
- type StringParserOptions
- type StructAssociative
- type StructDefinition
- type StructObject
- type StructParser
- func (self *StructParser) AddField(field_name string, parser *ParseAtOffset)
- func (self *StructParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
- func (self *StructParser) Parse(scope vfilter.Scope, reader io.ReaderAt, offset int64) interface{}
- func (self *StructParser) Size() int
- type Union
- type ValueParser
- type WinFileTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvalLambdaAsInt64 ¶
func EvalLambdaAsString ¶
func IsNil ¶
func IsNil(v interface{}) bool
We need to do this stupid check because Go does not allow comparison to nil with interfaces.
func ScopeDebug ¶
func StringIndent ¶
func StringIndent(v interface{}) string
Types ¶
type ArrayAssociative ¶
type ArrayAssociative struct{}
func (ArrayAssociative) Applicable ¶
func (ArrayAssociative) Associative ¶
func (ArrayAssociative) GetMembers ¶
type ArrayIterator ¶
type ArrayIterator struct{}
Arrays also participate in the iterator protocol
func (ArrayIterator) Applicable ¶
func (self ArrayIterator) Applicable(a vfilter.Any) bool
type ArrayObject ¶
type ArrayObject struct {
// contains filtered or unexported fields
}
func (*ArrayObject) Contents ¶
func (self *ArrayObject) Contents() []interface{}
func (*ArrayObject) End ¶
func (self *ArrayObject) End() int64
func (*ArrayObject) MarshalJSON ¶
func (self *ArrayObject) MarshalJSON() ([]byte, error)
func (*ArrayObject) SetParent ¶
func (self *ArrayObject) SetParent(parent *StructObject)
func (*ArrayObject) Size ¶
func (self *ArrayObject) Size() int
func (*ArrayObject) Start ¶
func (self *ArrayObject) Start() int64
type ArrayParser ¶
type ArrayParser struct {
// contains filtered or unexported fields
}
func (*ArrayParser) New ¶
func (self *ArrayParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type ArrayParserOptions ¶
type BitField ¶
type BitField struct { StartBit int64 `json:"start_bit"` EndBit int64 `json:"end_bit"` Type string `json:"type"` // contains filtered or unexported fields }
type EnumerationParser ¶
type EnumerationParser struct {
// contains filtered or unexported fields
}
func (*EnumerationParser) New ¶
func (self *EnumerationParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type EnumerationParserOptions ¶
type EnumerationParserOptions struct { Type string TypeOptions *ordereddict.Dict Choices map[int64]string }
type EpochTimestamp ¶
type EpochTimestamp struct {
// contains filtered or unexported fields
}
func (*EpochTimestamp) New ¶
func (self *EpochTimestamp) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type EpochTimestampOptions ¶
type EpochTimestampOptions struct { Type string TypeOptions *ordereddict.Dict Factor int64 }
type FatTimestamp ¶
type FatTimestamp struct {
// contains filtered or unexported fields
}
func (*FatTimestamp) New ¶
func (self *FatTimestamp) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type FieldDefinition ¶
type FieldDefinition struct { Name string // Offset within the struct Offset int64 // Alternatively offset may be given as an expression. OffsetExpression string // Name of the type of parser in this field. Type string // Options to the type Options *ordereddict.Dict }
func (*FieldDefinition) UnmarshalJSON ¶
func (self *FieldDefinition) UnmarshalJSON(p []byte) error
type FlagsOptions ¶
type FlagsOptions struct { Type string TypeOptions *ordereddict.Dict Bitmap map[int64]string Bits []int64 }
Accepts option bitmap: name (string) -> bit number
type IntParser ¶
type IntParser struct {
// contains filtered or unexported fields
}
Parse various sizes of ints.
func NewIntParser ¶
func (*IntParser) DebugString ¶
type NullParser ¶
type NullParser struct{}
A parser that always returns NULL
func (NullParser) New ¶
func (self NullParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type ParseAtOffset ¶
type ParseAtOffset struct {
// contains filtered or unexported fields
}
A parser that parses its delegate at a particular offset
func (*ParseAtOffset) New ¶
func (self *ParseAtOffset) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type Parser ¶
type Parser interface { Parse(scope vfilter.Scope, reader io.ReaderAt, offset int64) interface{} // Given options, this returns a new configured parser New(profile *Profile, options *ordereddict.Dict) (Parser, error) }
Parsers are objects which know how to parse a particular type. Parsers are instantiated once and reused many times.
type PointerParser ¶
type PointerParser struct {
// contains filtered or unexported fields
}
func (*PointerParser) New ¶
func (self *PointerParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type PointerParserOptions ¶
type PointerParserOptions struct { Type string TypeOptions *ordereddict.Dict }
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
func NewProfile ¶
func NewProfile() *Profile
func (*Profile) ObjectSize ¶
func (*Profile) Parse ¶
func (self *Profile) Parse(scope vfilter.Scope, type_name string, reader io.ReaderAt, offset int64) (interface{}, error)
For example: type_name = "Array" options = { "Target": "int"}
func (*Profile) ParseStructDefinitions ¶
Build the profile from definitions given in the vtypes language.
type ProfileParser ¶
type ProfileParser struct {
// contains filtered or unexported fields
}
func (*ProfileParser) New ¶
func (self *ProfileParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type ProfileParserOptions ¶
type ProfileParserOptions struct { Type string TypeOptions *ordereddict.Dict Offset *vfilter.Lambda }
type StringParser ¶
type StringParser struct {
// contains filtered or unexported fields
}
func (*StringParser) New ¶
func (self *StringParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type StringParserOptions ¶
type StructAssociative ¶
type StructAssociative struct{}
func (StructAssociative) Applicable ¶
func (StructAssociative) Associative ¶
func (StructAssociative) GetMembers ¶
type StructDefinition ¶
type StructDefinition struct { Name string Size int SizeExpression string Fields []*FieldDefinition }
func (*StructDefinition) UnmarshalJSON ¶
func (self *StructDefinition) UnmarshalJSON(p []byte) error
func (*StructDefinition) UnmarshalYAML ¶
func (self *StructDefinition) UnmarshalYAML(unmarshal func(v interface{}) error) error
type StructObject ¶
type StructObject struct {
// contains filtered or unexported fields
}
A Lazy object representing the struct
func (*StructObject) End ¶
func (self *StructObject) End() int64
func (*StructObject) Get ¶
func (self *StructObject) Get(field string) (interface{}, bool)
func (*StructObject) MarshalJSON ¶
func (self *StructObject) MarshalJSON() ([]byte, error)
func (*StructObject) Parent ¶
func (self *StructObject) Parent() vfilter.Any
func (*StructObject) Size ¶
func (self *StructObject) Size() int
Get the size of the struct - it can either be fixed, or derived using a lambda expression.
func (*StructObject) Start ¶
func (self *StructObject) Start() int64
type StructParser ¶
type StructParser struct {
// contains filtered or unexported fields
}
func NewStructParser ¶
func NewStructParser(type_name string, size int) *StructParser
func (*StructParser) AddField ¶
func (self *StructParser) AddField(field_name string, parser *ParseAtOffset)
func (*StructParser) New ¶
func (self *StructParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
StructParser does not take options
func (*StructParser) Size ¶
func (self *StructParser) Size() int
type Union ¶
type Union struct { Selector *vfilter.Lambda Choices map[string]Parser // contains filtered or unexported fields }
type ValueParser ¶
type ValueParser struct {
// contains filtered or unexported fields
}
A ValueParser can either represent a static value, or an expression.
func (*ValueParser) New ¶
func (self *ValueParser) New(profile *Profile, options *ordereddict.Dict) (Parser, error)
type WinFileTime ¶
type WinFileTime struct {
*EpochTimestamp
}
func (*WinFileTime) New ¶
func (self *WinFileTime) New(profile *Profile, options *ordereddict.Dict) (Parser, error)