DomainTwistex.Utils (domaintwistex v0.9.0)
DomainTwistEx provides domain permutation generation and validation utilities. Uses pure Elixir permutation generation with domain validation and server checking capabilities.
Summary
Functions
Calculates multiple fuzzy similarity scores between original and permuted domain.
Performs comprehensive domain validation checks including DNS and server availability.
Performs a basic HTTP check on a domain's web server.
Generates domain permutations with options.
Validates and resolves domain information while checking for TLD-related issues.
1. Domain Permutation Generation
Generates domain permutations using the pure Elixir Permutate module.
Functions
Calculates multiple fuzzy similarity scores between original and permuted domain.
Returns a map with:
- :jaro_winkler - Jaro-Winkler distance (0.0-1.0, higher = more similar)
- :levenshtein - Edit distance (lower = more similar)
- :keyboard_distance - Weighted distance accounting for keyboard proximity
- :visual_similarity - Score for visually similar characters (homoglyphs)
Performs comprehensive domain validation checks including DNS and server availability.
Parameters
- permutation - Map containing at least :fqdn and :tld keys
Returns
{:ok, map}- Successfully checked domain with all information{:error, binary}- Error message when checks fail{:error, :not_resolvable}- When domain cannot be resolved
Example
```
iex> permutation = %{fqdn: "example.com", tld: "com"}
iex> DomainTwistex.Utils.check_domain(permutation)
{:ok, %{
resolvable: true,
ip_addresses: ["93.184.216.34"],
mx_records: [%{priority: 10, server: "mail.example.com"}],
txt_records: ["v=spf1 -all"],
server_response: %{status_code: "200", server: "ECS"},
nameservers: ["ns1.example.com", "ns2.example.com"]
}}
```
Performs a basic HTTP check on a domain's web server.
Parameters
- domain - String representing the domain to check
Returns
- map containing server response information or error details
Example
```
iex> DomainTwistex.Utils.check_server("example.com")
%{
status_code: "200",
server: "ECS",
headers: %{"Server" => "ECS", "Content-Type" => "text/html"}
}
```
Generates domain permutations with options.
See generate_permutations/1 for details.
Validates and resolves domain information while checking for TLD-related issues.
Parameters
- domain - String representing the domain to check
- tld - String representing the top-level domain to validate against
Returns
{:ok, [string]}- List of valid IP addresses{:error, reason}- Error message when validation fails
1. Domain Permutation Generation
Generates domain permutations using the pure Elixir Permutate module.
Produces 18 permutation types: Addition, Bitsquatting, Hyphenation, HyphenationTldBoundary, Insertion, Omission, Repetition, Replacement, Subdomain, Transposition, VowelSwap, VowelShuffle, DoubleVowelInsertion, Keyword, Tld, FauxTld, Mapped, and Homoglyph.
Parameters
- domain - String representing the domain to generate permutations for
- opts - Keyword list of options:
- :faux_tld - include FauxTld permutations (default: false, adds ~14K entries)
- :double_vowel - include DoubleVowelInsertion (default: true)
- :vowel_shuffle - include VowelShuffle (default: true)
Returns
List of generated domain permutation maps with :fqdn, :tld, and :kind keys
Examples
```
iex(1)> DomainTwistex.Utils.generate_permutations("google.com")
[
%{kind: "Keyword", fqdn: "servicegoogle.com", tld: "com"},
%{kind: "Homoglyph", fqdn: "ğöögle.com", tld: "com"},
# ...
]
```