Giter Club home page Giter Club logo

python-websocket-proxy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

python-websocket-proxy's Issues

Initiates websocket handshake, connects, send a messages then closes the connection and crashes and restarts the whole initiation

After adding the certificates to the browser it gets a bit further, but as soon as it tunnels a websocket messages it crashes and closes the connection:

py websocket_http_proxy.py
started https intercept proxy server at 127.0.0.1 (port 9999)
Initiating websocket handshake
127.0.0.1 - - [24/Jan/2024 16:26:28] "GET / HTTP/1.1" 101 -
127.0.0.1 - - [24/Jan/2024 16:26:28] websocket connected
127.0.0.1 - - [24/Jan/2024 16:26:28] Connecting to remote websocket wss://@@@@@@@@@@@/
127.0.0.1 - - [24/Jan/2024 16:26:28] Starting thread to forward server messages to the client
CLIENT: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Exception in thread Thread-9 (forward_to_client):
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1045, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
File "C:@@@@@@@@@@@\websocket_http_proxy.py", line 625, in forward_to_client
message = str(proxy_obj.remote_websocket.recv())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_core.py", line 388, in recv
opcode, data = self.recv_data()
^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_core.py", line 416, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_core.py", line 437, in recv_data_frame
frame = self.recv_frame()
^^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_core.py", line 478, in recv_frame
return self.frame_buffer.recv_frame()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_abnf.py", line 363, in recv_frame
self.recv_header()
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_abnf.py", line 319, in recv_header
header = self.recv_strict(2)
^^^^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_abnf.py", line 398, in recv_strict
bytes
= self.recv(min(16384, shortage))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_core.py", line 563, in _recv
return recv(self.sock, bufsize)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users@@@\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\websocket_socket.py", line 129, in recv
raise WebSocketConnectionClosedException("Connection to remote host was lost.")
websocket._exceptions.WebSocketConnectionClosedException: Connection to remote host was lost.

Is this something on my side, something else I'm missing or whats going on?

Project dead?

Is this project dead? I just get issues trying to run it:

Exception occurred during processing of request from ('127.0.0.1', 52432)
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\socketserver.py", line 691, in process_request_thread
self.finish_request(request, client_address)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\@@@@@\websocket_http_proxy.py", line 81, in init
BaseHTTPRequestHandler.init(self, *args, **kwargs)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\socketserver.py", line 755, in init
self.handle()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\http\server.py", line 436, in handle
self.handle_one_request()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\http\server.py", line 424, in handle_one_request
method()
File "C:\Users\@@@@@\websocket_http_proxy.py", line 85, in do_CONNECT
self.connect_intercept()
File "C:\Users\@@@@@\websocket_http_proxy.py", line 109, in connect_intercept
self.connection = ssl_settings.wrap_socket(self.connection, server_side=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 1108, in _create
self.do_handshake()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\ssl.py", line 1383, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_BAD_CERTIFICATE] sslv3 alert bad certificate (_ssl.c:1006)

Set up the certs just like setup_https_intercept.sh said, works without the certs but cant seem to intercept the websocket then.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.