-
Notifications
You must be signed in to change notification settings - Fork 21
/
filerelay_dump_UserDatabases.py
55 lines (45 loc) · 1.24 KB
/
filerelay_dump_UserDatabases.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
#!/usr/bin/env python
import os
import sys
import time
import plist
from imobiledevice import *
##
## modify from https://github.com/libimobiledevice/libimobiledevice/blob/master/dev/filerelaytest.c
##
# !! THIS DEMO ONLY WORKS ON iOS<=7.x
# on iOS8 com.apple.mobile.file_relay is no longer available: http://www.zdziarski.com/blog/?p=3820
def lockdown_get_service_client(service_class):
ld = LockdownClient(iDevice())
return ld.get_service_client(service_class)
def file_relay_get_UserDatabases():
filerelay = lockdown_get_service_client(FileRelayClient)
filerelay_sources = [
#"AppleSupport",
#"Network",
#"VPN",
#"WiFi",
"UserDatabases",
#"CrashReporter",
#"tmp",
#"SystemConfiguration"
]
conn = filerelay.request_sources(filerelay_sources)
sys.stdout.write("Dump to filerelay_dump.cpio.gz:\n")
with open("filerelay_dump.cpio.gz", "wb+") as dumpfile:
while (1):
try:
#data = conn.receive(4096)
data = conn.receive_timeout(4096, 10)
dumpfile.write(data)
sys.stdout.write(".")
except Exception, e:
if (e.code == -2): # no more data
break
# FileRelayError: Permission denied (-6) on iOS 8.x
raise e
print "Done"
def main():
file_relay_get_UserDatabases()
if __name__ == '__main__':
main()