Skip to content

Commit f11a098

Browse files
committed
updated apple ble and some refinments
1 parent fc53586 commit f11a098

21 files changed

Lines changed: 432 additions & 493 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,5 @@ homePwn/
139139
test/
140140
test2/
141141

142+
143+
utils/__MACOSX/

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ then
8686
fi
8787
echo "Installing python libraries..."
8888
# Install Python dependencies
89-
pip3 install --no-cache-dir -r ./requirements.txt -q &> /dev/null
90-
pip3 install --no-cache-dir -r ./modules/_requirements.txt -q &> /dev/null
89+
sudo pip3 install --no-cache-dir -r ./requirements.txt
90+
sudo pip3 install --no-cache-dir -r ./modules/_requirements.txt
9191

9292
echo "Done!"
9393

modules/ble/apple/adv-airpods.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def run(self):
4343
random = str(self.args.get("random", "False")).lower() == "true"
4444
interval = int(self.args.get("interval", 10))
4545
dev_id = int(self.args.get("ble_iface", 0))
46+
4647
if random:
4748
left_speaker, right_speaker, case = self.random_values()
4849
else:

modules/ble/apple/airdrop-leak.py

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
import time
1010
import hashlib
1111
from threading import Thread, Timer
12-
from utils.opendrop2.cli import AirDropCli
13-
from utils.opendrop2.server import get_devices
14-
12+
from utils.opendrop.base import AirDropBase
13+
from utils.hash_validator import check_hash
1514

1615
class HomeModule(Module):
1716

@@ -24,10 +23,10 @@ def __init__(self):
2423
"Author": "@lucferbux"}
2524

2625
options = {
27-
'interval': Option.create(name="inverval", value=3, description="Seconds to refresh"),
28-
"iface": Option.create(name="iface", value="wlan0", description="Wireless Interface to enable monitor mode"),
26+
"iface": Option.create(name="iface", value="wlan0", description="Wireless Interface to enable monitor mode")
2927
}
3028

29+
self.results = {}
3130
# Constructor of the parent class
3231
super(HomeModule, self).__init__(information, options)
3332

@@ -42,50 +41,56 @@ def __init__(self):
4241
# 8. if error kill owl -- sudo kill $(sudo ps -A | grep owl | awk '{print $1}')
4342
@is_root
4443
def run(self):
45-
iwdev = str(self.args.get("iface", "wlan0"))
46-
interval = int(self.args.get("interval", 3))
47-
44+
iface = str(self.args.get("iface", "wlan0"))
45+
4846
try:
49-
print_info("Configuring owl interface...")
50-
check_wifi_config(iwdev)
51-
time.sleep(1.5) # time to wake up owl process
47+
print("Configuring owl interface...")
48+
check_wifi_config(iface)
49+
time.sleep(5) # time to wake up owl process
5250
except ModeMonitorException:
53-
print_error("Error, mode monitor not suported in the given interface, press ctr+c to continue")
51+
print("Error, mode monitor not suported in the given interface, press ctr+c to continue")
5452
return
5553
except BadInterfaceException:
56-
print_error("Error, inteface not found, press ctr+c to continue")
54+
print("Error, inteface not found, press ctr+c to continue")
5755
return
5856
except OwlException:
59-
print_error("Error, there was a problem setting up owl, press ctr+c to continue, if not insalled --> https://github.com/seemoo-lab/owl.git")
57+
print("Error, there was a problem setting up owl, press ctr+c to continue, if not insalled --> https://github.com/seemoo-lab/owl.git")
6058
return
6159
except Exception as e:
62-
print_error(f"Error, something went wrong configuring the interface, press ctr+c to continue --> {e}")
60+
print(f"Error, something went wrong configuring the interface, press ctr+c to continue --> {e}")
6361
return
64-
65-
results = {}
66-
thread2 = Thread(target=self.start_listetninig, args=())
67-
thread2.daemon = True
68-
thread2.start()
69-
62+
7063
try:
71-
while True:
72-
time.sleep(interval)
73-
devs = get_devices()
74-
for dev in devs:
75-
hash = dev.get("hash", None)
76-
hash = hash.replace("\\x04)", "")
77-
hash = hash.replace("\\x00)", "")
78-
if(hash not in results.keys()):
79-
results.update({hash : dev})
80-
#print(f"Someone with phone number hash \033[92m{hash}\033[0m has tried to use AirDrop")
81-
print(f"Someone with phone number hash {hash} has tried to use AirDrop")
64+
self.start_listetninig()
8265
except:
8366
print("")
84-
print_error("Bye")
67+
print("Bye")
8568

