[][src]Struct twistrs::permutate::Domain

pub struct Domain<'a> {
    pub fqdn: &'a str,
    // some fields omitted
}

Wrapper around an FQDN to perform permutations against.

Fields

fqdn: &'a str

The domain FQDN to generate permutations from.

Implementations

impl<'a> Domain<'a>[src]

pub fn new(fqdn: &'a str) -> Result<Domain<'a>, PermutationError>[src]

Wrap a desired FQDN into a Domain container. Internally will perform additional operations to break the domain into one or more chunks to be used during domain permutations.

pub fn all(&self) -> impl Iterator<Item = String> + '_[src]

Generate any and all possible domain permutations for a given Domain.

Returns Iterator<String> with an iterator of domain permutations and includes the results of all other individual permutation methods.

Any future permutations will also be included into this function call without any changes required from any client implementations.

pub fn addition(&self) -> impl Iterator<Item = String> + '_[src]

Add every ASCII lowercase character between the Domain (e.g. google) and top-level domain (e.g. .com).

pub fn bitsquatting(&self) -> impl Iterator<Item = String> + '_[src]

Following implementation takes inspiration from the following content:

  • https://github.com/artemdinaburg/bitsquat-script/blob/master/bitsquat.py
  • http://dinaburg.org/bitsquatting.html

Go through each char in the domain and XOR it against 8 separate masks:

00000001 ^ chr 00000010 ^ chr 00000100 ^ chr 00001000 ^ chr 00010000 ^ chr 00100000 ^ chr 01000000 ^ chr 10000000 ^ chr

Then check if the resulting bit operation falls within ASCII range.

pub fn homoglyph(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that replaces ASCII characters with multiple homoglyphs similar to the respective ASCII character.

pub fn hyphentation(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that inserts hyphens (i.e. -) between each character in the domain where valid.

pub fn insertion(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that inserts specific characters that are close to any character in the domain depending on the keyboard (e.g. Q next to W in qwerty keyboard layout.

pub fn omission(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that selectively removes a character from the domain.

pub fn repetition(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that repeats characters twice provided they are alphabetic characters (e.g. google.com -> gooogle.com).

pub fn replacement(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method similar to insertion, except that it replaces a given character with another character in proximity depending on keyboard layout.

pub fn subdomain(&self) -> impl Iterator<Item = String> + '_[src]

pub fn transposition(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that swaps out characters in the domain (e.g. google.com -> goolge.com).

pub fn vowel_swap(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that swaps vowels for other vowels (e.g. google.com -> gougle.com).

pub fn keyword(&self) -> impl Iterator<Item = String> + '_[src]

Permutation mode that appends and prepends common keywords to the domain in the following order:

  1. Prepend keyword and dash (e.g. foo.com -> word-foo.com)
  2. Prepend keyword (e.g. foo.com -> wordfoo.com)
  3. Append keyword and dash (e.g. foo.com -> foo-word.com)
  4. Append keyword and dash (e.g. foo.com -> fooword.com)

pub fn tld(&self) -> impl Iterator<Item = String> + '_[src]

Permutation method that replaces all TLDs as variations of the root domain passed.

pub fn filter_domains<T>(permutations: T) -> impl Iterator<Item = String> where
    T: Iterator<Item = String>, 
[src]

Utility function that filters an iterator of domains that are valid. This is performed in a two-pass validation:

1st pass - validate that the domain is punycode decodable by splitting the domain into parts ("."), removing any "xn--" prefixes, and punycode decoding the part.

2nd pass - simple regular expression pass to see if the resulting domains are indeed valid domains.

Trait Implementations

impl<'a> Debug for Domain<'a>[src]

impl<'a> Default for Domain<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Domain<'a>

impl<'a> Send for Domain<'a>

impl<'a> Sync for Domain<'a>

impl<'a> Unpin for Domain<'a>

impl<'a> UnwindSafe for Domain<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.