/typogenerator

Golang string typo generator

Primary LanguageGoApache License 2.0Apache-2.0

Typogenerator: a typosquatting generator in Golang

A Golang typosquat generator utilizing various strategies to generate potential variants of a string. Some strategies are similar to those utilized by dnstwist. This library is not intended to be a complete port of dnstwist and may include additional strategies.

Usage

See files under cmd/ for example usage.

Fuzz

all := []strategy.Strategy{
	strategy.Omission,
	strategy.Repetition,
}

results, err := typogenerator.Fuzz("zenithar", all...)
if err != nil {
	fmt.Println(err)
}

for _, r := range results {
	for _, p := range r.Permutations {
		fmt.Println(p)
	}
}

// enithar
// znithar
// zeithar
// zenthar
// ...

FuzzDomain

all := []strategy.Strategy{
	strategy.Omission,
	strategy.Repetition,
}

results, err := typogenerator.FuzzDomain("example.com", all...)
if err != nil {
	fmt.Println(err)
}

for _, r := range results {
	for _, p := range r.Permutations {
		fmt.Println(p)
	}
}

// xample.com
// eample.com
// exmple.com
// exaple.com
// ...

Fuzzing Algorithms (strategies)

  1. Addition - Addition of a single character to the end of a string
  2. BitSquatting - Generates a string with one bit difference from the input
  3. DoubleHit - Addition of a single character that is adjacent to each character (double hitting of a key)
  4. Homoglyph - Substituiton of a single character with another that looks similar
  5. Hyphenation - Addition of a hypen - between the first and last character in a string
  6. Omission - Removal of a single character in a string
  7. Prefix - Addition of predefined prefixes to the start of a string
  8. Repetition - Repetition of characters in a string (pressing a key twice)
  9. Replace - Replacement of a single character that is adjacent to each character (pressing wrong key)
  10. Similar - Replacement of a single character that looks the same. This is a subset of Homoglyph but is language specific.
  11. SubDomain - Addition of a period . between the first and last character in a string
  12. Transposition - Swapping of adjacent characters in a string
  13. VowelSwap - Swapping of vowels in string with all other vowels
  14. TLDReplace - Replaces the TLD with a list of commonly used TLDs. Only works with FuzzDomain.
  15. TLDRepeat - Repeats the TLD after the domain name. Only works with FuzzDomain.

Languages

The following strategies are language dependent:

  1. DoubleHit
  2. Replace
  3. Similar

Supported languages include:

  1. English
  2. French
  3. German
  4. Spanish