This commit is contained in:
xyj 2024-03-09 15:10:58 +08:00
parent 2fe0520557
commit e948a14409
2 changed files with 23 additions and 7 deletions

Binary file not shown.

30
main.py
View File

@ -15,6 +15,22 @@ def click_it(x, y):
def is_black(black):
for v in black_list:
if dict_equal(v, black):
return True
return False
def dict_equal(dict1, dict2):
if len(dict2) != len(dict1):
return False
for k, v1 in dict1.items():
v2 = dict2.get(k)
if v1 != v2:
return False
if k == "Point":
if len(v1[0]) != len(v2[0]):
return False
return True
@ -39,19 +55,19 @@ def handle_client(client_socket):
data = data.decode("utf-8")
data = json.loads(data)
print(data)
for v in black_list:
if is_black(v):
print("黑名单")
client_socket.send(b"ACK!")
client_socket.close()
return
if is_black(data):
print("黑名单")
client_socket.send(b"ACK!")
client_socket.close()
return
Point = data["Point"]
x = Point[0]["X"]
y = Point[0]["Y"]
print(x, y)
click_it(x, y)
except Exception as e:
pass
client_socket.send(b"ACK!")
client_socket.close()
# 等待连接,这里必定进入循环