Class: Ronin::Listener::CLI::Commands::New::Http Private

Inherits:
Ronin::Listener::CLI::Command show all
Includes:
Core::CLI::Generator
Defined in:
lib/ronin/listener/cli/commands/new/http.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 standalone HTTP listener Ruby script.

Usage

ronin-listener new http PATH

Options

-H, --host IP                    The interface to listen on (Default: 0.0.0.0)
-p, --port PORT                  The port to listen on (Default: 8080)
    --vhost HOST                 The Host: header to filter requests by
-R, --root DIR                   The root directory to filter requests by
-h, --help                       Print help information

Arguments

PATH                             The script file to create

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Http

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 ronin-listener new http command.

Parameters:

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments for the command.



107
108
109
110
111
112
# File 'lib/ronin/listener/cli/commands/new/http.rb', line 107

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

  @host = '0.0.0.0'
  @port = 5553
end

Instance Method Details

#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-listener new http command.

Parameters:

  • path (String)

    The path to the new script file to create.



120
121
122
123
# File 'lib/ronin/listener/cli/commands/new/http.rb', line 120

def run(path)
  erb 'http.rb.erb', path
  chmod '+x', path
end