Skip to content

Commit

Permalink
Added support for TOR hidden services (.onion addresses) per NVDARemo…
Browse files Browse the repository at this point in the history
  • Loading branch information
ctoth committed Jan 12, 2025
1 parent 79c5695 commit 90471a6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/remoteClient/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,20 +395,22 @@ def createOutboundSocket(
Note:
The socket is created but not yet connected. Call connect() separately.
"""
address = socket.getaddrinfo(host, port)[0]
serverSock = socket.socket(*address[:3])
if host.lower().endswith(".onion"):
serverSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
else:
address = socket.getaddrinfo(host, port)[0]
serverSock = socket.socket(*address[:3])
if self.timeout:
serverSock.settimeout(self.timeout)
serverSock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
serverSock.ioctl(socket.SIO_KEEPALIVE_VALS, (1, 60000, 2000))
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
if insecure:
ctx.verify_mode = ssl.CERT_NONE
log.warn("Skipping certificate verification for %s:%d", host, port)
ctx.check_hostname = not insecure
ctx.load_default_certs()

if insecure:
log.warn("Skipping certificate verification for %s:%d", host, port)
serverSock = ctx.wrap_socket(sock=serverSock, server_hostname=host)
return serverSock

Expand Down

0 comments on commit 90471a6

Please sign in to comment.