Created
April 23, 2014 16:08
-
-
Save lmars/11221613 to your computer and use it in GitHub Desktop.
Strowger SSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "socket" | |
require "openssl" | |
puts OpenSSL::OPENSSL_VERSION | |
socket = TCPSocket.new("127.0.0.1", 8081) | |
ssl_version = ARGV[0].to_sym | |
ssl_context = OpenSSL::SSL::SSLContext.new | |
ssl_context.ssl_version = ssl_version | |
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context) | |
ssl_socket.sync_close = true | |
ssl_socket.connect | |
ssl_socket << "GET /keys HTTP/1.1\r\n" | |
ssl_socket << "Host: localhost\r\n" | |
ssl_socket << "Connection: close\r\n" | |
ssl_socket << "\r\n" | |
while line = ssl_socket.gets | |
puts line | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment