A simple Python-based remote desktop application inspired by AnyDesk. This project allows you to remotely view and control another machine's desktop over a secure WebSocket connection, using OpenCV for video streaming and pyautogui for remote control.
- Remote desktop video streaming (JPEG over WebSocket)
- Mouse and keyboard control of the remote machine
- Simple Tkinter-based launcher GUI for both client and server roles
- Encrypted communication using self-signed SSL certificates
- Python 3.7+
- pip
- OpenSSL (for generating self-signed certificates)
-
Clone the repository:
git clone https://github.com/DivSlayer/AnyDeskApp.git cd AnyDeskApp -
Install dependencies:
py -m venv venv #windows cd venv/scripts && activate && cd ../.. #ubuntu cd venv/bin && source activate && cd ../.. pip install -r requirements.txt
-
Generate SSL certificates: The server requires
cert.pemandkey.pemin the project directory. You can generate them using either OpenSSL or mkcert:Option 1: OpenSSL
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
Follow the prompts to fill in certificate details.
Option 2: mkcert mkcert is a simple tool for making locally-trusted development certificates. It is easier and avoids browser warnings for local development.
- Install mkcert (see mkcert installation instructions)
- Run the following commands in your project directory:
mkcert -install mkcert -key-file key.pem -cert-file cert.pem 127.0.0.1 ::1 localhost
- This will generate
cert.pemandkey.pemvalid for localhost and 127.0.0.1. - If you want to use a different IP (e.g., your LAN IP), add it to the command:
mkcert -key-file key.pem -cert-file cert.pem 127.0.0.1 ::1 localhost <your-ip>
- You can check your local IP in the GUI or with
ipconfig/ifconfig.
- This will generate
Run the launcher:
python gui.py- Select "Be Remote Machine" in the GUI.
- Optionally override the detected local IP and set the port (default: 8765).
- Click "Start Server". The server will start in the background.
- Select "Connect to Remote" in the GUI.
- Enter the server's IP and port.
- Click "Connect". A new window will open showing the remote desktop. Mouse and keyboard events will be sent to the remote machine.
- To disconnect, close the viewer window or use the GUI's disconnect option.
- To stop the server, close the terminal or kill the process.
gui.py— Tkinter-based launcher for both client and server rolesviewer.py— Client: connects to remote server, displays video, sends control eventsremote_machine.py— Server: streams desktop, receives and executes control eventsrequirements.txt— Python dependencies
- Security: This is a demo project. For real-world use, improve authentication and certificate handling.
- Platform: Tested on Windows. Some features (e.g., pyautogui, mss) may require additional setup on other OSes.
- Firewall: Ensure the chosen port is open on both client and server machines.
- If you see SSL errors, ensure
cert.pemandkey.pemare present and valid. - If the video window does not appear, check that the server is running and reachable.
- For issues with mouse/keyboard control, ensure the remote machine allows control and that pyautogui is installed.
See LICENSE.
