Module: Ronin::CLI::HostAndPort Private
- Included in:
- Commands::BannerGrab, Commands::CertDump, Commands::CertGrab, Commands::Proxy
- Defined in:
- lib/ronin/cli/host_and_port.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Mixin which adds methods for parsing host:port
pairs.
Instance Method Summary collapse
-
#host_and_port(string) ⇒ (String, Integer)
private
Parses a
host:port
pair. -
#host_and_port_from_url(url) ⇒ (String, Integer)
private
Parses the host and port from the given URL.
Instance Method Details
#host_and_port(string) ⇒ (String, Integer)
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.
Parses a host:port
pair.
36 37 38 39 40 |
# File 'lib/ronin/cli/host_and_port.rb', line 36 def host_and_port(string) host, port = string.split(':',2) return host, port.to_i end |
#host_and_port_from_url(url) ⇒ (String, Integer)
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.
Parses the host and port from the given URL.
51 52 53 54 55 |
# File 'lib/ronin/cli/host_and_port.rb', line 51 def host_and_port_from_url(url) uri = Addressable::URI.parse(url) return uri.normalized_host, uri.inferred_port end |