Documentation
¶
Index ¶
- Variables
- func BuildEngine(patterns []CompiledPattern)
- func ExtractKeyword(regexStr string) string
- func GetPatternCount() int
- func IsValidKeyword(kw string) bool
- func PatternCount() int
- func SaveEndpoints(endpoints []core.Endpoint, cfg *config.Config)
- func SaveScanLog(logName string, content string, cfg *config.Config)
- func SaveSecrets(secrets []core.Secret, cfg *config.Config)
- func SetTemplatePatterns(patterns []CompiledPattern)
- type CompiledPattern
- type EndpointScanner
- type Engine
- type GitleaksResult
- type PatternFile
- type PatternLoader
- type PatternTemplate
- type SecretScanner
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalEngine = &Engine{ KeywordIndexMap: make(map[int][]int), }
Functions ¶
func BuildEngine ¶
func BuildEngine(patterns []CompiledPattern)
BuildEngine compiles the Aho-Corasick matcher from the provided patterns
func ExtractKeyword ¶
ExtractKeyword analyzes a regex pattern and returns the longest literal string that MUST be present for the regex to match. Returns empty string if none found.
func GetPatternCount ¶
func GetPatternCount() int
GetPatternCount returns the number of loaded patterns
func IsValidKeyword ¶
IsValidKeyword checks if the keyword is good enough to be an index
func PatternCount ¶
func PatternCount() int
func SaveScanLog ¶
SaveScanLog saves detailed scan logs to logs folder
func SetTemplatePatterns ¶
func SetTemplatePatterns(patterns []CompiledPattern)
SetTemplatePatterns sets the loaded patterns for use by the scanner
Types ¶
type CompiledPattern ¶
type CompiledPattern struct {
ID string
Name string
Regex *coregex.Regexp
RegexString string // Store original regex for optimization
Confidence int
Severity string
EntropyCheck bool
MinEntropy float64
Tags []string
Mutex *sync.Mutex // Protects Regex from concurrent access (lazy DFA)
}
func GetPatterns ¶
func GetPatterns() []CompiledPattern
func GetPatternsBySeverity ¶
func GetPatternsBySeverity(severity string) []CompiledPattern
func GetPatternsByTag ¶
func GetPatternsByTag(tag string) []CompiledPattern
func LoadPatterns ¶
func LoadPatterns() ([]CompiledPattern, error)
type EndpointScanner ¶
func NewEndpointScanner ¶
func NewEndpointScanner(cfg *config.Config) *EndpointScanner
type Engine ¶
type Engine struct {
Matcher *ahocorasick.Matcher
KeywordIndexMap map[int][]int // Maps keyword_index (from AC) -> list of pattern indices (in AllPatterns)
FallbackPatterns []int // Indices of patterns with no keywords (must always run)
AllPatterns []CompiledPattern
IsReady bool
// contains filtered or unexported fields
}
Engine is the high-performance scanning engine
type GitleaksResult ¶
type PatternFile ¶
type PatternLoader ¶
type PatternLoader struct {
// contains filtered or unexported fields
}
type PatternTemplate ¶
type PatternTemplate struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Description string `yaml:"description"`
Regex string `yaml:"regex"`
Confidence int `yaml:"confidence"`
Severity string `yaml:"severity"`
EntropyCheck bool `yaml:"entropy_check"`
MinEntropy float64 `yaml:"min_entropy"`
MinLength int `yaml:"min_length"`
MaxLength int `yaml:"max_length"`
Tags []string `yaml:"tags"`
ContextKeywords []string `yaml:"context_keywords"`
References []string `yaml:"references"`
}
type SecretScanner ¶
func NewSecretScanner ¶
func NewSecretScanner(cfg *config.Config) *SecretScanner
func (*SecretScanner) SetSkipGeneric ¶
func (s *SecretScanner) SetSkipGeneric(skip bool)
Click to show internal directories.
Click to hide internal directories.