trainer

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcOmenKeyspace

func CalcOmenKeyspace(ot *OmenTrainer) map[int]int64

func FindOmenLevel

func FindOmenLevel(ot *OmenTrainer, password string) int

func IsHexEncoded

func IsHexEncoded(line []byte) bool

func LoadPasswordsToSlice

func LoadPasswordsToSlice(filename string, prefixCount bool) ([]string, int, int, bool, error)

func RunPass2Parallel

func RunPass2Parallel(passwords []string, alphabet []rune, ngram, maxLen int, mwd *parser.TrieMultiWordDetector, numWorkers int) (*OmenTrainer, *PCFGParser, error)

func RunPass3Parallel

func RunPass3Parallel(passwords []string, omenTrainer *OmenTrainer, numWorkers int) map[int]int

func SaveConfigFile

func SaveConfigFile(baseDir string, info *ProgramInfo, fileInput *FileInput, pcfgParser *PCFGParser) error

func SaveOmenRules

func SaveOmenRules(baseDir string, ot *OmenTrainer, omenKeyspace map[int]int64, omenLevels map[int]int, numValid int, info *ProgramInfo) error

func SavePCFGData

func SavePCFGData(baseDir string, pcfgParser *PCFGParser, encoding string, saveSensitive bool) error

SavePCFGData saves all PCFG training data to disk.

Types

type AlphabetGenerator

type AlphabetGenerator struct {
	MaxSize int
	NGram   int
	Counts  map[rune]int
}

func NewAlphabetGenerator

func NewAlphabetGenerator(maxSize, ngram int) *AlphabetGenerator

func (*AlphabetGenerator) GetAlphabet

func (ag *AlphabetGenerator) GetAlphabet() []rune

func (*AlphabetGenerator) ProcessPassword

func (ag *AlphabetGenerator) ProcessPassword(password string)

type CountEntry

type CountEntry struct {
	Key   string
	Count int
}

type Counter

type Counter struct {
	M map[string]int
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter() *Counter

func (*Counter) Add

func (c *Counter) Add(key string, n int)

func (*Counter) AddBatch

func (c *Counter) AddBatch(entries map[string]int)

func (*Counter) Inc

func (c *Counter) Inc(key string)

func (*Counter) MergeFrom

func (c *Counter) MergeFrom(other *Counter)

func (*Counter) Snapshot

func (c *Counter) Snapshot() map[string]int

func (*Counter) TopN

func (c *Counter) TopN(n int) []CountEntry

type FileInput

type FileInput struct {
	Filename                string
	Encoding                string
	PrefixCount             bool
	NumPasswords            int
	NumEncodingErr          int
	DuplicatesFound         bool
	NumToCheckForDuplicates int
}

func (*FileInput) ReadPasswords

func (fi *FileInput) ReadPasswords(callback func(password string)) error

type LenIndexedCounters

type LenIndexedCounters struct {
	M map[int]*Counter
	// contains filtered or unexported fields
}

func NewLenIndexedCounters

func NewLenIndexedCounters() *LenIndexedCounters

func (*LenIndexedCounters) Get

func (l *LenIndexedCounters) Get(length int) *Counter

func (*LenIndexedCounters) Inc

func (l *LenIndexedCounters) Inc(length int, value string)

func (*LenIndexedCounters) Keys

func (l *LenIndexedCounters) Keys() []int

func (*LenIndexedCounters) MergeFrom

func (l *LenIndexedCounters) MergeFrom(other *LenIndexedCounters)

type OmenTrainer

type OmenTrainer struct {
	Alphabet []rune

	NGram    int
	MaxLen   int
	MinLen   int
	Grammar  map[string]*omenContext
	LNLookup []int

	LNCounter int
	IPCounter int
	EPCounter int

	SmoothedLN []smoothedLNEntry
	// contains filtered or unexported fields
}

func NewOmenTrainer

func NewOmenTrainer(alphabet []rune, ngram, maxLen int) *OmenTrainer

func (*OmenTrainer) ApplySmoothing

func (ot *OmenTrainer) ApplySmoothing()

func (*OmenTrainer) MergeFrom

func (ot *OmenTrainer) MergeFrom(other *OmenTrainer)

func (*OmenTrainer) Parse

func (ot *OmenTrainer) Parse(password string)

type PCFGParser

type PCFGParser struct {
	MultiwordDetector *parser.TrieMultiWordDetector

	CountKeyboard       *LenIndexedCounters
	CountEmails         *Counter
	CountEmailProv      *Counter
	CountWebsiteURLs    *Counter
	CountWebsiteHosts   *Counter
	CountWebsitePfx     *Counter
	CountYears          *Counter
	CountContext        *Counter
	CountAlpha          *LenIndexedCounters
	CountAlphaMasks     *LenIndexedCounters
	CountDigits         *LenIndexedCounters
	CountOther          *LenIndexedCounters
	CountBaseStructs    *Counter
	CountRawBaseStructs *Counter
	CountPrince         *Counter
}

func NewPCFGParser

func NewPCFGParser(mwd *parser.TrieMultiWordDetector) *PCFGParser

func (*PCFGParser) MergeFrom

func (p *PCFGParser) MergeFrom(other *PCFGParser)

func (*PCFGParser) Parse

func (p *PCFGParser) Parse(password string)

type Pass2Result

type Pass2Result struct {
	Omen *OmenTrainer
	PCFG *PCFGParser
}

type ProgramInfo

type ProgramInfo struct {
	Name          string
	Version       string
	Author        string
	Contact       string
	RuleName      string
	TrainingFile  string
	Encoding      string
	Comments      string
	SaveSensitive bool
	PrefixCount   bool
	NGram         int
	AlphabetSize  int
	Coverage      float64
	MaxLen        int
	Multiword     string
}

type Result

type Result struct {
	Decoded    []byte
	HexContent []byte
	IsHex      bool
	HadError   bool
}

func Decode

func Decode(line []byte) Result

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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