pub struct Domain {
pub fqdn: String,
/* private fields */
}
Expand description
Wrapper around an FQDN to perform permutations against.
Fields§
§fqdn: String
The domain FQDN to generate permutations from.
Implementations§
source§impl Domain
impl Domain
sourcepub fn new(fqdn: &str) -> Result<Domain, Error>
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.
sourcepub fn all(&self) -> Result<impl Iterator<Item = Permutation> + '_, Error>
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.
sourcepub fn addition(&self) -> impl Iterator<Item = Permutation> + '_
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
).
sourcepub fn bitsquatting(&self) -> impl Iterator<Item = Permutation> + '_
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.
sourcepub fn homoglyph(&self) -> Result<impl Iterator<Item = Permutation> + '_, Error>
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.
sourcepub fn hyphentation(&self) -> impl Iterator<Item = Permutation> + '_
pub fn hyphentation(&self) -> impl Iterator<Item = Permutation> + '_
Permutation method that inserts hyphens (i.e. -
) between each
character in the domain where valid.
sourcepub fn insertion(&self) -> impl Iterator<Item = Permutation> + '_
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.
sourcepub fn omission(&self) -> impl Iterator<Item = Permutation> + '_
pub fn omission(&self) -> impl Iterator<Item = Permutation> + '_
Permutation method that selectively removes a character from the domain.
sourcepub fn repetition(&self) -> impl Iterator<Item = Permutation> + '_
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
).
sourcepub fn replacement(&self) -> impl Iterator<Item = Permutation> + '_
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.
pub fn subdomain(&self) -> impl Iterator<Item = Permutation> + '_
sourcepub fn transposition(&self) -> impl Iterator<Item = Permutation> + '_
pub fn transposition(&self) -> impl Iterator<Item = Permutation> + '_
Permutation method that swaps out characters in the domain (e.g.
google.com
-> goolge.com
).
sourcepub fn vowel_swap(&self) -> impl Iterator<Item = Permutation> + '_
pub fn vowel_swap(&self) -> impl Iterator<Item = Permutation> + '_
Permutation method that swaps vowels for other vowels (e.g.
google.com
-> gougle.com
).
sourcepub fn keyword(&self) -> impl Iterator<Item = Permutation> + '_
pub fn keyword(&self) -> impl Iterator<Item = Permutation> + '_
Permutation mode that appends and prepends common keywords to the domain in the following order:
- Prepend keyword and dash (e.g.
foo.com
->word-foo.com
) - Prepend keyword (e.g.
foo.com
->wordfoo.com
) - Append keyword and dash (e.g.
foo.com
->foo-word.com
) - Append keyword and dash (e.g.
foo.com
->fooword.com
)
sourcepub fn tld(&self) -> impl Iterator<Item = Permutation> + '_
pub fn tld(&self) -> impl Iterator<Item = Permutation> + '_
Permutation method that replaces all TLDs as variations of the root domain passed.
sourcepub fn filter_domains<P>(permutations: P) -> impl Iterator<Item = Permutation>where
P: Iterator<Item = Permutation>,
pub fn filter_domains<P>(permutations: P) -> impl Iterator<Item = Permutation>where P: Iterator<Item = Permutation>,
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§
source§impl PartialEq for Domain
impl PartialEq for Domain
impl Eq for Domain
impl StructuralEq for Domain
impl StructuralPartialEq for Domain
Auto Trait Implementations§
impl RefUnwindSafe for Domain
impl Send for Domain
impl Sync for Domain
impl Unpin for Domain
impl UnwindSafe for Domain
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.