Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save poppen/1330079 to your computer and use it in GitHub Desktop.

Select an option

Save poppen/1330079 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Usage: $0 URL CERT CERT_PASSWD
require 'net/https'
require 'open-uri'
uri = URI.parse(ARGV[0])
pkcs12 =
OpenSSL::PKCS12.new(File.read(ARGV[1]), ARGV[2] ? ARGV[2] : '')
session = Net::HTTP.new(uri.host, uri.port)
session.use_ssl = true
session.key = pkcs12.key
session.cert = pkcs12.certificate
res = session.get('/')
puts res.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment