File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 77import asyncio
88import datetime
99import typing
10- import ssl
10+ import socket
1111
12- from OpenSSL import crypto
12+ from OpenSSL import SSL , crypto
1313from twisted .internet import reactor
1414from twisted .internet .protocol import Protocol
1515
@@ -228,10 +228,12 @@ def doClientTls(self):
228228 "port" : self .state .config .targetPort ,
229229 },
230230 )
231- pem = ssl .get_server_certificate (
232- (self .state .config .targetHost , self .state .config .targetPort )
233- )
234- cert = crypto .load_certificate (crypto .FILETYPE_PEM , pem )
231+ # Use context from pyrdp
232+ context = ClientTLSContext ().getContext ()
233+ connection = SSL .Connection (context , socket .socket (socket .AF_INET , socket .SOCK_STREAM ))
234+ connection .connect ((self .state .config .targetHost , self .state .config .targetPort ))
235+ connection .do_handshake ()
236+ cert = connection .get_peer_certificate ()
235237 else :
236238 cert = self .server .tcp .transport .getPeerCertificate ()
237239 if not cert :
You can’t perform that action at this time.
0 commit comments