Class: Ronin::Web::CLI::Commands::New::Spider Private

Inherits:
Ronin::Web::CLI::Command show all
Includes:
Core::CLI::Generator
Defined in:
lib/ronin/web/cli/commands/new/spider.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.

Creates a new ronin-web-spider script.

Usage

ronin-web spider [options] {--host[=HOST] | --domain[=DOMAIN] | --site[=URL]} FILE

Options

    --host[=[HOST]]              Spiders a host
    --domain[=[DOMAIN]]          Spiders a domain
    --site[=[URL]]               Spiders a site
    --every-link                 Adds a callback for every link
    --every-url                  Adds a callback for every URL
    --every-failed-url           Adds a callback for every failed URL
    --every-url-like /REGEXP/    Adds a callback for every URL that matches the regexp
    --all-headers                Adds a callback for all HTTP Headers
    --every-page                 Adds a callback for every page
    --every-ok-page              Adds a callback for every HTTP 200 page
    --every-redirect-page        Adds a callback for every redirect page
    --every-timedout-page        Adds a callback for every timedout page
    --every-bad-request-page     Adds a callback for every bad request page
    --every-unauthorized-page    Adds a callback for every unauthorized page
    --every-forbidden-page       Adds a callback for every forbidden page
    --every-missing-page         Adds a callback for every missing page
    --every-internal-server-error-page
                                 Adds a callback for every internal server error page
    --every-txt-page             Adds a callback for every TXT page
    --every-html-page            Adds a callback for every HTML page
    --every-xml-page             Adds a callback for every XML page
    --every-xsl-page             Adds a callback for every XSL page
    --every-javascript-page      Adds a callback for every JavaScript page
    --every-css-page             Adds a callback for every CSS page
    --every-rss-page             Adds a callback for every RSS page
    --every-atom-page            Adds a callback for every Atom page
    --every-ms-word-page         Adds a callback for every MS Wod page
    --every-pdf-page             Adds a callback for every PDF page
    --every-zip-page             Adds a callback for every ZIP page
    --every-doc                  Adds a callback for every HTML/XML document
    --every-html-doc             Adds a callback for every HTML document
    --every-xml-doc              Adds a callback for every XML document
    --every-xsl-doc              Adds a callback for every XSL document
    --every-rss-doc              Adds a callback for every RSS document
    --every-atom-doc             Adds a callback for every Atom document
-h, --help                       Print help information

Arguments

FILE                             The file to create

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Spider

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.

Initializes the command.

Parameters:

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments for the command.

Since:

  • 1.0.0



273
274
275
276
277
# File 'lib/ronin/web/cli/commands/new/spider.rb', line 273

def initialize(**kwargs)
  super(**kwargs)

  @callbacks = []
end

Instance Attribute Details

#callbacksArray<(Symbol, Array, Symbol)> (readonly)

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.

The callbacks for the web spider agent.

Returns:

  • (Array<(Symbol, Array, Symbol)>)

Since:

  • 1.0.0



265
266
267
# File 'lib/ronin/web/cli/commands/new/spider.rb', line 265

def callbacks
  @callbacks
end

#entry_point_methodSymbol? (readonly)

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.

The entry point method for the web spider agent.

Returns:

  • (Symbol, nil)

Since:

  • 1.0.0



260
261
262
# File 'lib/ronin/web/cli/commands/new/spider.rb', line 260

def entry_point_method
  @entry_point_method
end

Instance Method Details

#entry_point_argumentString

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.

The entry method's argument.

Returns:

  • (String)

    The escaped entry point method argument or ARGV[0].

Since:

  • 1.0.0



301
302
303
304
305
306
307
# File 'lib/ronin/web/cli/commands/new/spider.rb', line 301

def entry_point_argument
  if @entry_point_argument
    @entry_point_argument.inspect
  else
    'ARGV[0]'
  end
end

#run(path) ⇒ 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-web new spider command.

Parameters:

  • path (String)

    The path to the new script file to create.

Since:

  • 1.0.0



285
286
287
288
289
290
291
292
293
# File 'lib/ronin/web/cli/commands/new/spider.rb', line 285

def run(path)
  unless @entry_point_method
    print_error "must specify --host, --domain, or --site"
    exit(-1)
  end

  erb 'spider.rb.erb', path
  chmod '+x', path
end