-
Notifications
You must be signed in to change notification settings - Fork 13
/
ufade_gui.py
executable file
·4264 lines (3993 loc) · 225 KB
/
ufade_gui.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# UFADE - Universal Forensic Apple Device Extractor (c) C.Peter 2024
# Licensed under GPLv3 License
import sys
import os
if sys.stdout is None:
sys.stdout = open(os.devnull, "w")
if sys.stderr is None:
sys.stderr = open(os.devnull, "w")
import customtkinter as ctk
from PIL import ImageTk, Image, ExifTags
from tkinter import StringVar
from pymobiledevice3 import usbmux, exceptions, lockdown
from pymobiledevice3.services.mobile_image_mounter import DeveloperDiskImageMounter, MobileImageMounterService, PersonalizedImageMounter
from pymobiledevice3.lockdown import create_using_usbmux, create_using_remote
from pymobiledevice3.lockdown import LockdownClient
from pymobiledevice3.services.companion import CompanionProxyService
from pymobiledevice3.services import installation_proxy
from pymobiledevice3.services.mobilebackup2 import Mobilebackup2Service
from pymobiledevice3.services.springboard import SpringBoardServicesService
from pymobiledevice3.services.afc import AfcService, LockdownService
from pymobiledevice3.services.house_arrest import HouseArrestService
from pymobiledevice3.services.crash_reports import CrashReportsManager
from pymobiledevice3.services.os_trace import OsTraceService
from pymobiledevice3.services.diagnostics import DiagnosticsService
from pymobiledevice3.services.dvt.instruments.device_info import DeviceInfo
from pymobiledevice3.services.dvt.instruments.screenshot import Screenshot
from pymobiledevice3.services.screenshot import ScreenshotService
from pymobiledevice3.services.dvt.dvt_secure_socket_proxy import DvtSecureSocketProxyService
from pymobiledevice3.services.accessibilityaudit import AccessibilityAudit, Direction
from pymobiledevice3.services.amfi import AmfiService
from pymobiledevice3.tcp_forwarder import UsbmuxTcpForwarder
from pymobiledevice3.services.pcapd import PcapdService
from pymobiledevice3.osu.os_utils import get_os_utils
from pymobiledevice3.remote.module_imports import MAX_IDLE_TIMEOUT, start_tunnel, verify_tunnel_imports
from pymobiledevice3.tunneld import TUNNELD_DEFAULT_ADDRESS, TunnelProtocol, TunneldRunner, get_tunneld_devices, get_rsds
from pymobiledevice3.cli.remote import cli_tunneld
from pymobiledevice3.services.os_trace import OsTraceService
from cryptography.hazmat.primitives.serialization.pkcs12 import load_pkcs12
from cryptography.hazmat.primitives.serialization import Encoding, NoEncryption, PrivateFormat, load_pem_public_key
from cryptography.hazmat.primitives.serialization.pkcs7 import PKCS7SignatureBuilder
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import hashes, serialization
from paramiko import SSHClient, AutoAddPolicy, Transport
from datetime import datetime, timedelta, timezone, date
from subprocess import Popen, PIPE, check_call, run
from pymobiledevice3 import exceptions
from importlib.metadata import version
from iOSbackup import iOSbackup
from pyiosbackup import Backup
from playsound import playsound
from io import BytesIO
import xml.etree.ElementTree as ET
from xml.dom import minidom
from pdfme import build_pdf
import mimetypes
import hashlib
import json
import plistlib
import posixpath
import pathlib
import numpy as np
import pandas as pd
import shutil
import tarfile
import zipfile
import threading
import platform
import time
import tempfile
import re
import exifread
import uuid
ctk.set_appearance_mode("dark") # Dark Mode
ctk.set_default_color_theme("dark-blue")
class MyApp(ctk.CTk):
def __init__(self):
super().__init__()
self.stop_event = threading.Event()
# Define Window
self.title(f"Universal Forensic Apple Device Extractor {u_version}")
self.geometry("1100x600")
self.resizable(False, False)
if platform.uname().system == "Darwin":
self.iconpath = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__), "assets" , "ufade.icns" ))
else:
self.iconpath = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__), "assets" , "ufade.png" ))
self.wm_iconbitmap()
self.iconphoto(False, self.iconpath)
# Font:
self.stfont = ctk.CTkFont("default")
self.stfont.configure(size=14)
# Create frames
self.left_frame = ctk.CTkFrame(self, width=340, corner_radius=0, fg_color="#2c353e", bg_color="#2c353e")
self.left_frame.grid(row=0, column=0, sticky="ns")
self.right_frame = ctk.CTkFrame(self, width=760, fg_color="#212121")
self.right_frame.grid(row=0, column=1, sticky="nsew")
self.grid_columnconfigure(1, weight=1)
# Widgets (left Frame))
if platform.uname().system == 'Windows':
self.info_text = ctk.CTkTextbox(self.left_frame, height=600, width=340, fg_color="#2c353e", corner_radius=0, font=("Consolas", 14), activate_scrollbars=False)
elif platform.uname().system == 'Darwin':
self.info_text = ctk.CTkTextbox(self.left_frame, height=600, width=340, fg_color="#2c353e", corner_radius=0, font=("Menlo", 14), activate_scrollbars=False)
else:
self.info_text = ctk.CTkTextbox(self.left_frame, height=600, width=340, fg_color="#2c353e", corner_radius=0, font=("monospace", 14), activate_scrollbars=False)
if lockdown != None:
self.info_text.configure(text_color="#abb3bd")
else:
self.info_text.configure(text_color="#4d5760")
self.info_text.insert("0.0", device)
self.info_text.configure(state="disabled")
self.info_text.pack(padx=10, pady=10)
# Initialize menu
self.menu_var = StringVar(value="MainMenu")
# Placeholder for dynamic frame
self.dynamic_frame = ctk.CTkFrame(self.right_frame, corner_radius=0, bg_color="#212121")
self.dynamic_frame.pack(fill="both", expand=True, padx=0, pady=0)
self.current_menu = None
# Show Main Menu
if lockdown != None:
if ispaired != False:
self.show_cwd()
else:
self.show_notpaired()
else:
self.show_nodevice()
def show_main_menu(self):
# Erase content of dynamic frame
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
global lockdown
lockdown = create_using_usbmux()
# Show Main Menu
self.menu_var.set("MainMenu")
self.current_menu = "MainMenu"
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Reporting Options", command=lambda: self.switch_menu("iReportMenu"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Acquisition Options", command=lambda: self.switch_menu("AcqMenu"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Logging Options", command=lambda: self.switch_menu("LogMenu"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Developer Options", command=lambda: self.switch_menu("CheckDev"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Advanced Options", command=lambda: self.switch_menu("AdvMenu"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Save informations about the device, installed apps,\nSIM and companion devices.",
"Allows logical, advanced logical and filesystem\nextractions.",
"Collect the AUL, Crash Logs, Sysdiagnose and Live Syslogs",
"Access developer mode for further options.\nMainly screenshotting options.",
"More specific options for data handling."]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=70, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
def switch_menu(self, menu_name):
# Erase content of dynamic frame
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
# Switch to chosen menu
self.current_menu = menu_name
if menu_name == "AcqMenu":
self.show_acq_menu()
if menu_name == "LogMenu":
self.show_log_menu()
elif menu_name == "DevMenu":
self.show_dev_menu()
elif menu_name == "CheckDev":
self.developer_options()
elif menu_name == "AdvMenu":
self.show_adv_menu()
elif menu_name == "WatchMenu":
self.show_watch_menu()
elif menu_name == "ReportMenu":
self.show_report_menu()
elif menu_name == "iReportMenu":
self.show_ireport_menu()
elif menu_name == "PDF":
self.show_pdf_report()
elif menu_name == "DevInfo":
self.show_save_device_info()
elif menu_name == "iTunes":
self.show_iTunes_bu()
elif menu_name == "advanced":
self.show_logicalplus()
elif menu_name == "advanced_ufed":
self.show_ufed()
elif menu_name == "ffs_jail":
self.perf_jailbreak_ssh_dump()
elif menu_name == "tess":
self.backup_tess()
elif menu_name == "sniff":
self.show_sniffer()
elif menu_name == "enc_off":
self.show_deactivate_encryption()
elif menu_name == "CollectUL":
self.show_collect_ul()
elif menu_name == "LiveSys":
self.show_capture_syslog()
elif menu_name == "CrashReport":
self.show_crash_report()
elif menu_name == "SysDiag":
self.show_sysdiag()
elif menu_name == "Media":
self.show_media()
elif menu_name == "FileLS":
dvt = DvtSecureSocketProxyService(lockdown)
dvt.__enter__()
self.show_fileloop(dvt)
elif menu_name == "Shot":
dvt = DvtSecureSocketProxyService(lockdown)
dvt.__enter__()
self.screen_device(dvt)
elif menu_name == "ChatLoop":
dvt = DvtSecureSocketProxyService(lockdown)
dvt.__enter__()
self.chat_shotloop(dvt)
elif menu_name == "Report":
self.show_report()
elif menu_name == "umount":
self.call_unmount()
elif menu_name == "NoDevice":
self.show_nodevice()
elif menu_name == "NotPaired":
self.show_notpaired()
# Watch Menu
def show_watch_menu(self):
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Reporting Options", command=lambda: self.switch_menu("ReportMenu"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Collect Unified Logs", command=lambda: self.switch_menu("CollectUL"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Extract crash reports", command=lambda: self.switch_menu("CrashReport"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Initiate Sysdiagnose", command=lambda: self.switch_menu("SysDiag"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Extract AFC Media files", command=lambda: self.switch_menu("Media"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Extract device informations and content.",
"Collects the AUL from the device and saves\nthem as a logarchive.",
"Pull the crash report folder from the device.",
"Create a Sysdiagnose archive on the device and\npull it to the disk afterwards.",
"Pull the \"Media\"-folder from the device\n(pictures, videos, recordings)"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=70, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
# Watch/TV Report Menu
def show_report_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Save device info", command=lambda: self.switch_menu("DevInfo"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Create PDF Report", command=lambda: self.switch_menu("PDF"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Create UFDR Report", command=lambda: self.switch_menu("Report"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Save informations about the device, installed apps,\nSIM and companion devices. (as .txt)",
"Create a printable PDF device report",
"Create a UFDR-Zip container viewable\nin the Cellebrite Reader application"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=70, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
ctk.CTkButton(self.dynamic_frame, text="Back", command=self.show_watch_menu).grid(row=r, column=1, padx=10, pady=10, sticky="e" )
#iPhone/iPad Report Menu
def show_ireport_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Save device info", command=lambda: self.switch_menu("DevInfo"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Create PDF Report", command=lambda: self.switch_menu("PDF"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Save informations about the device, installed apps,\nSIM and companion devices. (as .txt)",
"Create a printable PDF device report"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=70, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
ctk.CTkButton(self.dynamic_frame, text="Back", command=self.show_main_menu).grid(row=r, column=1, padx=10, pady=10, sticky="e" )
# Acquisition Menu
def show_acq_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Logical Backup", command=lambda: self.switch_menu("iTunes"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Logical+ Backup", command=lambda: self.switch_menu("advanced"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Logical+ Backup\n(UFED-Style)", command=lambda: self.switch_menu("advanced_ufed"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Filesystem Backup\n(jailbroken)", command=lambda: self.switch_menu("ffs_jail"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Perform a backup as iTunes would do it.",
"Perform and decrypt an iTunes backup, gather\nAFC-media files, shared App folders and crash reports.",
"Creates an advanced Logical Backup as ZIP with an\nUFD File for PA.",
"Creates a FFS Backup of an already jailbroken Device"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=70, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
ctk.CTkButton(self.dynamic_frame, text="Back", command=self.show_main_menu).grid(row=r, column=1, padx=10, pady=10, sticky="e" )
# Logging Options Menu
def show_log_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Collect Unified Logs", command=lambda: self.switch_menu("CollectUL"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Extract crash reports", command=lambda: self.switch_menu("CrashReport"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Initiate Sysdiagnose", command=lambda: self.switch_menu("SysDiag"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Capture Live Syslogs", command=lambda: self.switch_menu("LiveSys"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Collects the AUL from the device and saves\nthem as a logarchive.",
"Pull the crash report folder from the device.",
"Create a Sysdiagnose archive on the device and\npull it to the disk afterwards.",
"Capture the Live Syslogs from the device and\nwrite them to a textfile."]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=70, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
ctk.CTkButton(self.dynamic_frame, text="Back", command=self.show_main_menu).grid(row=r, column=1, padx=10, pady=10, sticky="e" )
# Developer Options Menu
def show_dev_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Take screenshots", command=lambda: self.switch_menu("Shot"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Chat capture", command=lambda: self.switch_menu("ChatLoop"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Capture filesystem\nto text", command=lambda: self.switch_menu("FileLS"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Unmount\nDeveloperDiskImage", command=lambda: self.switch_menu("umount"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Take screenshots from device screen.\nScreenshots will be saved under \"screenshots\" as PNG.",
"Loop through a chat taking screenshots.\nOne screenshot is taken per message.",
"Write a filesystem list to a textfile. (iOS < 16)\nStarting from /var Folder. This may take some time.",
"Try to unmount the image. Reboot the device if this fails"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=70, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
ctk.CTkButton(self.dynamic_frame, text="Back", command=self.show_main_menu).grid(row=r, column=1, padx=10, pady=10, sticky="e" )
# Advanced Options Menu
def show_adv_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont)
self.skip.grid(row=0, column=0, columnspan=2, sticky="w")
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="WhatsApp export\n(PuMA)", command=lambda: self.switch_menu("tess"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Sniff device traffic", command=lambda: self.switch_menu("sniff"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Extract AFC Media files", command=lambda: self.switch_menu("Media"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Remove UFADE Backup\nPassword", command=lambda: self.switch_menu("enc_off"), width=200, height=70, font=self.stfont)
]
self.menu_text = ["Perform an iTunes-style backup and extract Whatsapp\nfiles for PuMA (LE-tool).",
"Captures the device network traffic as a pcap file.",
"Pull the \"Media\"-folder from the device\n(pictures, videos, recordings)",
"Try to remove the encryption password set by UFADE"
]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=400, height=50, font=self.stfont, anchor="w", justify="left"))
r=1
i=0
for btn in self.menu_buttons:
btn.grid(row=r,column=0, padx=30, pady=10)
self.menu_textbox[i].grid(row=r,column=1, padx=10, pady=10)
self.menu_textbox[i].configure(text=self.menu_text[i])
r+=1
i+=1
ctk.CTkButton(self.dynamic_frame, text="Back", command=self.show_main_menu).grid(row=r, column=1, padx=10, pady=10, sticky="e" )
# No device is seen in the usbmux list:
def show_nodevice(self):
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
self.after(10)
global lockdown
global ispaired
lockdown = check_device()
try:
language = lockdown.language
ispaired = True
except:
ispaired = False
if lockdown == None:
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="center")
self.text = ctk.CTkLabel(self.dynamic_frame, width=400, height=250, font=self.stfont, anchor="w", justify="left")
self.text.configure(text="No device found!\n\n" +
"Make sure the device is connected and confirm \nthe \"trust\" message on the device screen.\n\n" +
"On a Windows-system, make sure \"Apple Devices\" \nor \"iTunes\" is installed.")
self.text.pack(pady=50)
ctk.CTkButton(self.dynamic_frame, text="Check again", command=self.show_nodevice).pack(pady=10)
self.info_text.configure(text_color="#4d5760")
else:
device = dev_data()
self.info_text.configure(state="normal")
self.info_text.delete("0.0", "end")
self.info_text.configure(text_color="#abb3bd")
self.info_text.insert("0.0", device)
self.info_text.configure(state="disabled")
if ispaired == True:
self.after(100, self.show_cwd)
else:
self.after(100, self.show_notpaired)
# A device is connected but not trusted
def show_notpaired(self):
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
self.after(10)
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="center")
self.text = ctk.CTkLabel(self.dynamic_frame, width=400, height=250, font=self.stfont, anchor="w", justify="left")
self.text.configure(text="Device not paired!\n\n" +
"Make sure the device is connected and confirm \nthe \"trust\" message on the device screen.\n\n" +
"Provide a supervision profile if needed.")
self.text.pack(pady=30)
global lockdown
global ispaired
try:
language = lockdown.language
ispaired = True
except:
ispaired = False
if ispaired == False:
ctk.CTkButton(self.dynamic_frame, text="Pair", command=self.pair_button).pack(pady=10)
ctk.CTkButton(self.dynamic_frame, text="Pair Supervised", fg_color="#2d2d35", command=self.show_supervised).pack(pady=10)
else:
lockdown = check_device()
device = dev_data()
self.info_text.configure(state="normal")
self.info_text.delete("0.0", "end")
self.info_text.configure(text_color="#abb3bd")
self.info_text.insert("0.0", device)
self.info_text.configure(state="disabled")
self.show_cwd()
# A device is connected but supervised
def show_supervised(self):
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
self.after(10)
global lockdown
global ispaired
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="center")
self.text = ctk.CTkLabel(self.dynamic_frame, width=400, height=40, font=self.stfont, anchor="w", justify="left")
self.text.configure(text="\n\n\n\n\n\nProvide the supervision certificate (P12/PKCS12) and the password.")
self.text.pack(pady=10)
self.browsebutton = ctk.CTkButton(self.dynamic_frame, text="Browse", font=self.stfont, command=lambda: self.browse_p12(self.p12box), width=40, fg_color="#2d2d35")
self.browsebutton.pack(side="bottom", pady=(0,410), padx=(0,525))
self.p12box = ctk.CTkEntry(self.dynamic_frame, width=340, height=20, corner_radius=0, placeholder_text=".p12 file")
self.p12box.bind(sequence="<Return>", command=lambda x: self.pair_supervised(self.text, self.p12box.get(), self.p12passbox.get()))
#self.p12box.insert(0, string=dir)
self.p12box.pack(side="left", pady=(90,0), padx=(75,0))
self.p12passbox = ctk.CTkEntry(self.dynamic_frame, width=120, height=20, corner_radius=0, placeholder_text="Password",show="*")
self.p12passbox.bind(sequence="<Return>", command=lambda x: self.pair_supervised(self.text, self.p12box.get(), self.p12passbox.get()))
#self.p12box.insert(0, string=dir)
self.p12passbox.pack(side="left", pady=(90,0), padx=(10,0))
self.okbutton = ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.pair_supervised(self.text, self.p12box.get(), self.p12passbox.get()))
self.okbutton.pack(side="left", pady=(90,0), padx=(10,120))
# Pair the supervised device
def pair_supervised(self, text, p12_file, password):
text.configure(text="\n\n\n\n\nChecking certificate and password.\nThis may take some time.")
text.update()
self.after(10)
global ispaired
global lockdown
self.browsebutton.pack_forget()
self.p12box.pack_forget()
self.p12passbox.pack_forget()
self.okbutton.pack_forget()
self.after(100)
if pathlib.Path(p12_file).is_file():
cert = keybag_from_p12(p12_file, password)
if cert != "error":
ispaired = False
while ispaired == False:
try:
lockdown.pair_supervised(cert)
ispaired = True
except:
pass
self.show_nodevice()
else:
text.configure(text="\n\n\n\n\n\nError loading certificate. Wrong password?")
ctk.CTkButton(self.dynamic_frame, text="OK", command=self.show_nodevice).pack(pady=50)
else:
text.configure(text="\n\n\n\n\n\nNo file selected!")
ctk.CTkButton(self.dynamic_frame, text="OK", command=self.show_nodevice).pack(pady=50)
# Select the working directory
def show_cwd(self):
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
global dir
if getattr(sys, 'frozen', False):
dir = os.path.join(os.path.expanduser('~'), "ufade_out")
else:
dir = os.getcwd()
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="center")
ctk.CTkLabel(self.dynamic_frame, text="Choose Output Directory:", height=30, width=585, font=("standard",24), justify="left").pack(pady=20)
self.browsebutton = ctk.CTkButton(self.dynamic_frame, text="Browse", font=self.stfont, command=lambda: self.browse_cwd(self.outputbox), width=60, fg_color="#2d2d35")
self.browsebutton.pack(side="bottom", pady=(0,410), padx=(0,415))
self.outputbox = ctk.CTkEntry(self.dynamic_frame, width=360, height=20, corner_radius=0, placeholder_text=[dir])
self.outputbox.bind(sequence="<Return>", command=lambda x: self.choose_cwd(self.outputbox))
self.outputbox.insert(0, string=dir)
self.outputbox.pack(side="left", pady=(110,0), padx=(130,0))
self.okbutton = ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.choose_cwd(self.outputbox))
self.okbutton.pack(side="left", pady=(110,0), padx=(10,120))
# Function to choose the working directoy
def choose_cwd(self, outputbox):
global dir
global dir_top
user_input = outputbox.get()
try:
if user_input == '':
user_input = '.'
os.chdir(user_input)
dir = os.getcwd()
pass
except:
os.mkdir(user_input)
os.chdir(user_input)
dir = os.getcwd()
if len(dir) > 48:
dir_top = f"{dir[:45]}..."
else:
dir_top = dir
if d_class == "Watch" or d_class == "AppleTV":
self.show_watch_menu()
else:
self.show_main_menu()
# Filebrowser for working direcory
def browse_cwd(self, outputbox):
global dir
olddir = dir
self.okbutton.configure(state="disabled")
outputbox.configure(state="disabled")
if platform.uname().system == 'Linux':
import crossfiledialog
dir = crossfiledialog.choose_folder()
if dir == "":
dir = olddir
else:
dir = ctk.filedialog.askdirectory()
if not dir:
dir = olddir
self.okbutton.configure(state="enabled")
outputbox.configure(state="normal")
outputbox.delete(0, "end")
outputbox.insert(0, string=dir)
# Filebrowser for p12 file
def browse_p12(self, p12box):
global p12_file
self.okbutton.configure(state="disabled")
p12box.configure(state="disabled")
if platform.uname().system == 'Linux':
import crossfiledialog
p12_file = crossfiledialog.open_file(filter="*.p12")
else:
p12_file = ctk.filedialog.askopenfilename(filetypes=[("PKCS12 files", ".p12")])
self.okbutton.configure(state="enabled")
p12box.configure(state="normal")
p12box.delete(0, "end")
if p12_file != "":
p12box.insert(0, string=p12_file)
else:
p12box.configure(placeholder_text=".p12 file")
# Save device info to file and show the available content
def show_save_device_info(self):
save_info()
text = "Device info saved to: \ndevice_" + udid + ".txt\n\nContains:\n- device information\n"
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
if number != "":
text = text + "- phone number\n"
if comp != []:
text = text + "- companion udid\n"
if all != "" and all != None:
text = text + "- SIM information\n"
if app_id_list != []:
text = text + "- app information"
self.text = ctk.CTkLabel(self.dynamic_frame, width=420, height=200, font=self.stfont, text=text, anchor="w", justify="left")
self.text.pack(pady=50)
if d_class == "Watch" or d_class == "AppleTV":
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=self.show_watch_menu).pack(pady=10)
else:
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=self.show_main_menu).pack(pady=10)
# Try to deactivate the UFADE encryption password
def show_deactivate_encryption(self):
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
ctk.CTkLabel(self.dynamic_frame, text="Deactivate Encryption Password", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Trying to deactivate the encryption password.\nProvide PIN/Password if prompted.", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(pady=25)
self.change = ctk.IntVar(self, 0)
remove_enc = threading.Thread(target=lambda: self.deactivate_encryption(change=self.change))
remove_enc.start()
self.wait_variable(self.change)
if self.change.get() == 1:
self.text.configure(text="Password removed.")
else:
self.text.configure(text="Something went wrong. Try again.")
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("AdvMenu")).pack(pady=10)
# Unified Logs Collecting screen
def show_collect_ul(self):
save_info()
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
ctk.CTkLabel(self.dynamic_frame, text="Collect Unified Logs", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Collecting Unified Logs will take some time.\ndo you want to continue?", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(pady=25)
self.choose = ctk.BooleanVar(self, False)
self.yesb = ctk.CTkButton(self.dynamic_frame, text="YES", font=self.stfont, command=lambda: self.choose.set(True))
self.yesb.pack(side="left", pady=(0,350), padx=140)
self.nob = ctk.CTkButton(self.dynamic_frame, text="NO", font=self.stfont, command=lambda: self.choose.set(False))
self.nob.pack(side="left", pady=(0,350))
self.wait_variable(self.choose)
if self.choose.get() == True:
self.yesb.pack_forget()
self.nob.pack_forget()
self.text.configure(text="Collecting Unified Logs from device.\nThis may take some time.")
self.progress = ctk.CTkProgressBar(self.dynamic_frame, width=585, height=30, corner_radius=0, mode="indeterminate", indeterminate_speed=0.5)
self.progress.pack()
self.progress.start()
self.waitul = ctk.IntVar(self, 0)
self.coll = threading.Thread(target=lambda: self.collect_ul(time=None, text=self.text, waitul=self.waitul))
self.coll.start()
self.wait_variable(self.waitul)
self.progress.stop()
self.progress.pack_forget()
if d_class == "Watch" or d_class == "AppleTV":
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=self.show_watch_menu).pack(pady=10)
else:
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("LogMenu")).pack(pady=10)
else:
if d_class == "Watch" or d_class == "AppleTV":
self.show_watch_menu()
else:
self.switch_menu("LogMenu")
# Live Syslog screen
def show_capture_syslog(self):
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
ctk.CTkLabel(self.dynamic_frame, text="Capture Live Syslogs", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Press “Start” to begin recording the syslogs.\n“Stop” pauses the recording.", width=585, height=70, font=self.stfont, anchor="w", justify="left")
self.text.pack(pady=25)
self.sysl = threading.Thread(target=lambda: self.capture_syslog(text=self.text, startb=self.startb, backb=self.backb))
self.startb = ctk.CTkButton(self.dynamic_frame, text="Start", font=self.stfont, command=lambda: self.sysl.start())
self.startb.pack(pady=20)
if d_class == "Watch" or d_class == "AppleTV":
self.backb = ctk.CTkButton(self.dynamic_frame, text="Back", font=self.stfont, command=self.show_watch_menu)
self.backb.pack(pady=10)
else:
self.backb = ctk.CTkButton(self.dynamic_frame, text="Back", font=self.stfont, command=lambda: self.switch_menu("LogMenu"))
self.backb.pack(pady=10)
# Crash Report extraction as single function or as part of a flow
def show_crash_report(self, cdir="Crash_Report", flow=False):
save_info()
if flow == False:
cdir = f'Crash_Logs_{udid}_{str(datetime.now().strftime("%Y_%m_%d_%H_%M_%S"))}'
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
ctk.CTkLabel(self.dynamic_frame, text="Extract Crash Reports", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Extracting crash reports from device.\nThis may take some time.", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(pady=25)
self.prog_text = ctk.CTkLabel(self.dynamic_frame, text="0%", width=585, height=20, font=self.stfont, anchor="w", justify="left")
self.prog_text.pack()
self.progress = ctk.CTkProgressBar(self.dynamic_frame, width=585, height=30, corner_radius=0)
self.progress.set(0)
self.progress.pack()
self.change = ctk.IntVar(self, 0)
if flow != False:
self.crash = threading.Thread(target=lambda: crash_report(crash_dir=cdir, change=self.change, progress=self.progress, prog_text=self.prog_text))
else:
self.crash = threading.Thread(target=lambda: crash_report(crash_dir=cdir, change=self.change, progress=self.progress, prog_text=self.prog_text, czip=True))
self.crash.start()
self.wait_variable(self.change)
self.progress.stop()
self.progress.pack_forget()
self.prog_text.pack_forget()
if flow == False:
self.text.configure(text="Extraction of crash reports completed!")
if d_class == "Watch" or d_class == "AppleTV":
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=self.show_watch_menu).pack(pady=10)
else:
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("LogMenu")).pack(pady=10)
else:
pass
def show_sysdiag(self):
ctk.CTkLabel(self.dynamic_frame, text=f"UFADE by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
ctk.CTkLabel(self.dynamic_frame, text="Extract Sysdiagnose", height=40, width=585, font=("standard",24), justify="left").pack(pady=15)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Initiate the creation of a Sysdiagnose archive on the device and save \nit to disk afterwards. This may take some time. \nDo you want to continue?", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(pady=60)
self.diagsrv = CrashReportsManager(lockdown)
self.choose = ctk.BooleanVar(self, False)
self.yesb = ctk.CTkButton(self.dynamic_frame, text="YES", font=self.stfont, command=lambda: self.choose.set(True))
self.yesb.pack(side="left", pady=(0,350), padx=140)
self.nob = ctk.CTkButton(self.dynamic_frame, text="NO", font=self.stfont, command=lambda: self.choose.set(False))
self.nob.pack(side="left", pady=(0,350))
self.wait_variable(self.choose)
if self.choose.get() == True:
self.yesb.pack_forget()
self.nob.pack_forget()
self.text.pack_forget()
if d_class == "Watch":
self.text.configure(text="To trigger the creation of the Sysdiagnose files,\npress: Power/Side + Digital Crown for 0.215 seconds.")
elif d_class == "AppleTV":
self.text.configure(text="To trigger the creation of the Sysdiagnose files,\npress: Play/Pause + Volume Down for 6 seconds on the remote.")
else:
self.text.configure(text="To trigger the creation of the Sysdiagnose files,\npress: Power/Side + VolUp + VolDown for 0.215 seconds.")
self.text.pack(pady=10)
if d_class == "Watch":
self.diag_image = ctk.CTkImage(dark_image=Image.open(os.path.join(os.path.dirname(__file__), "assets" , "diag_watch.png")), size=(600, 300))
elif d_class == "iPad":
self.diag_image = ctk.CTkImage(dark_image=Image.open(os.path.join(os.path.dirname(__file__), "assets" , "diag_ipad.png")), size=(600, 300))
elif d_class == "AppleTV":
self.diag_image = ctk.CTkImage(dark_image=Image.open(os.path.join(os.path.dirname(__file__), "assets" , "diag_tv.png")), size=(600, 300))
else:
self.diag_image = ctk.CTkImage(dark_image=Image.open(os.path.join(os.path.dirname(__file__), "assets" , "diag.png")), size=(600, 300))
self.diaglabel = ctk.CTkLabel(self.dynamic_frame, image=self.diag_image, text=" ", width=600, height=300, font=self.stfont, anchor="w", justify="left")
self.diaglabel.pack()
self.progress = ctk.CTkProgressBar(self.dynamic_frame, width=585, height=30, corner_radius=0, mode="indeterminate", indeterminate_speed=0.5)
self.waitsys = ctk.IntVar(self, 0)
self.diag = threading.Thread(target=lambda: self.sysdiag(self.text, self.progress, self.waitsys))
self.diag.start()
self.wait_variable(self.waitsys)
if d_class == "Watch" or d_class == "AppleTV":
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=self.show_watch_menu).pack(pady=10)
else:
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("LogMenu")).pack(pady=10)
else:
if d_class == "Watch" or d_class == "AppleTV":
self.show_watch_menu()
else:
self.switch_menu("LogMenu")
# Sysdiagnose creation screen
def sysdiag(self, text, progress, waitsys):
self.abort = ctk.CTkButton(self.dynamic_frame, text="Abort", font=self.stfont, command=self.abort_diag)
self.abort.pack(pady=15)
sysdiagname = None
try:
sysdiagname = self.diagsrv._get_new_sysdiagnose_filename()
self.abort.pack_forget()
self.diaglabel.pack_forget()
text.pack_forget()
text.configure(text="Creation of Sysdiagnose archive has been started.")
text.pack(pady=60)
progress.pack()
progress.start()
self.diagsrv._wait_for_sysdiagnose_to_finish()
text.configure(text="Pulling the Sysdiagnose archive from the device")
self.diagsrv.pull(out=f"{udid}_sysdiagnose.tar.gz", entry=sysdiagname,erase=True)
text.configure(text="Extraction of Sysdiagnose archive completed!")
log("Extracted Sysdiagnose file")
progress.pack_forget()
except:
text.configure(text="Extraction of Sysdiagnose canceled!")
log("Sysdiagnose extraction canceled")
self.diaglabel.pack_forget()
self.abort.pack_forget()
progress.pack_forget()
finally:
waitsys.set(1)
return
def abort_diag(self):
self.diagsrv.close()
# manually send a pair command and call "notpaired" again to check the status
def pair_button(self):
self.paired = ctk.BooleanVar(self, False)
self.pair = threading.Thread(target=lambda: pair_device(paired=self.paired))
self.pair.start()
self.wait_variable(self.paired)
self.show_notpaired()
def pair_super_button(self):
self.paired = ctk.BooleanVar(self, False)
self.pair = threading.Thread(target=lambda: pair_supervised_device(paired=self.paired))
self.pair.start()
self.wait_variable(self.paired)
self.show_notpaired()
# Play a notification sound
def notification(self):
playsound(os.path.join(os.path.dirname(__file__), "assets", "notification.mp3"))
# Unified logs collection function
def collect_ul(self, time, text, waitul):
try: os.mkdir("unified_logs")
except: pass
uname = f'{udid}_{datetime.now().strftime("%Y_%m_%d_%H_%M_%S")}.logarchive'
try:
OsTraceService(lockdown).collect(out= os.path.join("unified_logs", uname), start_time=time)
text.configure(text=f"Unified Logs written to:\n{uname}")
log(f"Collected Unified Logs as {uname}")
waitul.set(1)
except:
text.configure(text="Error: \nCoud not collect logs - Maybe the device or its iOS version is too old.")
log("Error collecting Unified Logs")
waitul.set(1)
try: os.rmdir("unified_logs")
except: pass
# Live Syslog function
def capture_syslog(self, text, startb, backb):
fname = f'{udid}_{datetime.now().strftime("%Y_%m_%d_%H_%M_%S")}_livelog.txt'
sysloglive = OsTraceService(lockdown)
#text.configure(height=200, wraplength=900, anchor="nw")
startb.configure(text="Stop", command=lambda: sysloglive.close())
backb.configure(state="disabled")
backb.pack_forget()
i=0
try:
with open(fname, 'a') as out:
for entry in sysloglive.syslog():
i=i+1
text.configure(text=f'{i} lines of Syslogs written')
out.write(f'{entry}\n')
except:
text.configure(text=f'{i} lines of Syslogs written to:\n{fname}')
log(f'{i} lines of Syslogs written to: {fname}')
startb.pack_forget()
backb.configure(state="normal")
backb.pack(pady=20)
# Call the iTunes Backup
def show_iTunes_bu(self):
self.perf_iTunes_bu("iTunes")
# Call the advanced Backup in UFADE-Mode
def show_logicalplus(self):
self.perf_logical_plus("UFADE")
# Call the advanced Backup in UFED-Mode
def show_ufed(self):
self.perf_logical_plus("UFED")
# Check, if the device has a backup password and set one
def check_encryption(self, change):
try:
UFADEMobilebackup2Service(lockdown).change_password(new="12345")
change.set(1)
except Exception as e:
e = str(e)
print(e)
if "device is locked" in e:
change.set(3)
else:
change.set(2)
# Try to deactivate encryption after the Backup is complete
def deactivate_encryption(self, change, text=None):
global bu_pass
try:
if bu_pass != "12345":
UFADEMobilebackup2Service(lockdown).change_password(old="12345", new=bu_pass)
else:
UFADEMobilebackup2Service(lockdown).change_password(old="12345")
change.set(1)
except:
change.set(2)
if text != None:
text.configure(text="Backup password got removed.\nBackup complete.")
else:
pass
# Progress output for iTunes Backup
def show_process(self,x, progress, text, change, beep_timer, setext):
beep_timer.cancel()
setext.configure(text="Backup in progress.\nDo not disconnect the device.")
proc = x / 100
progress.set(proc)
text.configure(text=f"{int(x)}%")
progress.update()
text.update()
#if x == 100:
# change.set(1)
# Check for Backup function to complete
def schedule_check(self, t, change):
self.after(1000, lambda: self.check_if_done(t,change))
def check_if_done(self, t, change):
# If the thread has finished, re-enable the button and show a message.
if not t.is_alive():
self.change.set(1)
else:
self.schedule_check(t, change)
# Start a thread for the known password flow
def call_known_pw(self, passwordbox, pw_found, okbutton, abort, text):
known = threading.Thread(target=lambda: self.password_known(passwordbox, pw_found, okbutton, abort, text))
known.start()
# Function to check the possibly known backup-password
def password_known(self, passwordbox, pw_found, okbutton, abort, text):
pw=passwordbox.get()
global bu_pass
try:
okbutton.configure(state="disabled")
text.configure(text="Checking password...")
UFADEMobilebackup2Service(lockdown).change_password(old=pw, new="12345") #Try to deactivate backup encryption with the given password
bu_pass = pw
passwordbox.pack_forget()
okbutton.pack_forget()
abort.pack_forget()
text.configure(text=f"Backup password: 12345 \nStarting Backup.\nUnlock device with PIN/PW")
log(f"Provided correct backup password: {pw}")
pw_found.set(1)
except:
text.configure(text="Wrong password.\nProvide the correct backup password:\n(UFADE sets this to \"12345\")")