slamhound

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hound

type Hound struct {
	// contains filtered or unexported fields
}

Hound is a struct that holds the relevant information, such as the rules and config for the scanner

func New

func New(config *cfg.Config) (*Hound, error)

New returns an initalised Hound struct

func (*Hound) Compile

func (h *Hound) Compile(rulesDir string) error

Compile compiles the rules based on configuration and readies the scanner

func (*Hound) CompileSingularRule

func (h *Hound) CompileSingularRule(rule string) error

CompileSingularRule compiles a single rule into the scanner

func (*Hound) ScanArchive

func (h *Hound) ScanArchive(filename string) ([]Result, error)

ScanArchive extracts from the target archive and scans using the the compiled rules

func (*Hound) ScanDirectory

func (h *Hound) ScanDirectory(directory string) ([]Result, error)

ScanDirectory uses the file walk scan to scan a directory

type Result

type Result struct {
	Path    string           `json:"path"`
	Matches []yara.MatchRule `json:"matches"`
	Err     error            `json:"error,omitempty"`
}

Result is a struct containing the results of scanning a file

func (*Result) FormatMatches

func (r *Result) FormatMatches() []string

FormatMatches returns a slice of strings corresponding to the matched namespaced rules

func (*Result) LogResult

func (r *Result) LogResult()

LogResult prints the result, showing matches for a particular filepath

func (*Result) MarshalJSON

func (r *Result) MarshalJSON() ([]byte, error)

MarshalJSON marshals a Result into JSON

Jump to

Keyboard shortcuts

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