Class: Ronin::CLI::Commands::Typosquat Private

Inherits:
ValueProcessorCommand show all
Includes:
TypoOptions
Defined in:
lib/ronin/cli/commands/typosquat.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

Since:

  • 2.0.0

Instance Attribute Summary

Attributes inherited from ValueProcessorCommand

#files

Instance Method Summary collapse

Methods included from TypoOptions

included, #initialize, #typo_generator

Methods inherited from ValueProcessorCommand

#initialize, #process_file, #run

Instance Method Details

#each_typo_squat(domain) {|typo_domain| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Enumerates over each typosquat of the domain.

Parameters:

  • domain (String)

    The domain to typo squat.

Yields:

  • (typo_domain)

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

Yield Parameters:

  • typo_domain (Ronin::Support::Network::Domain)

    A typo squated variation on the input domain.

Since:

  • 2.0.0



113
114
115
116
117
118
119
120
121
# 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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Processes each word.

Parameters:

  • domain (String)

    A word argument to typo.

Since:

  • 2.0.0



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# 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