Documentation
¶
Index ¶
- func GetBuffer() []byte
- func GetPatternDir() (string, error)
- func GetPatterns(dir string) ([]string, error)
- func GetResult() *models.Result
- func GetToolDir() (string, error)
- func IsLiteral(p string) bool
- func LoadPattern(f string) (models.Pattern, error)
- func LoadToolFromFile(f string) (models.Tool, error)
- func LoadTools() ([]models.Tool, error)
- func LoadToolsFrom(dirs ...string) ([]models.Tool, error)
- func PutBuffer(b []byte)
- func PutResult(r *models.Result)
- type BaseEngine
- type CSVParser
- type CompiledPattern
- type Engine
- type FastJSONParser
- type GrepEngine
- type HitCounter
- type LiteralMatcher
- type MatchResult
- type Parser
- type PreFilter
- type RipgrepEngine
- type ScanRecord
- type ScannerOptions
- type ScannerService
- func (s *ScannerService) DiagnoseLine(line string, patterns []string) []string
- func (s *ScannerService) FilterPatternsByTag(tags []string) []string
- func (s *ScannerService) LoadResumeState(file string) error
- func (s *ScannerService) ProcessResults(ctx context.Context, resultsFile string, toolIDs []string) (<-chan *models.Result, error)
- func (s *ScannerService) RunScan(ctx context.Context, opts ScannerOptions) (<-chan *models.Result, error)
- func (s *ScannerService) SaveResumeState(file string) error
- type TextParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPatternDir ¶
func GetPatterns ¶
func GetToolDir ¶
Types ¶
type BaseEngine ¶
type BaseEngine struct {
BinaryPath string
}
BaseEngine provides common functionality for engines.
type CSVParser ¶ added in v0.5.0
type CSVParser struct {
Config models.InputConfig
}
CSVParser handles CSV files
func (*CSVParser) GetRecords ¶ added in v0.5.0
func (*CSVParser) GetRecordsParallel ¶ added in v0.8.2
type CompiledPattern ¶ added in v0.7.0
type CompiledPattern struct {
// contains filtered or unexported fields
}
type Engine ¶
type Engine interface {
Execute(ctx context.Context, p models.Pattern, targets ...string) (<-chan *models.Result, error)
}
Engine defines the interface for a pattern matching engine.
type FastJSONParser ¶ added in v0.6.7
type FastJSONParser struct {
Config models.InputConfig
}
FastJSONParser uses buger/jsonparser for lightning-fast field extraction without full unmarshal
func (*FastJSONParser) GetRecords ¶ added in v0.6.7
func (p *FastJSONParser) GetRecords(ctx context.Context, reader io.Reader, path string) (<-chan ScanRecord, error)
func (*FastJSONParser) GetRecordsParallel ¶ added in v0.8.2
func (p *FastJSONParser) GetRecordsParallel(ctx context.Context, data []byte, path string, concurrency int) (<-chan ScanRecord, error)
type GrepEngine ¶
type GrepEngine struct {
BaseEngine
}
GrepEngine uses 'grep' for pattern matching.
func NewGrepEngine ¶
func NewGrepEngine() (*GrepEngine, error)
type HitCounter ¶ added in v0.6.8
type LiteralMatcher ¶ added in v0.6.7
type LiteralMatcher struct {
// contains filtered or unexported fields
}
LiteralMatcher uses Aho-Corasick for fast multi-pattern literal matching
func NewLiteralMatcher ¶ added in v0.6.7
func NewLiteralMatcher(literals map[string]string) *LiteralMatcher
func (*LiteralMatcher) Match ¶ added in v0.6.7
func (m *LiteralMatcher) Match(content string) []MatchResult
type MatchResult ¶ added in v0.6.7
type Parser ¶ added in v0.5.0
type Parser interface {
GetRecords(ctx context.Context, reader io.Reader, path string) (<-chan ScanRecord, error)
GetRecordsParallel(ctx context.Context, data []byte, path string, concurrency int) (<-chan ScanRecord, error)
}
Parser defines the interface for different input formats
type PreFilter ¶ added in v0.7.5
type PreFilter struct {
// contains filtered or unexported fields
}
PreFilter uses a Bloom Filter to quickly discard lines that definitely don't match any pattern
func NewPreFilter ¶ added in v0.7.5
type RipgrepEngine ¶
type RipgrepEngine struct {
BaseEngine
}
RipgrepEngine uses 'rg' for pattern matching.
func NewRipgrepEngine ¶
func NewRipgrepEngine() (*RipgrepEngine, error)
type ScanRecord ¶ added in v0.5.0
type ScanRecord struct {
Content []byte
ID string
Line int
File string
RawLength int // Number of bytes to increment the progress bar
}
ScanRecord represents a single unit of work
type ScannerOptions ¶
type ScannerOptions struct {
TargetPaths []string
Patterns []string
Tags []string
ToolIDs []string
SmartMode bool
EntropyMode bool
Unique bool
Incremental bool
GlobalDedupe bool
ResumeFile string
Silent bool
Concurrency int
Notify bool
NotifyInterval int
CooldownEvery int
CooldownTime string
ThermalThreshold float64
MaxRAMThreshold float64
AutoScale bool
UsePcre bool
UseMmap bool
UseBloom bool
Quiet bool
NoColor bool
Webhook string
WebhookType string
WebhookLevel string
StateDB *state.DB
ResultHook func(*models.Result)
}
type ScannerService ¶
type ScannerService struct {
Engine Engine
Fallback Engine
Config models.Config
Classifier *classifier.Classifier
Tools []models.Tool
Parser Parser
Resume models.ResumeConfig
// contains filtered or unexported fields
}
func NewScannerService ¶
func NewScannerService(cfg models.Config) (*ScannerService, error)
func (*ScannerService) DiagnoseLine ¶ added in v0.1.5
func (s *ScannerService) DiagnoseLine(line string, patterns []string) []string
func (*ScannerService) FilterPatternsByTag ¶ added in v0.1.8
func (s *ScannerService) FilterPatternsByTag(tags []string) []string
func (*ScannerService) LoadResumeState ¶ added in v0.1.8
func (s *ScannerService) LoadResumeState(file string) error
func (*ScannerService) ProcessResults ¶
func (*ScannerService) RunScan ¶
func (s *ScannerService) RunScan(ctx context.Context, opts ScannerOptions) (<-chan *models.Result, error)
func (*ScannerService) SaveResumeState ¶ added in v0.1.8
func (s *ScannerService) SaveResumeState(file string) error
type TextParser ¶ added in v0.5.0
type TextParser struct {
Config models.InputConfig
}
TextParser handles raw text files
func (*TextParser) GetRecords ¶ added in v0.5.0
func (p *TextParser) GetRecords(ctx context.Context, reader io.Reader, path string) (<-chan ScanRecord, error)
func (*TextParser) GetRecordsParallel ¶ added in v0.8.2
func (p *TextParser) GetRecordsParallel(ctx context.Context, data []byte, path string, concurrency int) (<-chan ScanRecord, error)
Click to show internal directories.
Click to hide internal directories.