class Ronin::CLI::Commands::Typosquat

Finds typo squatted domains.

## Usage

ronin typosquat [options] [DOMAIN ...]

## Options

-f, --file FILE                  Optional file to read values from
    --omit-chars                 Toggles whether to omit repeated characters
    --repeat-chars               Toggles whether to repeat single characters
    --swap-chars                 Toggles whether to swap certain common character pairs
    --change-suffix              Toggles whether to change the suffix of words
    -A, --has-addresses          Print typo squat domains with addresses
    -r, --registered             Print typo squat domains that are already registered
    -u, --unregistered           Print typo squat domains that can be registered
-h, --help                       Print help information

## Arguments

DOMAIN                           The domain to typo squat

Public Instance Methods

each_typo_squat(domain) { |domain("#{typo}#{suffix}")| ... } click to toggle source

Enumerates over each typosquat of the domain.

@param [String] domain

The domain to typo squat.

@yield [typo_domain]

The given block will be passed each new typo squated domain.

@yieldparam [Ronin::Support::Network::Domain] typo_domain

A typo squated variation on the input domain.
# File lib/ronin/cli/commands/typosquat.rb, line 113
def each_typo_squat(domain)
  domain = Support::Network::Domain.new(domain)
  suffix = domain.suffix
  name   = domain.name.chomp(suffix)

  typo_generator.each_substitution(name) do |typo|
    yield Support::Network::Domain.new("#{typo}#{suffix}")
  end
end
process_value(domain) click to toggle source

Processes each word.

@param [String] domain

A word argument to typo.
# File lib/ronin/cli/commands/typosquat.rb, line 75
def process_value(domain)
  if options[:has_addresses]
    each_typo_squat(domain) do |typo_domain|
      if typo_domain.has_addresses?
        puts typo_domain
      end
    end
  elsif options[:registered]
    each_typo_squat(domain) do |typo_domain|
      if typo_domain.registered?
        puts typo_domain
      end
    end
  elsif options[:unregistered]
    each_typo_squat(domain) do |typo_domain|
      if typo_domain.unregistered?
        puts typo_domain
      end
    end
  else
    each_typo_squat(domain) do |typo_domain|
      puts typo_domain
    end
  end
end