class Ronin::CLI::Commands::CertGrab
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/
Public Instance Methods
cert_file_for(host,port)
click to toggle source
The output file for the given host and port.
@param [String] host
@param [Integer] port
@return [String]
The output `.crt` file to save the certificate to.
# File lib/ronin/cli/commands/cert_grab.rb, line 106 def cert_file_for(host,port) "#{host}:#{port}.crt" end
grab_cert(host,port)
click to toggle source
Downloads the certificate for the given host and port.
@param [String] host
The host to connect to.
@param [Integer] port
The port to connect to.
# 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)
click to toggle source
Runs the ‘ronin cert-grab` command.
@param [String] value
The `HOST:PORT` or `URL` value to process.
# 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