forked from Geonaute/WPA-ro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeBlue.py
91 lines (77 loc) · 2.08 KB
/
CodeBlue.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import sys, cb, time, console
console.set_color(0,0,1)
print """
_____ _ _____ _
| |___ _| |___| __ | |_ _ ___
| --| . | . | -_| __ -| | | | -_|
|_____|___|___|___|_____|_|___|___|
"""
console.set_color()
class codeBlue (object):
def did_update_state(self):
pass
def did_discover_peripheral(self, p):
self.peripheral = p
cb.connect_peripheral(p)
def did_connect_peripheral(self, p):
p.discover_services()
print ""
for i in range(4):
sys.stdout.write("\rSending Payload" + "." * i)
time.sleep(1)
time.sleep(2)
sys.stdout.write("\nDevice Status: ")
console.set_color(1,0,0)
console.set_font('Chalkduster',14)
sys.stdout.write("PWNED\n")
console.set_font()
console.set_color()
def did_fail_to_connect_peripheral(self, p, error):
print "Failed to connect."
cb.connect_peripheral(p)
def did_disconnect_peripheral(self, p, error):
print "Disconnected."
self.peripheral = None
def did_discover_services(self, p, error):
cb.get_state()
print "Name:", p.name
print "UUID:", p.uuid
if p.state == 0:
print "STAT: Disconnected"
if p.state == 1:
print "STAT: Connecting"
if p.state == 2:
print "STAT: Connected"
time.sleep(0.4)
print "AUTH:", cb.CH_PROP_AUTHENTICATED_SIGNED_WRITES
time.sleep(0.4)
print "Properties:", cb.CH_PROP_EXTENDED_PROPERTIES
time.sleep(0.4)
print "Indicate:", cb.CH_PROP_INDICATE
time.sleep(0.4)
print "Encryption:", cb.CH_PROP_NOTIFY_ENCRYPTION_REQUIRED
time.sleep(0.4)
print "Services:"
for s in p.services:
print "-" + str(s.uuid)
p.discover_characteristics(s)
def did_discover_characteristics(self, s, error):
print "Characteristics:"
for c in s.characteristics:
print "-" + str(c.uuid)
def did_write_value(self, c, error):
time.sleep(0.5)
def did_update_value(self, c, error):
time.sleep(0.5)
delegate = codeBlue()
for i in range(4):
sys.stdout.write("\rScanning For Devices" + "." * i)
time.sleep(1)
cb.set_central_delegate(delegate)
cb.scan_for_peripherals()
try:
while True: pass
except KeyboardInterrupt:
cb.reset()
cb.stop_scan()
sys.exit()