-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove.py
More file actions
37 lines (30 loc) · 830 Bytes
/
Copy pathmove.py
File metadata and controls
37 lines (30 loc) · 830 Bytes
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
import mouse
# import socket
# socket.
# while True:
# x, y = input().split(',')
# mouse.move(int(x), int(y), absolute=False)
#!/usr/bin/env python3
import socket
import time
HOST = '127.0.0.1' # Standard loopback interface address (localhost)
PORT = 65432 # Port to listen on (non-privileged ports are > 1023)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen()
print('listening..')
while True:
conn, addr = s.accept()
print('Connected by', addr)
print('Conn: ', conn)
while True:
data = conn.recv(1024)
if not data:
break
try:
x, y = str(data, 'ascii').split(',')
mouse.move(int(x), int(y), absolute=False, duration=0.01)
except:
pass
# conn.sendall(data)
print('finished\n')