Class: Ronin::CLI::Commands::CertGrab Private
- Inherits:
-
ValueProcessorCommand
- Object
- Core::CLI::Command
- Ronin::CLI::Command
- ValueProcessorCommand
- Ronin::CLI::Commands::CertGrab
- Includes:
- HostAndPort
- Defined in:
- lib/ronin/cli/commands/cert_grab.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.
Downloads the SSL/TLS certificate for a SSL/TLS service or https://
URL.
Usage
ronin cert-grab [options] {HOST:PORT | URL} ...
Options
-f, --file FILE Optional file to read values from
-h, --help Print help information
Arguments
HOST:PORT | URL ... A HOST:PORT or URL
Examples
ronin cert-grab github.com:443
ronin cert-grab 93.184.216.34:443
ronin cert-grab https://github.com/
Instance Attribute Summary
Attributes inherited from ValueProcessorCommand
Instance Method Summary collapse
-
#cert_file_for(host, port) ⇒ String
private
The output file for the given host and port.
-
#grab_cert(host, port) ⇒ Object
private
Downloads the certificate for the given host and port.
-
#process_value(value) ⇒ Object
private
Runs the
ronin cert-grab
command.
Methods included from HostAndPort
#host_and_port, #host_and_port_from_url
Methods inherited from ValueProcessorCommand
#initialize, #process_file, #run
Constructor Details
This class inherits a constructor from Ronin::CLI::ValueProcessorCommand
Instance Method Details
#cert_file_for(host, port) ⇒ String
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.
The output file for the given host and port.
106 107 108 |
# File 'lib/ronin/cli/commands/cert_grab.rb', line 106 def cert_file_for(host,port) "#{host}:#{port}.crt" end |
#grab_cert(host, port) ⇒ 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.
Downloads the certificate for the given host and port.
119 120 121 122 123 |
# File 'lib/ronin/cli/commands/cert_grab.rb', line 119 def grab_cert(host,port) cert = Support::Network::SSL.get_cert(host,port) cert.save(cert_file_for(host,port)) end |
#process_value(value) ⇒ 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 cert-grab
command.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/ronin/cli/commands/cert_grab.rb', line 80 def process_value(value) case value when /\A[^:]+:\d+\z/ host, port = host_and_port(value) grab_cert(host,port) when /\Ahttps:/ host, port = host_and_port_from_url(value) grab_cert(host,port) else print_error "invalid target: must be a HOST:PORT or a URL: #{value.inspect}" exit(1) end end |