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

Inherits:
Ronin::Listener::CLI::Command show all
Includes:
Core::CLI::Logging
Defined in:
lib/ronin/listener/cli/commands/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.

Starts a HTTP server for receiving exfiltrated data.

Usage

ronin-listener http [options]

Options

-o, --output FILE                The output file to write HTTP requests to
-F, --output-format txt|csv|json|ndjson
                                 The output format
-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 (Default: /)
-h, --help                       Print help information

Examples

ronin-listener http -H 127.0.0.1 -p 8080
ronin-listener http -H 127.0.0.1 -p 8080 --vhost example.com

Instance Method Summary collapse

Instance Method Details

#runObject

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 http command.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/ronin/listener/cli/commands/http.rb', line 118

def run
  output_file = if options[:output]
                  options[:output_format].open(options[:output])
                end

  log_info "Listening on #{options[:host]}:#{options[:port]} ..."

  Ronin::Listener::HTTP.listen(**server_kwargs) do |request|
    log_info "Received HTTP request from #{request.remote_ip}:#{request.remote_port} ..."

    puts(request)

    output_file << request if output_file
  end
end

#server_kwargsHash{Symbol => 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.

Maps options to keyword arguments for Ronin::Listener::HTTP.listen.

Returns:

  • (Hash{Symbol => Object})


140
141
142
143
144
145
146
147
# File 'lib/ronin/listener/cli/commands/http.rb', line 140

def server_kwargs
  {
    host:  options[:host],
    port:  options[:port],
    vhost: options[:vhost],
    root:  options[:root]
  }
end