class Ronin::CLI::Commands::Bitsquat

Finds bit-flips of a domain.

## Usage

ronin bitsquat [options] [DOMAIN ...]

## Options

-f, --file FILE                  Optional file to read values from
    --has-addresses              Print bitsquat domains with addresses
    --registered                 Print bitsquat domains that are already registered
    --unregistered               Print bitsquat domains that can be registered
-h, --help                       Print help information

## Arguments

[DOMAIN ...]                     The domain to bit-flip

Constants

VALID_HOST_NAME

Regular expression for a valid host name.

Public Instance Methods

each_bit_squat(domain) { |host| ... } click to toggle source

Enumerates over each bitsquat of the domain.

@param [String] domain

The domain to check for bitsquats.

@yield [bitsquat_host]

The given block will be passed each bitsquatted domain variant.

@yieldparam [Ronin::Support::Network::Host] bitsquat_host

A host object for the bitsquatted domain variant.
# File lib/ronin/cli/commands/bitsquat.rb, line 106
def each_bit_squat(domain)
  domain.each_bit_flip do |bit_flipped|
    bit_flipped.force_encoding(Encoding::UTF_8)

    if bit_flipped.valid_encoding? && bit_flipped =~ VALID_HOST_NAME
      yield Support::Network::Host.new(bit_flipped)
    end
  end
end
process_value(domain) click to toggle source

Queries the bit-flips of a domain.

@param [String] domain

The string to bit-flip and query.
# File lib/ronin/cli/commands/bitsquat.rb, line 74
def process_value(domain)
  if options[:has_addresses]
    each_bit_squat(domain) do |host|
      puts host if host.has_addresses?
    end
  elsif options[:registered]
    each_bit_squat(domain) do |host|
      puts host if host.registered?
    end
  elsif options[:unregistered]
    each_bit_squat(domain) do |host|
      puts host if host.unregistered?
    end
  else
    each_bit_squat(domain) do |host|
      puts host
    end
  end
end