runner

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: BSD-2-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsEmailDomainStopWord

func ContainsEmailDomainStopWord(s string) (bool, string)

func ContainsStopWord

func ContainsStopWord(s string) (bool, string)

func ContainsUrlDomainStopWord

func ContainsUrlDomainStopWord(s string) (bool, string)

Types

type Credential

type Credential struct {
	Username string
	Password string
}

type Decoder

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

Decoder decodes various types of data in place

func NewDecoder

func NewDecoder() *Decoder

NewDecoder creates a default decoder struct

type EncodedSegment

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

EncodedSegment represents a portion of text that is encoded in some way. `decode` supports recusive decoding and can result in "segment trees". There can be multiple segments in the original text, so each can be thought of as its own tree with the root being the original segment.

type FileItem added in v0.1.21

type FileItem struct {
	RealPath    string
	VirtualPath string
}

type Fragment

type Fragment struct {
	// Raw is the raw content of the fragment
	Raw string

	Bytes []byte

	// FilePath is the path to the file if applicable
	FilePath    string
	SymlinkFile string

	// CommitSHA is the SHA of the commit if applicable
	CommitSHA string
	// contains filtered or unexported fields
}

Fragment contains the data to be scanned

type Identifiers

type Identifiers struct {
	Rules    []*rules.Rule
	Keywords map[string]struct{}
}

func (*Identifiers) LoadRules

func (id *Identifiers) LoadRules() error

type Location

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

Location represents a location in a file

type Logging

type Logging struct {
	// Debug display debug level logging
	Debug bool
	// LogScanErrors log errors related to scanning
	LogScanErrors bool
	// Silence all logging
	Silence bool
	//Text file output
	TextFile string
}

Logging is log related options

type Options

type Options struct {
	// Logging is logging options
	Logging Logging
	// Chrome is Chrome related options
	Writer Writer
	// Parser is typically Parser options
	Parser Parser

	// Force use current path as Temp Path
	StoreLocalWorkspace bool

	// Default DB as Control Only (ignore other tables)
	DefaultDBAsControlOnly bool

	DateFilter *time.Time

	IndexedDateFilter *time.Time
}

Options are global github.com/helviojunior/intelparserintelparser options

func NewDefaultOptions

func NewDefaultOptions() *Options

NewDefaultOptions returns Options with some default values

type Parser

type Parser struct {
	// Path/file to be parsed
	Path string
	// Threads (not really) are the number of goroutines to use.
	// More soecifically, its the go-rod page pool well use.
	Threads int
	//Size of near text data
	NearTextSize int

	StoreNearText bool
}

Scan is scanning related options

type ParserDriver

type ParserDriver interface {
	ParseFile(runner *Runner, file FileItem) (*models.File, error)
	Close()
}

Parser is the interface file drivers will implement.

type ParserNotFoundError

type ParserNotFoundError struct {
	Err error
}

ChromeNotFoundError signals that chrome is not available

func (ParserNotFoundError) Error

func (e ParserNotFoundError) Error() string

type Runner

type Runner struct {
	Parser ParserDriver

	// Files to scan.
	Files chan FileItem

	Identifiers Identifiers

	// MaxDecodeDepths limits how many recursive decoding passes are allowed
	MaxDecodeDepth int

	// files larger than this will be skipped
	MaxTargetMegaBytes int
	// contains filtered or unexported fields
}

Runner is a runner that probes web targets using a driver

func NewRunner

func NewRunner(logger *slog.Logger, parser ParserDriver, opts Options, writers []writers.Writer) (*Runner, error)

New gets a new Runner ready for probing. It's up to the caller to call Close() on the runner

func (*Runner) AddSkipped

func (run *Runner) AddSkipped()

func (*Runner) Close

func (run *Runner) Close()

func (*Runner) Detect

func (run *Runner) Detect(fragment Fragment) []models.Finding

Detect scans the given fragment and returns a list of findings

func (*Runner) DetectBytes

func (run *Runner) DetectBytes(content []byte) []models.Finding

DetectBytes scans the given bytes and returns a list of findings

func (*Runner) DetectFile

func (run *Runner) DetectFile(file *models.File) error

func (*Runner) DetectReader

func (run *Runner) DetectReader(r io.Reader, bufSize int) ([]models.Finding, error)

DetectReader accepts an io.Reader and a buffer size for the reader in KB

func (*Runner) DetectString

func (run *Runner) DetectString(content string) []models.Finding

DetectString scans the given string and returns a list of findings

func (*Runner) ParsePositionalFile

func (run *Runner) ParsePositionalFile(file FileItem) error

func (*Runner) Run

func (run *Runner) Run() Status

Run executes the runner, processing targets as they arrive in the Targets channel

type Status

type Status struct {
	Parsed     int
	Error      int
	Url        int
	Email      int
	Credential int
	Skipped    int
	Spin       string
	Running    bool
	IsTerminal bool
	// contains filtered or unexported fields
}

func (*Status) AddResult

func (st *Status) AddResult(result *models.File)

func (*Status) Print

func (st *Status) Print()

type Writer

type Writer struct {
	UserPath    string
	WorkingPath string
	NoControlDb bool
	GlobalDbURI string
	Db          bool
	DbURI       string
	DbDebug     bool // enables verbose database logs
	Csv         bool
	CsvFile     string
	Jsonl       bool
	JsonlFile   string
	ELastic     bool
	ELasticURI  string
	Stdout      bool
	None        bool
}

Writer options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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