grammar

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2017 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	StringType = iota
	StringString
	StringRegex
	StringHex
)

Types of string variables

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	Name     string       `json:"file_name"`
	Lex      *lexic.Lexer `json:"-"`
	Item     lexic.Item   `json:"-"`
	LastItem lexic.Item   `json:"-"`

	Imports []string  `json:"imports"`
	Rules   []RuleDef `json:"rules"`
	// contains filtered or unexported fields
}

Parser represents the Yara rules

func New

func New(name string) *Parser

New returns a new parser

func (*Parser) Parse

func (p *Parser) Parse(text string)

Parse starts parsing the input

func (*Parser) SetLogLevel

func (p *Parser) SetLogLevel(level string)

SetLogLevel sets the log level

func (*Parser) String

func (p *Parser) String() string

String returns a string representation of the Parser

type RuleDef

type RuleDef struct {
	Name      string            `json:"name"`
	Global    bool              `json:"global"`
	Private   bool              `json:"private"`
	Tags      []string          `json:"tags"`
	Meta      map[string]string `json:"meta"`
	Strings   []StringDef       `json:"strings"`
	Condition string            `json:"condition"`
}

RuleDef defines a yara rule

type StringDef

type StringDef struct {
	Name      string   `json:"name"`
	Value     string   `json:"value"`
	Modifiers []string `json:"modifers"`
	Typ       int      `json:"type"`
}

StringDef defines a string variable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL