Class: Ronin::CLI::Commands::Url Private
- Inherits:
-
ValueProcessorCommand
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- ValueProcessorCommand
- Ronin::CLI::Commands::Url
- Defined in:
- lib/ronin/cli/commands/url.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.
Parses URL(s).
Usage
ronin url [] [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
Instance Attribute Summary
Attributes inherited from ValueProcessorCommand
Instance Method Summary collapse
-
#process_value(url) ⇒ Object
private
Processes an individual URL.
Methods inherited from ValueProcessorCommand
#initialize, #process_file, #run
Constructor Details
This class inherits a constructor from Ronin::CLI::ValueProcessorCommand
Instance Method Details
#process_value(url) ⇒ 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.
Processes an individual URL.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/ronin/cli/commands/url.rb', line 120 def process_value(url) uri = URI(url) if [:user] puts uri.user elsif [:password] puts uri.password elsif [:user_password] puts "#{uri.user}:#{uri.password}" elsif [:host] puts uri.host elsif [:host_port] puts "#{uri.host}:#{uri.port}" elsif [:path] puts uri.path elsif [:query] puts uri.query elsif [:path_query] puts uri.request_uri elsif [:param] puts uri.query_params[[:param]] elsif [:fragment] puts uri.fragment elsif [:status] puts "#{uri.status} #{uri}" else puts uri end end |