Created
November 17, 2014 11:38
-
-
Save bararchy/52385ca871d98a7c1909 to your computer and use it in GitHub Desktop.
So...
This file contains hidden or 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 'ffi' | |
require 'socket' | |
module SSL_Client | |
extend FFI::Library | |
ffi_lib 'ssl' | |
attach_function :SSL_library_init, [], :int | |
attach_function :SSL_load_error_strings, [], :long | |
attach_function :SSLv3_client_method, [], :long | |
attach_function :SSL_CTX_new, [:long], :long | |
attach_function :SSL_new, [:long], :long | |
attach_function :SSL_set_fd, [:long, :long], :long | |
attach_function :SSL_connect, [:long], :int | |
end | |
SSL_Client.SSL_library_init | |
SSL_Client.SSL_load_error_strings | |
meth = SSL_Client.SSLv3_client_method | |
ctx = SSL_Client.SSL_CTX_new(meth) | |
ssl = SSL_Client.SSL_new(ctx) | |
sock = TCPSocket.new("192.168.0.4", 443) | |
SSL_Client.SSL_set_fd(ssl, sock.to_i) | |
err = SSL_Client.SSL_connect(ssl) | |
puts err |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment