Commit 3c2bbf06 by Szeberényi Imre

probababa

parent 4ab0c770
...@@ -6,7 +6,7 @@ from os import environ ...@@ -6,7 +6,7 @@ from os import environ
from twisted.internet import defer from twisted.internet import defer
from twisted.internet import protocol from twisted.internet import protocol
from twisted.internet.protocol import Factory, Protocol from twisted.internet.protocol import Factory, Protocol, ServerFactory
from twisted.internet import reactor from twisted.internet import reactor
from twisted.web.static import File from twisted.web.static import File
...@@ -78,6 +78,7 @@ class ProxyClientFactory(protocol.ReconnectingClientFactory): ...@@ -78,6 +78,7 @@ class ProxyClientFactory(protocol.ReconnectingClientFactory):
class VNCWebSocketHandler(Protocol): class VNCWebSocketHandler(Protocol):
def makeConnection(self, transport): def makeConnection(self, transport):
print("hoho")
try: try:
value = signing.loads(transport.request.args['d'][0], value = signing.loads(transport.request.args['d'][0],
key=PROXY_SECRET, max_age=KEY_MAX_AGE) key=PROXY_SECRET, max_age=KEY_MAX_AGE)
...@@ -123,9 +124,12 @@ class VNCWebSocketHandler(Protocol): ...@@ -123,9 +124,12 @@ class VNCWebSocketHandler(Protocol):
logger.info("Server(%s): disconnected", self.src) logger.info("Server(%s): disconnected", self.src)
class VNCWebSocketFactory(Factory): class VNCWebSocketFactory(ServerFactory):
protocol = VNCWebSocketHandler protocol = VNCWebSocketHandler
def buildprotocol(addr):
print(addr)
if __name__ == "__main__": if __name__ == "__main__":
parser = optparse.OptionParser() parser = optparse.OptionParser()
...@@ -133,8 +137,9 @@ if __name__ == "__main__": ...@@ -133,8 +137,9 @@ if __name__ == "__main__":
help="loglevel") help="loglevel")
opts, args = parser.parse_args() opts, args = parser.parse_args()
logging.basicConfig(level=opts.loglevel) logging.basicConfig(level=opts.loglevel)
print(lookupProtocolForFactory(VNCWebSocketFactory()))
resource = File('.') resource = File('.')
resource.putChild('vnc', WebSocketsResource( resource.putChild(b'vnc', WebSocketsResource(
lookupProtocolForFactory(VNCWebSocketFactory()))) lookupProtocolForFactory(VNCWebSocketFactory())))
reactor.listenTCP(9999, Site(resource)) reactor.listenTCP(9999, Site(resource))
reactor.run() reactor.run()
...@@ -2,4 +2,4 @@ cryptography==36.0.1 ...@@ -2,4 +2,4 @@ cryptography==36.0.1
Django==3.2.3 Django==3.2.3
Twisted==16.6.0 Twisted==16.6.0
pyOpenSSL==21.0.0 pyOpenSSL==21.0.0
service-identity
...@@ -365,6 +365,7 @@ class WebSocketsProtocol(Protocol): ...@@ -365,6 +365,7 @@ class WebSocketsProtocol(Protocol):
@since: 13.2 @since: 13.2
""" """
_buffer = None _buffer = None
print("BBBBB")
def __init__(self, receiver): def __init__(self, receiver):
self._receiver = receiver self._receiver = receiver
...@@ -382,6 +383,7 @@ class WebSocketsProtocol(Protocol): ...@@ -382,6 +383,7 @@ class WebSocketsProtocol(Protocol):
""" """
Find frames in incoming data and pass them to the underlying protocol. Find frames in incoming data and pass them to the underlying protocol.
""" """
for opcode, data, fin in _parseFrames(self._buffer): for opcode, data, fin in _parseFrames(self._buffer):
if opcode == CONTROLS.CLOSE: if opcode == CONTROLS.CLOSE:
# The other side wants us to close. # The other side wants us to close.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment