├── README.md ├── Screenshots ├── client.png ├── screen.md └── server.png ├── client.py └── server.py /README.md: -------------------------------------------------------------------------------- 1 | # Remote Desktop on Python 2 | > Description: 3 | >> The software is written in Python using various libraries such as: PyQt5, numpy, socket, threading. 4 | 5 | 6 | > What plans do you have for the future? 7 | >> It is planned to add various functions such as: mouse control, keyboard control, computer manipulation such as shutdown and reboot. 8 | # version 0.1.2: 9 | > What's new? 10 | >> Added continuous screen processing and sending it to the server 11 | 12 | > What is planned in the next versions? 13 | >> Adding a smoother picture. 14 | # Screens: 15 | CLIENT: 16 | 17 | ![CLIENT](Screenshots/client.png) 18 | 19 | SERVER: 20 | 21 | ![SERVER](Screenshots/server.png) 22 | -------------------------------------------------------------------------------- /Screenshots/client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArtemDav/Remote-Desktop-on-Python/dc248764be39442562c1fd1c667799ef451763d5/Screenshots/client.png -------------------------------------------------------------------------------- /Screenshots/screen.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Screenshots/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArtemDav/Remote-Desktop-on-Python/dc248764be39442562c1fd1c667799ef451763d5/Screenshots/server.png -------------------------------------------------------------------------------- /client.py: -------------------------------------------------------------------------------- 1 | """ 2 | <--------REMOTE DESKTOP--------> 3 | Created: Artem Davydov 4 | Coded: Artem Davydov 5 | Language: Python 6 | <------------------------------> 7 | """ 8 | 9 | # Socket 10 | import socket 11 | # Work with Image 12 | from PIL import ImageGrab 13 | import io 14 | import numpy as np 15 | from random import randint 16 | import pyautogui 17 | # Thread 18 | from threading import Thread 19 | # PyQt5 20 | import sys 21 | from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QLabel, QPushButton, QAction, QMessageBox, QLineEdit 22 | from PyQt5.QtGui import QPixmap 23 | from PyQt5.QtCore import QRect, Qt 24 | 25 | class Dekstop(QMainWindow): 26 | def __init__(self): 27 | super().__init__() 28 | self.initUI() 29 | 30 | def StartThread(self): 31 | self.start.start() 32 | 33 | def ChangeImage(self): 34 | try: 35 | if len(self.ip.text()) != 0 and len(self.port.text()): 36 | sock = socket.socket() 37 | sock.connect((self.ip.text(), int(self.port.text()))) 38 | while True: 39 | img = ImageGrab.grab() 40 | img_bytes = io.BytesIO() 41 | img.save(img_bytes, format='PNG') 42 | sock.send(img_bytes.getvalue()) 43 | sock.close() 44 | except: 45 | print("DISCONNECTED") 46 | 47 | def initUI(self): 48 | self.pixmap = QPixmap() 49 | self.label = QLabel(self) 50 | self.label.resize(self.width(), self.height()) 51 | self.setGeometry(QRect(pyautogui.size()[0] // 4, pyautogui.size()[1] // 4, 400, 90)) 52 | self.setFixedSize(self.width(), self.height()) 53 | self.setWindowTitle("[CLIENT] Remote Desktop: " + str(randint(99999, 999999))) 54 | self.start = Thread(target=self.ChangeImage, daemon=True) 55 | self.btn = QPushButton(self) 56 | self.btn.move(5, 55) 57 | self.btn.resize(390, 30) 58 | self.btn.setText("Start Demo") 59 | self.btn.clicked.connect(self.StartThread) 60 | self.ip = QLineEdit(self) 61 | self.ip.move(5, 5) 62 | self.ip.resize(390, 20) 63 | self.ip.setPlaceholderText("IP") 64 | self.port = QLineEdit(self) 65 | self.port.move(5, 30) 66 | self.port.resize(390, 20) 67 | self.port.setPlaceholderText("PORT") 68 | 69 | if __name__ == '__main__': 70 | app = QApplication(sys.argv) 71 | ex = Dekstop() 72 | ex.show() 73 | sys.exit(app.exec()) -------------------------------------------------------------------------------- /server.py: -------------------------------------------------------------------------------- 1 | import socket 2 | 3 | # Работа с пользователем 4 | from os import getlogin 5 | 6 | # Работа с изображение 7 | from PIL import Image 8 | import io 9 | import numpy as np 10 | from random import randint 11 | import pyautogui 12 | # Поток 13 | from threading import Thread 14 | # PyQt5 15 | import sys 16 | from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QLabel, QPushButton, QAction, QMessageBox 17 | from PyQt5.QtGui import QPixmap 18 | from PyQt5.QtCore import QRect, Qt 19 | 20 | 21 | print("[SERVER]: STARTED") 22 | sock = socket.socket() 23 | sock.bind(('localhost', 9091)) # Your Server 24 | sock.listen() 25 | conn, addr = sock.accept() 26 | 27 | class Dekstop(QMainWindow): 28 | def __init__(self): 29 | super().__init__() 30 | self.initUI() 31 | 32 | def ChangeImage(self): 33 | try: 34 | print("[SERVER]: CONNECTED: {0}!".format(addr[0])) 35 | while True: 36 | img_bytes = conn.recv(9999999) 37 | self.pixmap.loadFromData(img_bytes) 38 | self.label.setScaledContents(True) 39 | self.label.resize(self.width(), self.height()) 40 | self.label.setPixmap(self.pixmap) 41 | except ConnectionResetError: 42 | QMessageBox.about(self, "ERROR", "[SERVER]: The remote host forcibly terminated the existing connection!") 43 | conn.close() 44 | 45 | def initUI(self): 46 | self.pixmap = QPixmap() 47 | self.label = QLabel(self) 48 | self.label.resize(self.width(), self.height()) 49 | self.setGeometry(QRect(pyautogui.size()[0] // 4, pyautogui.size()[1] // 4, 800, 450)) 50 | self.setFixedSize(self.width(), self.height()) 51 | self.setWindowTitle("[SERVER] Remote Desktop: " + str(randint(99999, 999999))) 52 | self.start = Thread(target=self.ChangeImage, daemon=True) 53 | self.start.start() 54 | 55 | if __name__ == '__main__': 56 | app = QApplication(sys.argv) 57 | ex = Dekstop() 58 | ex.show() 59 | sys.exit(app.exec()) --------------------------------------------------------------------------------