Class: Ronin::Recon::CLI::Commands::Test Private

Inherits:
WorkerCommand show all
Includes:
Core::CLI::Logging, Core::CLI::Options::Param, DebugOption, Printing
Defined in:
lib/ronin/recon/cli/commands/test.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.

Loads an individual worker and tests it.

Usage

ronin-recon test [options] {--file FILE | NAME} {IP | IP-range | DOMAIN | HOST | WILDCARD | WEBSITE}

Options

-f, --file FILE                  The recon worker file to load
-D, --debug                      Enable debugging output
-h, --help                       Print help information

Arguments

IP|IP-range|DOMAIN|HOST|WILDCARD|WEBSITE  An initial recon value.

Constant Summary

Constants included from Printing

Printing::VALUE_CLASS_NAMES

Instance Attribute Summary

Attributes inherited from WorkerCommand

#worker_class

Instance Method Summary collapse

Methods included from Printing

#format_value, #print_value, #value_class_name

Methods included from DebugOption

included

Methods inherited from WorkerCommand

#load_worker, #load_worker_from

Instance Method Details

#run(name = nil, value) ⇒ 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.

Runs the ronin-recon test command.

Parameters:

  • name (String, nil) (defaults to: nil)

    The optional worker name to load and print metadata for.

  • value (String)

    The input value for the worker.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/ronin/recon/cli/commands/test.rb', line 76

def run(name=nil,value)
  super(name)

  value = begin
            Value.parse(value)
          rescue UnknownValue => error
            print_error(error.message)
            print_error("must be a #{worker_class.accepts.map(&method(:value_class_name)).join(', ')} value")
            exit(-1)
          end

  unless worker_class.accepts.include?(value.class)
    print_error "worker #{worker_class.id.inspect} does not accept #{value_class_name(value.class)} values"
    print_error "must be a #{worker_class.accepts.map(&method(:value_class_name)).join(', ')} value"
    exit(1)
  end

  worker_class.run(value, params: params) do |new_value|
    print_value(new_value)
  end
end