-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_connection_request_packet.py
58 lines (52 loc) · 1.48 KB
/
create_connection_request_packet.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
# OfflineFrame{
# version: 1,
# v1, 2{
# type: 1, #(CONNECTION_REQUEST)
# connection_request, 2{
# endpoint_id, 1: "ABCD",
# endpoint_name, 2: "My device",
# endpoint_info, 6: bytes, #those unknown bytes from BT name?
# nonce, 4: random 32bit int,
# medium_metadata, 7{
# supports_5_ghz, 1: true or false,
# bssid, 2: mac addr,
# ap_frequency, 6: Freq in MHz,
# ip_address, 3: ip in bytes,
# }
# mediums, 5 (repeated){
# #let's assume there's wifi_hotspot and bluetooth
# BLUETOOTH 2,
# WIFI_HOTSPOT 3
# },
# keep_alive_interval_millis, 8: ?
# keep_alive_timeout_millis, 9: ?
# }
# }
# }
import protobuf
import random
endpoint_id = "ABCD"
endpoint_name = "My device"
endpoint_info = "whatever"
offline_frame = {
1: 1, #V1
2: {
1: 1, #(CONNECTION_REQUEST)
2: {
1: endpoint_id,
2: endpoint_name,
6: endpoint_info,
4: random.getrandbits(32),
7: {
1: True,
2: "de:ad:be:ee:ee:ef",
6: 2450,
3: "127.0.0.1"
},
5: [2, 3],
8: 1000, #keep_alive_interval_millis
9: 10000 #keep_alive_timeout_millis
}
}
}
protobuf.getbinarypacket(offline_frame)