86-
def start_listetninig(self):
87-
print_info("[*] Looking for AirDrop senders...")
88-
AirDropCli(["receive"])
69+
def get_people(self):
70+
return self.results
71+
72+
def start_listetninig(self, name="evil-drop", email="evilmail@gmail.com", phone="34666666666"):
73+
print("[*] Looking for AirDrop senders...")
74+
AirDropBase("receive", name=name, callback=self.process_devices, email=email, phone=phone)
8975

9076
def get_hash(self, data):
9177
return hashlib.sha256(data.encode('utf-8')).hexdigest()
78+
79+
def process_devices(self, device):
80+
hash = device.get("hash", None)
81+
hash = hash.replace("\\x04)", "")
82+
hash = hash.replace("\\x00)", "")
83+
if(hash not in self.results.keys()):
84+
self.results.update({hash : {}})
85+
print("found one...")
86+
try:
87+
phone = check_hash(hash)
88+
except Exception as e:
89+
print(e)
90+
phone = "None"
91+
if(phone != "None"):
92+
print(f"Someone with phone number {phone} and hash {hash} has tried to use AirDrop")
93+
print(self.results)
94+
else:
95+
print(f"Someone with hash {hash} has tried to use AirDrop")
96+

modules/ble/apple/ble-read-state.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ def run(self):
5454
ssid = str(self.args.get("ssid", "False")).lower() == "true"
5555
airdrop = str(self.args.get("airdrop", "False")).lower() == "true"
5656
ttl = int(self.args.get("ttl", 10))
57-
iwdev = str(self.args.get("iface", "wlan0"))
58-
dev_id = int(self.args.get("hci", 0))
59-
toggle_device(dev_id, True)
60-
self.pr = multiprocessing.Process(target=self.read_state,
61-
args=(ssid, airdrop, ttl, iwdev, dev_id))
62-
57+
w_iface = str(self.args.get("iface", "wlan0"))
58+
ble_iface = int(self.args.get("hci", 0))
6359

60+
toggle_device(ble_iface, True)
61+
62+
self.pr = multiprocessing.Process(target=self.read_state_cli,
63+
args=(ssid, airdrop, ttl, w_iface, ble_iface, False))
6464
try:
6565
self.pr.start()
6666
while True:
@@ -69,8 +69,9 @@ def run(self):
6969
self.pr.terminate()
7070
print(f"Killing {self.pr.pid}")
7171
os.kill(self.pr.pid, signal.SIGTERM)
72-
73-
def read_state(self, ssid, airdrop, ttl, iwdev, dev_id):
72+
73+
74+
def read_state_cli(self, ssid, airdrop, ttl, iwdev, dev_id, debug):
7475
"""Read the state of the nearby Apple ble devices
7576
7677
Args:
@@ -80,33 +81,26 @@ def read_state(self, ssid, airdrop, ttl, iwdev, dev_id):
8081
iwdev (str): Wifi interface
8182
dev_id (int): Bluetooth interface
8283
"""
83-
ble_utils = Ble_Apple_Utils(ssid, airdrop, ttl, iwdev, dev_id)
84+
ble_utils = Ble_Apple_Utils(ssid, airdrop, ttl, dev_id, debug)
8485
if airdrop:
8586
try:
86-
print_info("Configuring owl interface...")
87+
print("Configuring owl interface...")
8788
check_wifi_config(iwdev)
88-
sleep(1.5) # time to wake up owl process
89+
sleep(6) # time to wake up owl process
8990
except ModeMonitorException:
90-
print_error("Error, mode monitor not suported in the given interface, press ctr+c to continue")
91+
print("Error, mode monitor not suported in the given interface, press ctr+c to continue")
9192
return
9293
except BadInterfaceException:
93-
print_error("Error, inteface not found, press ctr+c to continue")
94+
print("Error, inteface not found, press ctr+c to continue")
9495
return
9596
except OwlException:
96-
print_error("Error, there was a problem setting up owl, press ctr+c to continue, if not insalled --> https://github.com/seemoo-lab/owl.git")
97+
print("Error, there was a problem setting up owl, press ctr+c to continue, if not insalled --> https://github.com/seemoo-lab/owl.git")
9798
return
9899
except Exception as e:
99-
print_error(f"Error, something went wrong configuring the interface, press ctr+c to continue --> {e}")
100+
print(f"Error, something went wrong configuring the interface, press ctr+c to continue --> {e}")
100101
return
101102

102-
103103
if ssid:
104-
thread_ssid = Thread(target=ble_utils.get_ssids, args=())
105-
thread_ssid.daemon = True
106-
thread_ssid.start()
107-
108-
109-
110104
thread2 = Thread(target=ble_utils.start_listetninig, args=())
111105
thread2.daemon = True
112106
thread2.start()

