-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver-emulator.py
executable file
·76 lines (71 loc) · 1.22 KB
/
server-emulator.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
from websocket import create_connection
import time
room_list_packet = [
0xEF, # 0
0xBE, # 1
0xED, # 2
0xFE, # 3
0x5E, # 4
0x00, # 5
0x00, # 6
0x00, # 7
0x00, # 8
0x0F, # 9
0x00, # 10
0x00, # 11
0x80, # 12
0x0C, # 13
0x00, # 14
0x00, # 15
0x00, # 16
0x1F, # 17
0x05, # 18
0x00, # 19
0x01, # 20
0x00, # 21
0x00, # 22
0x01, # 23
0x03, # 24
]
room_wave_packet = [
0xEF, # 0
0xBE, # 1
0xED, # 2
0xFE, # 3
0x00, # 4
0x00, # 5
0x00, # 6
0x00, # 7
0x00, # 8
0x00, # 9
0x00, # 10
0x00, # 11
0x80, # 12
0x00, # 13
0x00, # 14
0x00, # 15
0x00, # 16
0xDA, # 17
0x02, # 18
0x00, # 19
0xAA, # 20
0xBB, # 21
]
ws = create_connection(
"ws://localhost:7575/server?client_id=00000000-0000-0000-0000-000000000000",
timeout=1,
)
print("SENDING: Room List")
ws.send_binary(room_list_packet)
print("SENT")
try:
while True:
time.sleep(0.01)
ws.settimeout(1)
ws.send_binary(room_wave_packet)
ws.ping("")
print("PING")
except:
print("EXITING")
ws.close()