Documentation ¶
Index ¶
- type Cache
- type LenDist
- type MarkovModel
- func (m *MarkovModel) AddSubdomain(name string)
- func (m *MarkovModel) GenerateLabel() string
- func (m *MarkovModel) GenerateNames(num int, subdomains ...string) []string
- func (m *MarkovModel) NgramSize() int
- func (m *MarkovModel) Subdomains() []string
- func (m *MarkovModel) TotalTrainings() int
- func (m *MarkovModel) Train(name string)
- type State
- func (s *State) AddPrefixWord(name string) []string
- func (s *State) AddSuffixWord(name string) []string
- func (s *State) AppendNumbers(name string) []string
- func (s *State) FlipNumbers(name string) []string
- func (s *State) FlipWords(name string) []string
- func (s *State) FuzzyLabelSearches(name string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MarkovModel ¶
type MarkovModel struct { sync.Mutex Ngrams map[string]map[rune]*LenDist // contains filtered or unexported fields }
MarkovModel trains on DNS names and provides data for generating name guesses.
func NewMarkovModel ¶
func NewMarkovModel(ngramSize int) *MarkovModel
NewMarkovModel returns a MarkovModel used for training on and generating DNS names.
func (*MarkovModel) AddSubdomain ¶
func (m *MarkovModel) AddSubdomain(name string)
AddSubdomain accepts a FQDN and adds the largest proper subdomain to the collection maintained by the model.
func (*MarkovModel) GenerateLabel ¶
func (m *MarkovModel) GenerateLabel() string
GenerateLabel returns a valid DNS name label based on the trained model.
func (*MarkovModel) GenerateNames ¶
func (m *MarkovModel) GenerateNames(num int, subdomains ...string) []string
GenerateNames returns 'num' guesses for each of the subdomains provided. If no subdomains are provided, all the subdomains previously added to the model will be used instead.
func (*MarkovModel) NgramSize ¶
func (m *MarkovModel) NgramSize() int
NgramSize returns the maximum size ngrams used by this markov model.
func (*MarkovModel) Subdomains ¶
func (m *MarkovModel) Subdomains() []string
Subdomains returns all the subdomain names in the collection maintained by the model.
func (*MarkovModel) TotalTrainings ¶
func (m *MarkovModel) TotalTrainings() int
TotalTrainings returns the number of times the model has been trained.
func (*MarkovModel) Train ¶
func (m *MarkovModel) Train(name string)
Train enriches the model adding the name provided to the existing data.
type State ¶
State maintains the word prefix and suffix counters.
func (*State) AddPrefixWord ¶
AddPrefixWord appends a subdomain name to a prefix.
func (*State) AddSuffixWord ¶
AddSuffixWord appends a suffix to a subdomain name.
func (*State) AppendNumbers ¶
AppendNumbers appends a number to a subdomain name.
func (*State) FlipNumbers ¶
FlipNumbers flips numbers in a subdomain name.
func (*State) FuzzyLabelSearches ¶
FuzzyLabelSearches returns new names generated by making slight mutations to the provided name.