utildata/apple_ble_states.py

Lines changed: 65 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,70 @@
11
# Adapting script from https://github.com/hexway/apple_bleee
22
# Thanks to Dmitry Chastuhin @_chipik and https://hexway.io
33

4-
# not sure about 1b, 13, 0a, 1a, 17
5-
phone_states = {'0b': 'Home screen',
6-
'1c': 'Home screen',
7-
'1b': 'Home screen',
8-
'11': 'Home screen',
9-
'4b': 'Home screen/Airdrop',
10-
'03': 'Off',
11-
'18': 'Off',
12-
'09': 'Off',
13-
'13': 'Off',
14-
'0a': 'Off',
15-
'1a': 'Off',
16-
'01': 'Off',
17-
'07': 'Lock screen',
18-
'17': 'Lock screen',
19-
'4a': 'Lock screen',
20-
'0e': 'Calling',
21-
'1e': 'Calling',
22-
'5e': 'Calling',
23-
'5b': 'Home screen/Airdrop',
24-
'5a': 'Off',
25-
}
4+
airdrop_state_on = ['4b', '5b', '6b']
5+
dev_types = ["iPad", "iPhone", "MacBook", "AirPods", "Homepod", "Watch"]
6+
dev_sig = {'02010': 'MacBook', '02011': 'iPhone/iPad'}
7+
8+
9+
ble_packets_types = {
10+
'watch_c': '0b',
11+
'handoff': '0c',
12+
'wifi_set': '0d',
13+
'hotspot': '0e',
14+
'wifi_join': '0f',
15+
'nearby': '10',
16+
'airpods': '07',
17+
'airdrop': '05',
18+
}
19+
20+
os_types = {
21+
"10": 'iOS11',
22+
"le": 'iOS13',
23+
"la": 'iOS13',
24+
"0e": 'iOS13',
25+
"1e": 'iOS13',
26+
"04": 'iOS13',
27+
"1f": 'iOS13',
28+
"1a": 'iOS13',
29+
"0c": 'iOS13',
30+
"00": 'iOS10',
31+
"09": 'macOS',
32+
"14": 'macOS',
33+
"98": 'WatchOS'
34+
}
35+
36+
phone_states = {
37+
'0b': 'Home screen',
38+
'1c': 'Home screen',
39+
'2b': 'Home screen',
40+
'1b': 'Home screen',
41+
'11': 'Home screen',
42+
'6b': 'Home screen',
43+
'03': 'Off',
44+
'18': 'Off',
45+
'09': 'Off',
46+
'13': 'Off',
47+
'0a': 'Off',
48+
'1a': 'Off',
49+
'01': 'Off',
50+
'23': 'Off',
51+
'07': 'Lock screen',
52+
'27': 'Lock screen',
53+
'17': 'Lock screen',
54+
'4a': 'Lock screen',
55+
'57':'Lock screen',
56+
'67':'Lock screen',
57+
'47':'Lock screen',
58+
'0e': 'Calling',
59+
'1e': 'Calling',
60+
'5e': 'Calling',
61+
'4e':'Outgoing call',
62+
'4b': 'Home screen',
63+
'5b': 'Home screen',
64+
'5a': 'Off',
65+
'5e':'Incoming call',
66+
'6e': 'Incoming call',
67+
}
2668

2769
airpods_states = {
2870
'00': 'Case:Closed',
@@ -53,12 +95,6 @@
5395
'75': 'Case:open',
5496
}
5597

56-
dev_types = ["iPad", "iPhone", "MacOS", "AirPods"]
57-
58-
59-
dev_sig = {'02010': 'MacBook', '02011': 'iPhone/iPad'}
60-
61-
6298
devices_models = {
6399
"i386": "iPhone Simulator",
64100
"x86_64": "iPhone Simulator",
@@ -207,12 +243,4 @@
207243
"Watch4,4": "Apple Watch Series 4 44mm case (GPS+Cellular)",
208244
}
209245

210-
ble_packets_types = {'watch_c': '0b',
211-
'handoff': '0c',
212-
'wifi_set': '0d',
213-
'hotspot': '0e',
214-
'wifi_join': '0f',
215-
'nearby': '10',
216-
'airpods': '07',
217-
'airdrop': '05',
218-
}
246+

utildata/receive_discover_request.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<plist version="1.0">
55
<dict>
66
<key>Author</key>
7-
<integer>1231</integer>
7+
<integer>1</integer>
88
</dict>
9-
</plist>
9+
</plist>

0 commit comments

Comments
 (0)