Created
June 22, 2011 12:41
-
-
Save mat813/1039994 to your computer and use it in GitHub Desktop.
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' | |
require 'net/ftp' | |
module Net | |
class FTPTLS < FTP | |
def login(user = "anonymous", passwd = nil, acct = nil) | |
@ctx = OpenSSL::SSL::SSLContext.new('SSLv3') | |
@ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
voidcmd("AUTH TLS") | |
@sock = OpenSSL::SSL::SSLSocket.new(@sock, @ctx) | |
@sock.connect | |
super(user, passwd, acct) | |
voidcmd("PBSZ 0") | |
voidcmd("PROT P") | |
end | |
def transfercmd(cmd, rest_offset = nil) | |
conn = super | |
conn = OpenSSL::SSL::SSLSocket.new(conn, @ctx) | |
conn.connect | |
return conn | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment