Struct twistrs::permutate::Domain

source ·
pub struct Domain {
    pub fqdn: String,
    pub tld: String,
    pub domain: String,
}
Expand description

Wrapper around an FQDN to perform permutations against.

Fields§

§fqdn: String

The domain FQDN to generate permutations from.

§tld: String

The top-level domain of the FQDN (e.g. .com).

§domain: String

The remainder of the domain (e.g. google).

Implementations§

source§

impl Domain

source

pub fn new(fqdn: &str) -> Result<Domain, Error>

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.

source

pub fn all(&self) -> Result<impl Iterator<Item = Permutation> + '_, Error>

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.

source

pub fn addition(&self) -> impl Iterator<Item = Permutation> + '_

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

source

pub fn bitsquatting(&self) -> impl Iterator<Item = Permutation> + '_

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.

source

pub fn homoglyph(&self) -> Result<impl Iterator<Item = Permutation> + '_, Error>

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

source

pub fn hyphentation(&self) -> impl Iterator<Item = Permutation> + '_

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

source

pub fn insertion(&self) -> impl Iterator<Item = Permutation> + '_

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.

source

pub fn omission(&self) -> impl Iterator<Item = Permutation> + '_

Permutation method that selectively removes a character from the domain.

source

pub fn repetition(&self) -> impl Iterator<Item = Permutation> + '_

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

source

pub fn replacement(&self) -> impl Iterator<Item = Permutation> + '_

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

source

pub fn subdomain(&self) -> impl Iterator<Item = Permutation> + '_

source

pub fn transposition(&self) -> impl Iterator<Item = Permutation> + '_

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

source

pub fn vowel_swap(&self) -> impl Iterator<Item = Permutation> + '_

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

source

pub fn keyword(&self) -> impl Iterator<Item = Permutation> + '_

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)
source

pub fn tld(&self) -> impl Iterator<Item = Permutation> + '_

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

Trait Implementations§

source§

impl Clone for Domain

source§

fn clone(&self) -> Domain

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Domain

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Domain

source§

fn default() -> Domain

Returns the “default value” for a type. Read more
source§

impl Hash for Domain

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Domain

source§

fn eq(&self, other: &Domain) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Domain

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Domain

source§

impl StructuralEq for Domain

source§

impl StructuralPartialEq for Domain

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more