diff --git a/lib/ronin/cli/commands/cert_dump.rb b/lib/ronin/cli/commands/cert_dump.rb index 1b7fce6f8..7dd2fa5b6 100644 --- a/lib/ronin/cli/commands/cert_dump.rb +++ b/lib/ronin/cli/commands/cert_dump.rb @@ -19,7 +19,7 @@ require 'ronin/cli/value_processor_command' require 'ronin/cli/host_and_port' require 'ronin/support/crypto/cert' -require 'ronin/support/network/ssl/mixin' +require 'ronin/support/network/ssl' require 'command_kit/printing/indent' require 'command_kit/printing/fields' @@ -59,7 +59,6 @@ module Commands # class CertDump < ValueProcessorCommand - include Support::Network::SSL::Mixin include CommandKit::Printing::Indent include CommandKit::Printing::Fields include CommandKit::Printing::Lists @@ -104,11 +103,11 @@ def process_value(value) when /\A[^:]+:\d+\z/ host, port = host_and_port(value) - print_cert(ssl_cert(host,port)) + grab_cert(host,port) when /\Ahttps:/ host, port = host_and_port_from_url(value) - print_cert(ssl_cert(host,port)) + grab_cert(host,port) else unless File.file?(value) print_error "no such file or directory: #{value}" @@ -121,6 +120,21 @@ def process_value(value) end end + # + # Gets the certs from the host and port, and then print it. + # + # @param [String] host + # + # @param [Integer] port + # + # @since 2.1.0 + # + def grab_cert(host,port) + cert = Support::Network::SSL.get_cert(host,port) + + print_cert(cert) + end + # # Prints the certificate. #