-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodules.py
41 lines (33 loc) · 1.08 KB
/
modules.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import socket
from PyQt5.QtCore import QThread, pyqtSignal
import socket
class InfectedDevice:
def __init__(self, method:str, name:str, ip:str, country:str, position:set, status:bool, last_online:str):
self.method = method
self.name = name
self.ip = ip
self.country = country
self.status = status
self.position = position
self.last_online = last_online
class Handle(QThread):
def __init__(self, socket:socket.socket):
super().__init__()
self.socket = socket
self.finish_signal = pyqtSignal()
def run(self):
while True:
cmd = self.socket.recv(1024).decode("utf-8")
def on_disconnect(self):
pass
class Server:
def __init__(self):
self.socket = socket.socket()
def run(self, port:str):
self.socket.bind("localhost", int(port))
self.socket.listen(1)
while True:
sock, adr = self.socket.accept()
handle = Handle(sock)
handle.finished.connect(handle.on_disconnect)
handle.start()