class Ronin::CLI::Commands::Url

Parses URL(s).

## Usage

ronin url [options] [URL ...]

## Options

-f, --file FILE                  Optional file to read values from
-u, --user                       Print the URL's user name
    --password                   Print the URL's password
    --user-password              Print the URL's user name and password
-H, --host                       Print the URL's host name
    --port                       Print the URL's port
    --host-port                  Print the URL's host:port
-P, --path                       Print the URL's path
    --path-query                 Print the URL's path and query string
-Q, --query                      Print the URL's query string
-q, --query-param NAME           Print the query param from the URL's query string
-F, --fragment                   Print the URL's fragment
-S, --status                     Print the HTTP status of each URL
-h, --help                       Print help information

## Arguments

[URL ...]                        The URL(s) to parse

## Examples

ronin url --host https://example.com/foo
ronin url --host-port https://example.com:8080/foo
ronin url --param id https://example.com/page?id=100

Public Instance Methods

process_value(url) click to toggle source

Processes an individual URL.

@param [String] url

# File lib/ronin/cli/commands/url.rb, line 120
def process_value(url)
  uri = URI(url)

  if options[:user]
    puts uri.user
  elsif options[:password]
    puts uri.password
  elsif options[:user_password]
    puts "#{uri.user}:#{uri.password}"
  elsif options[:host]
    puts uri.host
  elsif options[:host_port]
    puts "#{uri.host}:#{uri.port}"
  elsif options[:path]
    puts uri.path
  elsif options[:query]
    puts uri.query
  elsif options[:path_query]
    puts uri.request_uri
  elsif options[:param]
    puts uri.query_params[options[:param]]
  elsif options[:fragment]
    puts uri.fragment
  elsif options[:status]
    puts "#{uri.status} #{uri}"
  else
    puts uri
  end
end