Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
vncproxy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3c2bbf06
authored
Feb 02, 2022
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
probababa
parent
4ab0c770
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
proxy.py
+8
-3
requirements/base.txt
+1
-1
websockets.py
+2
-0
No files found.
proxy.py
View file @
3c2bbf06
...
...
@@ -6,7 +6,7 @@ from os import environ
from
twisted.internet
import
defer
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.web.static
import
File
...
...
@@ -78,6 +78,7 @@ class ProxyClientFactory(protocol.ReconnectingClientFactory):
class
VNCWebSocketHandler
(
Protocol
):
def
makeConnection
(
self
,
transport
):
print
(
"hoho"
)
try
:
value
=
signing
.
loads
(
transport
.
request
.
args
[
'd'
][
0
],
key
=
PROXY_SECRET
,
max_age
=
KEY_MAX_AGE
)
...
...
@@ -123,9 +124,12 @@ class VNCWebSocketHandler(Protocol):
logger
.
info
(
"Server(
%
s): disconnected"
,
self
.
src
)
class
VNCWebSocketFactory
(
Factory
):
class
VNCWebSocketFactory
(
Server
Factory
):
protocol
=
VNCWebSocketHandler
def
buildprotocol
(
addr
):
print
(
addr
)
if
__name__
==
"__main__"
:
parser
=
optparse
.
OptionParser
()
...
...
@@ -133,8 +137,9 @@ if __name__ == "__main__":
help
=
"loglevel"
)
opts
,
args
=
parser
.
parse_args
()
logging
.
basicConfig
(
level
=
opts
.
loglevel
)
print
(
lookupProtocolForFactory
(
VNCWebSocketFactory
()))
resource
=
File
(
'.'
)
resource
.
putChild
(
'vnc'
,
WebSocketsResource
(
resource
.
putChild
(
b
'vnc'
,
WebSocketsResource
(
lookupProtocolForFactory
(
VNCWebSocketFactory
())))
reactor
.
listenTCP
(
9999
,
Site
(
resource
))
reactor
.
run
()
requirements/base.txt
View file @
3c2bbf06
...
...
@@ -2,4 +2,4 @@ cryptography==36.0.1
Django==3.2.3
Twisted==16.6.0
pyOpenSSL==21.0.0
service-identity
websockets.py
View file @
3c2bbf06
...
...
@@ -365,6 +365,7 @@ class WebSocketsProtocol(Protocol):
@since: 13.2
"""
_buffer
=
None
print
(
"BBBBB"
)
def
__init__
(
self
,
receiver
):
self
.
_receiver
=
receiver
...
...
@@ -382,6 +383,7 @@ class WebSocketsProtocol(Protocol):
"""
Find frames in incoming data and pass them to the underlying protocol.
"""
for
opcode
,
data
,
fin
in
_parseFrames
(
self
.
_buffer
):
if
opcode
==
CONTROLS
.
CLOSE
:
# The other side wants us to close.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment