-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathalex.py
More file actions
executable file
·4638 lines (4337 loc) · 231 KB
/
alex.py
File metadata and controls
executable file
·4638 lines (4337 loc) · 231 KB
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
# ALEX - Android Logical Extractor (c) C.Peter 2025
# Licensed under GPLv3 License
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
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, ImageDraw, ImageFont
import tkinter.ttk as ttk
import tkinter as tk
from datetime import datetime, timedelta, timezone, date
from tkinter import StringVar
from importlib.metadata import version
from adbutils._utils import append_path
from io import BytesIO
from pathlib import Path
from pdfme import build_pdf
import alex.ufed_style as ufed_style
import alex.devdump as devdump
import alex.wifi_adb as wifi_adb
import alex.exploits as exploits
import alex.shot_ut as shot_ut
import alex.ab_decrypt as ab_decrypt
import alex.case_uco as case_uco
import numpy as np
import uiautomator2 as u2
import ipaddress
import sqlite3
import shutil
import json
import queue
import zipfile
import tarfile
import hashlib
import imagehash
import tempfile
import threading
import adbutils
import subprocess
import platform
import socket
import select
import stat
import time
import typing
import pathlib
import re
import io
ctk.set_appearance_mode("dark") # Dark Mode
ctk.set_default_color_theme(os.path.join(os.path.dirname(__file__), "assets" , "alex_theme.json" ))
ctk.set_window_scaling(1.0)
ctk.set_widget_scaling(1.0)
class MyApp(ctk.CTk):
def __init__(self):
super().__init__()
self.stop_event = threading.Event()
if getattr(sys, 'frozen', False):
self.report_callback_exception = self.global_exception_handler
threading.excepthook = lambda args: self.global_exception_handler(args.exc_type, args.exc_value, args.exc_traceback)
sys.excepthook = lambda exc_type, exc_value, exc_traceback: self.global_exception_handler(exc_type, exc_value, exc_traceback)
# Define Window
self.title(f"Android Logical Extractor {a_version}")
self.geometry(f"{resx}x{resy}")
self.resizable(False, False)
if platform.uname().system == "Darwin":
self.iconpath = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__), "assets" , "alex.icns" ))
else:
self.iconpath = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__), "assets" , "alex.png" ))
self.wm_iconbitmap()
self.iconphoto(False, self.iconpath)
# Create frames
self.left_frame = ctk.CTkFrame(self, width=leftx, corner_radius=0, fg_color="#2E2E2E", bg_color="#2E2E2E")
self.left_frame.grid(row=0, column=0, sticky="ns")
self.right_frame = ctk.CTkFrame(self, width=rightx, fg_color="#212121")
self.right_frame.grid(row=0, column=1, sticky="nsew")
self.grid_columnconfigure(1, weight=1)
# Font:
ctk.FontManager.load_font(os.path.join(os.path.dirname(__file__), "assets" , "NotoSansMono-UFADE.ttf" ))
ctk.FontManager.load_font(os.path.join(os.path.dirname(__file__), "assets" , "NotoSans-Medium.ttf" ))
if platform.uname().system == 'Windows':
self.stfont = ctk.CTkFont("Noto Sans Medium")
self.monofont = ctk.CTkFont("Noto Sans Mono UFADE")
self.monofont.configure(size=fsize)
else:
self.stfont = ctk.CTkFont("default")
self.stfont.configure(size=fsize)
style = ttk.Style()
style.theme_use("clam")
# Create frames
self.left_frame = ctk.CTkFrame(self, width=leftx, corner_radius=0, fg_color="#2E2E2E", bg_color="#2E2E2E")
self.left_frame.grid(row=0, column=0, sticky="ns")
self.right_frame = ctk.CTkFrame(self, width=rightx, 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=resy, width=leftx, fg_color="#2E2E2E", corner_radius=0, font=self.monofont, activate_scrollbars=False)
elif platform.uname().system == 'Darwin':
self.info_text = ctk.CTkTextbox(self.left_frame, height=resy, width=leftx, fg_color="#2E2E2E", corner_radius=0, font=("Menlo", fsize), activate_scrollbars=False)
else:
self.info_text = ctk.CTkTextbox(self.left_frame, height=resy, width=leftx, fg_color="#2E2E2E", corner_radius=0, font=("monospace", fsize), activate_scrollbars=False)
if state != None:
self.info_text.configure(text_color="#abb3bd")
else:
self.info_text.configure(text_color="#4d4d4d")
self.info_text.insert("0.0", device_info)
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
ctk.CTkLabel(self.dynamic_frame, text="ALEX 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, text="Checking adb and device connection ...", anchor="w", justify="left")
#self.after(2000)
#self.init_device = threading.Thread(target=self.show_noadbserver())
#self.init_device.start()
self.show_noadbserver()
self.protocol("WM_DELETE_WINDOW", self.on_close)
def on_close(self):
self.destroy()
os._exit(0)
def show_main_menu(self):
# Erase content of dynamic frame
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
global device
get_client(check=True)
if device != None:
pass
else:
self.after(20)
self.show_noadbserver()
return()
# Show Main Menu
self.menu_var.set("MainMenu")
self.current_menu = "MainMenu"
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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")
if ut == True or aos == True:
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="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, state="disabled"),
ctk.CTkButton(self.dynamic_frame, text="Advanced Options", command=lambda: self.switch_menu("AdvMenu"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Exploit Options", command=lambda: self.switch_menu("Exploits"), width=200, height=70, font=self.stfont, state="disabled"),
]
elif recovery == True:
if rec_root == False:
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="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, state="disabled"),
ctk.CTkButton(self.dynamic_frame, text="Advanced Options", command=lambda: self.switch_menu("AdvMenu"), width=200, height=70, font=self.stfont, state="disabled"),
ctk.CTkButton(self.dynamic_frame, text="Exploit Options", command=lambda: self.switch_menu("Exploits"), width=200, height=70, font=self.stfont, state="disabled"),
]
else:
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="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, state="disabled"),
ctk.CTkButton(self.dynamic_frame, text="Advanced Options", command=lambda: self.switch_menu("AdvMenu"), width=200, height=70, font=self.stfont, state="disabled"),
ctk.CTkButton(self.dynamic_frame, text="Exploit Options", command=lambda: self.switch_menu("Exploits"), width=200, height=70, font=self.stfont, state="disabled"),
]
else:
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="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="Advanced Options", command=lambda: self.switch_menu("AdvMenu"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Exploit Options", command=lambda: self.switch_menu("Exploits"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Save information about the device and installed apps.",
"Allows logical, advanced logical and filesystem\nextractions.",
"Collect the Bugreport, dumpsys and logcat logs",
"More specific options like screenshotting.",
"Access to implemented exploit methods,"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=right_content, 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
# Print out exception
def global_exception_handler(self, type, value, tb):
try:
if self.text.winfo_ismapped():
self.text.configure(text=f"Uh-Oh, An error was raised! Check the file:\nufade_log_{udid}.log")
else:
self.text = ctk.CTkLabel(self.dynamic_frame, width=400, height=180, font=self.stfont, anchor="w", justify="left")
self.text.configure(text=f"Error: {value}")
self.text.pack(pady=50)
except:
self.text = ctk.CTkLabel(self.dynamic_frame, width=400, height=180, font=self.stfont, anchor="w", justify="left")
self.text.configure(text=f"Error: {value}")
self.text.pack(pady=50)
log(f"Error: {value}")
def switch_menu(self, menu_name, **kwargs):
# 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 == "ReportMenu":
self.show_report_menu()
elif menu_name == "AcqMenu":
self.show_acquisition_menu()
elif menu_name == "LogMenu":
self.show_log_menu()
elif menu_name == "AdvMenu":
self.show_advanced_menu()
elif menu_name == "PDF":
self.show_pdf_report()
elif menu_name == "DevInfo":
self.show_save_device_info()
elif menu_name == "PullData":
self.show_pull_data()
elif menu_name == "AdvUFED":
self.show_ufed_bu()
elif menu_name == "PRFS":
self.show_prfs()
elif menu_name == "ADBBU":
self.show_adb_bu()
elif menu_name == "LogDump":
self.show_logcat_dump()
elif menu_name == "LogLive":
self.show_logcat_live()
elif menu_name == "Dumpsys":
self.show_dumpsys_dump()
elif menu_name == "AppOps":
self.show_app_ops()
elif menu_name == "ScreenDevice":
self.screen_device()
elif menu_name == "ShotLoop":
self.chat_shotloop()
elif menu_name == "FindAgent":
self.show_find_agent()
elif menu_name == "BugReport":
self.show_bugreport()
elif menu_name == "Content":
self.show_content_dump()
elif menu_name == "CheckRoot":
self.show_check_root()
elif menu_name == "RootAcq":
self.show_root_acq_menu()
elif menu_name == "RootFFS":
self.show_root_ffs()
elif menu_name == "TarRootFFS":
self.show_root_tar_ffs()
elif menu_name == "Exploits":
self.show_exploit_menu()
elif menu_name == "2020_0069":
self.show_2020_0069()
elif menu_name == "2024_31317":
self.show_2024_31317()
elif menu_name == "2024_0044":
self.show_2024_0044()
#UT Options:
elif menu_name == "Physical":
self.show_physical()
# Function to check for adb-binary and device:
def show_noadbserver(self):
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
ctk.CTkLabel(self.dynamic_frame, text="ALEX 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=220, font=self.stfont, anchor="w", justify="left")
start_error = False
global device
global adb
global paired
if device == None:
itext = ("Please wait ...\n" +
"\n" + '{:13}'.format("Python: ") + "\t" + platform.python_version() +
"\n" + '{:13}'.format("adbutils: ") + "\t" + version('adbutils') +
"\n\n" +
" 54 68 65 20 52 6f 61 64 20 67 6f \n" +
" 65 73 20 65 76 65 72 20 6f 6e 20 \n" +
" 61 6e 64 20 6f 6e 0a 44 6f 77 6e \n" +
" 20 66 72 6f 6d 20 74 68 65 20 64 \n" +
" 6f 6f 72 20 77 68 65 72 65 20 69 \n" +
" 74 20 62 65 67 61 6e 2e 0a 4e 6f \n" +
" 77 20 66 61 72 20 61 68 65 61 64 \n" +
" 20 74 68 65 20 52 6f 61 64 20 68 \n" +
" 61 73 20 67 6f 6e 65 2c 0a 41 6e \n" +
" 64 20 49 20 6d 75 73 74 20 66 6f \n" +
" 6c 6c 6f 77 2c 20 69 66 20 49 20 \n" +
" 63 61 6e 2e")
self.info_text.configure(state="normal")
self.info_text.delete("0.0", "end")
self.info_text.configure(text_color="#4d4d4d")
self.info_text.insert("0.0", itext)
self.info_text.configure(state="disabled")
self.text.configure(text="Device information is being retrieved. Please wait ...")
self.text.pack(pady=50)
self.text.update()
try:
get_client()
except Exception as e:
start_error = True
print(e)
if start_error == True:
self.text.configure(text="An error occured!\n\n" +
"Make sure the device is connected and the\ndeveloper options are enabled.")
self.text.pack(pady=50)
ctk.CTkButton(self.dynamic_frame, text="Check again", command=self.show_noadbserver).pack(pady=10)
ctk.CTkButton(self.dynamic_frame, text="WiFi Pairing", command=self.show_wifi_pairing).pack(pady=10)
itext = device_info
self.info_text.configure(state="normal")
self.info_text.delete("0.0", "end")
self.info_text.configure(text_color="#4d4d4d")
self.info_text.insert("0.0", itext)
self.info_text.configure(state="disabled")
else:
if adb == None:
self.text.configure(text="No ADB Server found!\n\n" +
"Make sure ADB is installed (e.g. via Platform Tools)\nand available in PATH.")
self.text.pack(pady=50)
ctk.CTkButton(self.dynamic_frame, text="Check again", command=self.show_noadbserver).pack(pady=10)
itext = device_info
self.info_text.configure(state="normal")
self.info_text.delete("0.0", "end")
self.info_text.configure(text_color="#4d4d4d")
self.info_text.insert("0.0", itext)
self.info_text.configure(state="disabled")
elif adb != None and device == None:
self.text.configure(text="No device found!\n\n" +
"Make sure the device is connected and the\ndeveloper options are enabled.")
self.text.pack(pady=50)
ctk.CTkButton(self.dynamic_frame, text="Check again", command=self.show_noadbserver).pack(pady=10)
ctk.CTkButton(self.dynamic_frame, text="WiFi Pairing", command=self.show_wifi_pairing).pack(pady=10)
itext = device_info
self.info_text.configure(state="normal")
self.info_text.delete("0.0", "end")
self.info_text.configure(text_color="#4d4d4d")
self.info_text.insert("0.0", itext)
self.info_text.configure(state="disabled")
elif device != None and paired == False:
self.text.configure(text="Device is not authorized!\n\n" +
"Confirm the \"Always trust this Computer\" message\nand check again.")
self.text.pack(pady=50)
ctk.CTkButton(self.dynamic_frame, text="Check again", command=self.show_noadbserver).pack(pady=10)
ctk.CTkButton(self.dynamic_frame, text="WiFi Pairing", command=self.show_wifi_pairing).pack(pady=10)
itext = device_info
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", itext)
self.info_text.configure(state="disabled")
elif paired == True:
itext = device_info
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", itext)
self.info_text.configure(state="disabled")
self.show_cwd()
else:
self.text.configure(text="Unknown operation state.")
self.text.pack(pady=50)
itext = device_info
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", itext)
self.info_text.configure(state="disabled")
self.text.configure(text="ADB Server found!")
self.text.pack(pady=50)
pass
#Show the Wifi-Pairing
def show_wifi_pairing(self):
for widget in self.dynamic_frame.winfo_children():
widget.destroy()
ctk.CTkLabel(self.dynamic_frame, text="ALEX by Christian Peter", text_color="#3f3f3f", height=40, padx=40, font=self.stfont).pack(anchor="w")
ctk.CTkLabel(self.dynamic_frame, text="Wireless Debugging", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="\nChoose the Pairing method:", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(anchor="center", pady=25)
self.change = ctk.IntVar(self, 0)
self.choose = ctk.StringVar(self, "Abort")
self.qrb = ctk.CTkButton(self.dynamic_frame, text="QR-Code", font=self.stfont, command=lambda: self.choose.set("qr"))
self.qrb.pack(pady=5)
self.pinb = ctk.CTkButton(self.dynamic_frame, text="Pairing Code", font=self.stfont, command=lambda: self.choose.set("pin"))
self.pinb.pack(pady=5)
self.backb = ctk.CTkButton(self.dynamic_frame, text="Back", font=self.stfont, fg_color="#8c2c27", text_color="#DCE4EE", command=self.show_noadbserver)
self.backb.pack(pady=5)
self.wait_variable(self.choose)
self.qrb.pack_forget()
self.pinb.pack_forget()
self.backb.pack_forget()
if self.choose.get() == "qr":
self.text.configure(text="Please activate Wireless Debugging and scan the shown QR Code.", anchor="n", height=20)
self.placeholder_image = ctk.CTkImage(dark_image=Image.open(os.path.join(os.path.dirname(__file__), "assets" , "qr_ph.png")), size=(256, 256))
self.imglabel = ctk.CTkLabel(self.dynamic_frame, image=self.placeholder_image, text=" ", width=256, height=256, font=self.stfont, justify="left")
self.imglabel.pack()
self.backb = ctk.CTkButton(self.dynamic_frame, text="Back", font=self.stfont, fg_color="#8c2c27", text_color="#DCE4EE", command=self.show_noadbserver)
self.backb.pack(pady=30)
self.pair_wifi = threading.Thread(target=lambda: wifi_adb.wifi_pair(self.change, self.imglabel))
self.pair_wifi.start()
elif self.choose.get() == "pin":
self.text.configure(text="Please provide the IP-Address, Port and Pairing-Code\nshown on the device Screen.", anchor="n", height=20)
self.ipbox = ctk.CTkEntry(self.dynamic_frame, width=180, height=20, corner_radius=0, placeholder_text="IP Address")
self.portbox = ctk.CTkEntry(self.dynamic_frame, width=180, height=20, corner_radius=0, placeholder_text="Port")
self.pairbox = ctk.CTkEntry(self.dynamic_frame, width=180, height=20, corner_radius=0, placeholder_text="Pairing Code")
self.ipbox.pack(pady=5)
self.portbox.pack(pady=5)
self.pairbox.pack(pady=5)
self.okbutton = ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.choose.set("ok"))
self.okbutton.pack(pady=20)
self.backb = ctk.CTkButton(self.dynamic_frame, text="Back", font=self.stfont, fg_color="#8c2c27", text_color="#DCE4EE", command=self.show_noadbserver)
self.backb.pack(pady=5)
self.wait_variable(self.choose)
self.okbutton.pack_forget()
p_ip = self.ipbox.get()
p_port = self.portbox.get()
p_pair = self.pairbox.get()
p_valid = False
self.ipbox.pack_forget()
self.portbox.pack_forget()
self.pairbox.pack_forget()
try:
ipaddress.ip_address(p_ip)
except:
self.ipbox.pack_forget()
self.text.configure(text="Invalid input! Provide a valid IP address.")
self.backb = ctk.CTkButton(self.dynamic_frame, text="Back", font=self.stfont, fg_color="#8c2c27", text_color="#DCE4EE", command=self.show_noadbserver)
self.backb.pack(pady=30)
try:
p_port_check = int(p_port)
p_pair_check = int(p_pair)
p_valid = True
except:
self.text.configure(text="Invalid input! Port and Pairing-Code have to be Integers.")
self.backb = ctk.CTkButton(self.dynamic_frame, text="Back", font=self.stfont, fg_color="#8c2c27", text_color="#DCE4EE", command=self.show_noadbserver)
self.backb.pack(pady=30)
if p_valid:
self.backb.pack_forget()
self.text.configure(text="\n\n\nTrying to establish a connection with the device ...")
self.pair_wifi = threading.Thread(target=lambda: wifi_adb.wifi_pair(self.change, p_addr=p_ip, p_port = p_port, p_pass=p_pair))
self.pair_wifi.start()
self.wait_variable(self.change)
self.after(500, self.show_noadbserver())
# 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('~'), "ALEX_out")
else:
dir = os.getcwd()
ctk.CTkLabel(self.dynamic_frame, text="ALEX 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", text_color="#DCE4EE", font=self.stfont, command=lambda: self.browse_cwd(self.outputbox), width=60, fg_color="#2d2d35")
self.browsebutton.pack(side="bottom", pady=(0,b_button_offset_y), padx=(0,b_button_offset_x))
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
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':
try:
import crossfiledialog
dir = crossfiledialog.choose_folder()
if dir == "":
dir = olddir
except:
dir = ctk.filedialog.askdirectory()
if not 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)
def show_save_device_info(self):
save_info()
text = "Device info saved to: \ndevice_" + snr + ".txt"
ctk.CTkLabel(self.dynamic_frame, text=f"ALEX by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
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)
ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=self.show_main_menu).pack(pady=10)
#Report Menu
def show_report_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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 and\ninstalled apps. (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=right_content, 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_acquisition_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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")
if ut == True or aos == True:
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Pull \"Home\"", command=lambda: self.switch_menu("PullData"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Physical Acquisition", command=lambda: self.switch_menu("Physical"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Extract the content of \"Home\" as a folder.",
"Extract a physical image of the Block-device.\n(Requires the sudo password)"]
elif recovery == True:
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Physical Acquisition", command=lambda: self.switch_menu("Physical"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Extract a physical image of the Block-device.\n(Block-device might be encrypted.)"]
else:
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Pull \"sdcard\"", command=lambda: self.switch_menu("PullData"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="ADB Backup", command=lambda: self.switch_menu("ADBBU"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Logical+ Backup\n(UFED-Style)", command=lambda: self.switch_menu("AdvUFED"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Partially Restored\nFilesystem Backup", command=lambda: self.switch_menu("PRFS"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Filesystem / Physical\nBackups", command=lambda: self.switch_menu("CheckRoot"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Extract the content of \"sdcard\" as a folder.",
"Perform an ADB-Backup.",
"Creates an advanced Logical Backup as ZIP\nwith an UFD File for PA.",
"Try to reconstruct parts of the device-filesystem",
"Show backup options for rooted or vulnerable\n(temporarily rootable) devices."]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=right_content, 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" )
#Log Menu
def show_log_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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="Logcat (Dump)", command=lambda: self.switch_menu("LogDump"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Logcat (Live)", command=lambda: self.switch_menu("LogLive"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Dumpsys", command=lambda: self.switch_menu("Dumpsys"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Bugreport", command=lambda: self.switch_menu("BugReport"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="App Ops", command=lambda: self.switch_menu("AppOps"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Dump the saved logcat entries.\nData usually goes back to the last reboot.",
"Capture the live logcat entries.",
"Extract Dumpsys informations.",
"Collect the Bugreport (Dumpstate)",
"Extract App Ops (App Permissions)"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=right_content, 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 Menu
def show_advanced_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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")
if ut == False and aos == False:
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Take screenshots", command=lambda: self.switch_menu("ScreenDevice"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Chat Capture", command=lambda: self.switch_menu("ShotLoop"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Query Content\nProviders", command=lambda: self.switch_menu("Content"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Identify Forensic\nAgent-Apps", command=lambda: self.switch_menu("FindAgent"), width=200, height=70, font=self.stfont),
]
else:
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Take screenshots", command=lambda: self.switch_menu("ScreenDevice"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Chat Capture", command=lambda: self.switch_menu("ShotLoop"), width=200, height=70, font=self.stfont, state="disabled"),
ctk.CTkButton(self.dynamic_frame, text="Query Content\nProviders", command=lambda: self.switch_menu("Content"), width=200, height=70, font=self.stfont, state="disabled"),
]
self.menu_text = ["Take screenshots from device screen.\nScreenshots will be saved under \"screenshots\"\nas PNG.",
"Loop through a chat taking screenshots.",
"Query Data from Content Providers\nas txt or json. (calls, sms, contacts, ...)",
"Find known Agent-Apps used by forensic\nsoftware products."]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=right_content, 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" )
#Exploits Menu
def show_exploit_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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="CVE-2024-0044 ", command=lambda: self.switch_menu("2024_0044"), width=200, height=50, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="CVE-2024-31317", command=lambda: self.switch_menu("2024_31317"), width=200, height=50, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="CVE-2020-0069 ", command=lambda: self.switch_menu("2020_0069"), width=200, height=50, font=self.stfont),
]
self.menu_text = ["Android 12 & 13 with SPL < 03/2024 - Gains access\nto app sandboxes by installing a dummy app.",
"Android 9 - 11 with SPL < 06/2024 - Gains system-user\nshell access through a zygote attack.",
"Android < 10 with SPL < 03/2020 - Gains temp-root on\nMediaTek devices. (MT67xx, MT816x, MT817x, MT6580)"]
self.menu_textbox = []
for btn in self.menu_buttons:
self.menu_textbox.append(ctk.CTkLabel(self.dynamic_frame, width=right_content, 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" )
#Show the Check Root
def show_check_root(self):
ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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="", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Checking the root state ...", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(anchor="center", pady=25)
mtk_vers = ("MT67", "MT816", "MT817", "MT6580")
global show_root
global mtk_su
global c_su
mtk_su = False
self.change = ctk.IntVar(self, 0)
if show_root == False:
if whoami == "root":
show_root = True
try:
if device.shell("echo 'whoami' | su").strip() == "whoami":
c_su = True
except:
pass
elif su_app != None:
self.text.configure(text="Please allow the following superuser request on the device.")
check_su = threading.Thread(target=lambda:has_root(self.change))
check_su.start()
self.wait_variable(self.change)
if self.change.get() == 1:
show_root = True
else:
self.text.configure(text="Root access has not been confirmed.")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("AcqMenu")).pack(pady=40))
return
elif su_app == None:
log("No su-manager found.")
self.text.configure(text="Please allow the following superuser request on the device.")
check_su = threading.Thread(target=lambda:has_root(self.change))
check_su.start()
self.wait_variable(self.change)
if self.change.get() == 1:
show_root = True
else:
self.text.configure(text="Root access has not been confirmed.")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("AcqMenu")).pack(pady=40))
return
elif d_platform.upper().startswith(mtk_vers):
if int(software.split(".")[0]) < 10 and spl < "2020-03-01":
self.choose = ctk.BooleanVar(self, False)
self.text.configure(text="This device may be vulnerable to CVE-2020-0069 (mtk-su).\nFor temporary root access, mtk-su can be copied to the device's\ntmp directory and executed.\n\nDo you want to continue?")
self.yesb = ctk.CTkButton(self.dynamic_frame, text="YES", font=self.stfont, command=lambda: self.choose.set(True))
self.yesb.pack(side="left", pady=(20,330), 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=(20,330))
self.wait_variable(self.choose)
self.yesb.pack_forget()
self.nob.pack_forget()
if self.choose.get() == True:
self.text.configure(text="Attempt to gain temp-root via CVE-2020-0069 (mtk-su).\nPlease Wait ...")
check_su = threading.Thread(target=lambda:temp_mtk_su(self.change))
check_su.start()
print("mtk-su tried")
self.wait_variable(self.change)
if self.change.get() == 1:
show_root = True
mtk_su = True
else:
self.text.configure(text="Root access has not been gained.\nDue to the nature of this process, another attempt may be successful.")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("AcqMenu")).pack(pady=40))
return
else:
self.switch_menu("AcqMenu")
return
if show_root == True:
self.after(100, lambda: self.switch_menu("RootAcq"))
return
else:
self.text.configure(text="Root access has not been confirmed.")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("AcqMenu")).pack(pady=40))
return
# CVE-2020-0069 MTK-SU - Check
def show_2020_0069(self):
ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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="", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Checking compatibility ...", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(anchor="center", pady=25)
mtk_vers = ("MT67", "MT816", "MT817", "MT6580")
global show_root
global mtk_su
mtk_su = False
self.change = ctk.IntVar(self, 0)
if d_platform.upper().startswith(mtk_vers):
if int(software.split(".")[0]) < 10 and spl < "2020-03-01":
self.choose = ctk.BooleanVar(self, False)
self.text.configure(text="This device may be vulnerable to CVE-2020-0069 (mtk-su).\nFor temporary root access, mtk-su can be copied to the device's\ntmp directory and executed.\n\nDo you want to continue?")
self.yesb = ctk.CTkButton(self.dynamic_frame, text="YES", font=self.stfont, command=lambda: self.choose.set(True))
self.yesb.pack(side="left", pady=(20,330), 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=(20,330))
self.wait_variable(self.choose)
self.yesb.pack_forget()
self.nob.pack_forget()
if self.choose.get() == True:
self.text.configure(text="Attempt to gain temp-root via CVE-2020-0069 (mtk-su).\nPlease Wait ...")
check_su = threading.Thread(target=lambda:temp_mtk_su(self.change))
check_su.start()
print("mtk-su tried")
self.wait_variable(self.change)
if self.change.get() == 1:
show_root = True
mtk_su = True
else:
self.text.configure(text="Root access has not been gained.\nDue to the nature of this process, another attempt may be successful.")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
else:
self.switch_menu("Exploits")
return
else:
self.text.configure(text="This device isn't vulnerable to CVE-2020-0069.", anchor="center")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
else:
self.text.configure(text="This device isn't vulnerable to CVE-2020-0069.", anchor="center")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
# CVE-2024-03137 (Zygote Attack)
def show_2024_31317(self):
ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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="", height=60, width=585, font=("standard",24), justify="left").pack(pady=20)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Checking compatibility ...", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(anchor="center", pady=25)
self.change = ctk.IntVar(self, 0)
if int(software.split(".")[0]) in range(9,12) or int(software.split(".")[0]) in range(12,14) and spl < "2024-06-01":
zip_path = f'System_{snr}_{str(datetime.now().strftime("%Y_%m_%d_%H_%M_%S"))}.zip'
self.change.set(0)
self.prog_text = ctk.CTkLabel(self.dynamic_frame, text="", 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, mode="indeterminate", indeterminate_speed=0.5)
self.progress.pack()
self.progress.start()
self.pull_zygote = threading.Thread(target=lambda: exploits.cve_2024_31317(device=device, log=log, software=software, all_apps=all_apps, zip_path=zip_path, text=self.text, prog_text=self.prog_text, change=self.change))
self.pull_zygote.start()
self.wait_variable(self.change)
self.prog_text.pack_forget()
self.progress.pack_forget()
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
else:
self.text.configure(text="This device isn't vulnerable to CVE-2024-31317.", anchor="center")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
# CVE-2024-044 (App Impersonation)
def show_2024_0044(self):
def cve_selected(listbox):
selected_indices = listbox.curselection()
selected_items = [listbox.get(i) for i in selected_indices]
try:
sel_list = list(selected_items)
print(sel_list)
except:
sel_list = []
self.selectframe.pack_forget()
self.textframe.pack_forget()
ctk.CTkLabel(self.dynamic_frame, text="", height=30, width=585, font=("standard",24), justify="left").pack()
self.text = ctk.CTkLabel(self.dynamic_frame, text="", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(anchor="center", pady=25)
if sel_list == []:
self.text.configure(text="Choose at least one package.", anchor="center")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
else:
self.change.set(0)
self.prog_text = ctk.CTkLabel(self.dynamic_frame, text="", 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, mode="indeterminate", indeterminate_speed=0.5)
self.progress.pack()
self.progress.start()
self.pull_cve_apps = threading.Thread(target=lambda: exploits.cve_2024_0044(device=device, log=log, zip_path=zip_path, text=self.text, prog_text=self.prog_text, change=self.change, selection=sel_list))
self.pull_cve_apps.start()
self.wait_variable(self.change)
self.prog_text.pack_forget()
self.progress.pack_forget()
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
def fill_list(app_list, listbox):
listbox.select_clear(0, tk.END)
var = tk.StringVar(value=app_list)
listbox.configure(listvariable=var)
pkg_list = [pkg for pkg, installer in apps]
system_apps = [app for app in all_apps if app not in pkg_list]
ctk.CTkLabel(self.dynamic_frame, text=f"ALEX by Christian Peter - Output: {dir_top}", text_color="#3f3f3f", height=60, padx=40, font=self.stfont).pack(anchor="w")
self.tlabel = ctk.CTkLabel(self.dynamic_frame, text="CVE-2024-0044 - App Extraction", height=60, width=585, font=("standard",24), justify="left")
self.tlabel.pack(pady=10)
self.text = ctk.CTkLabel(self.dynamic_frame, text="Checking compatibility ...", width=585, height=60, font=self.stfont, anchor="w", justify="left")
self.text.pack(anchor="center", pady=25)
self.change = ctk.IntVar(self, 0)
if int(software.split(".")[0]) in range(12,14) and spl < "2024-03-01":
zip_path = f'App_Extration_{snr}_{str(datetime.now().strftime("%Y_%m_%d_%H_%M_%S"))}.zip'
self.tlabel.configure(height=30)
self.text.pack_forget()
self.selectframe = ctk.CTkFrame(self.dynamic_frame, width=400, corner_radius=0, fg_color="transparent")
self.textframe = ctk.CTkFrame(self.dynamic_frame, width=200, corner_radius=0, fg_color="transparent")
self.selectframe.pack(side="left", pady=20, padx=30, fill="y", expand=True)
self.selectframe.pack_propagate(False)
container = tk.Frame(self.selectframe, width=380, height=380)
container.pack(side="left", pady=10)
container.pack_propagate(False)
self.textframe.pack(side="left", pady=20, fill="both", expand=True)
self.textframe.pack_propagate(False)
self.applistbox = tk.Listbox(container, width=200, height=380,
bg="#2E2E2E", fg="#abb3bd", selectbackground="#195727",
selectforeground="#80FD9C", highlightthickness=0,
borderwidth=0, relief="flat", activestyle="none",
exportselection=False, selectmode=tk.MULTIPLE)
self.applistbox.pack(side="left")
self.appscrollbar = ctk.CTkScrollbar(self.selectframe, width=16, height=380, orientation="vertical", corner_radius=0, command=self.applistbox.yview)
self.appscrollbar.pack(side="right")
self.applistbox.config(yscrollcommand=self.appscrollbar.set)
fill_list(all_apps, self.applistbox)
self.scopetext = ctk.CTkLabel(self.textframe, text="\nScope:", height=20, width=40, font=self.stfont, justify="left").pack(anchor="w", pady=10)
self.allbutton = ctk.CTkButton(self.textframe, text="All Apps", font=self.stfont, command=lambda: fill_list(all_apps, self.applistbox))
self.allbutton.pack(pady=5, ipadx=0, anchor="w")
self.systembutton = ctk.CTkButton(self.textframe, text="System", font=self.stfont, command=lambda: fill_list(system_apps, self.applistbox))
self.systembutton.pack(pady=5, ipadx=0, anchor="w")
self.tpbutton = ctk.CTkButton(self.textframe, text="Third-Party", font=self.stfont, command=lambda: fill_list(pkg_list, self.applistbox))
self.tpbutton.pack(pady=5, ipadx=0, anchor="w")
self.selectiontext = ctk.CTkLabel(self.textframe, text="Selection:", height=10, width=40, font=self.stfont, justify="left").pack(anchor="w", pady=10)
self.allsbutton = ctk.CTkButton(self.textframe, text="Select All", font=self.stfont, command=lambda: self.applistbox.select_set(0, tk.END))
self.allsbutton.pack(pady=5, ipadx=0, anchor="w")
self.nonebutton = ctk.CTkButton(self.textframe, text="Select None", font=self.stfont, command=lambda: self.applistbox.select_clear(0, tk.END))
self.nonebutton.pack(pady=5, ipadx=0, anchor="w")
self.extractiontext = ctk.CTkLabel(self.textframe, text="Extraction:", height=10, width=40, font=self.stfont, justify="left").pack(anchor="w", pady=10)
self.startbutton = ctk.CTkButton(self.textframe, text="Extract", font=self.stfont, command=lambda: cve_selected(self.applistbox))
self.startbutton.pack(pady=5, ipadx=0, anchor="w")
self.abortbutton = ctk.CTkButton(self.textframe, text="Back", fg_color="#8c2c27", text_color="#DCE4EE", font=self.stfont, command=lambda: self.switch_menu("Exploits"))
self.abortbutton.pack(pady=5, ipadx=0, anchor="w")
else:
self.text.configure(text="\n\nThis device isn't vulnerable to CVE-2024-0044.", anchor="center")
self.after(100, lambda: ctk.CTkButton(self.dynamic_frame, text="OK", font=self.stfont, command=lambda: self.switch_menu("Exploits")).pack(pady=40))
return
#Show rooted Backup Options
def show_root_acq_menu(self):
self.skip = ctk.CTkLabel(self.dynamic_frame, text=f"ALEX 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")
if crypt_on == "unencrypted":
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Filesystem Backup\nMethod 1", command=lambda: self.switch_menu("RootFFS"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Filesystem Backup\nMethod 2", command=lambda: self.switch_menu("TarRootFFS"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Physical Backup", command=lambda: self.switch_menu("Physical"), width=200, height=70, font=self.stfont),
]
self.menu_text = ["Creates a FFS Backup of an already\nrooted Device. (As Zip - more reliable)",
"Creates a FFS Backup of an already\nrooted Device. (As Tar - faster)",
"Creates a physical Backup of an already\nrooted Device.",]
elif crypt_on == "encrypted":
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Filesystem Backup\nMethod 1", command=lambda: self.switch_menu("RootFFS"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Filesystem Backup\nMethod 2", command=lambda: self.switch_menu("TarRootFFS"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Physical Backup", command=lambda: self.switch_menu("Physical"), fg_color="#8c2c27", text_color="#DCE4EE", width=200, height=70, font=self.stfont),
]
self.menu_text = ["Creates a FFS Backup of an already\nrooted Device. (As Zip - more reliable)",
"Creates a FFS Backup of an already\nrooted Device. (As Tar - faster)",
"Creates a physical Backup of a rooted Device.\n(Device is encrypted - the dump may be unusable!)",]
else:
self.menu_buttons = [
ctk.CTkButton(self.dynamic_frame, text="Filesystem Backup\nMethod 1", command=lambda: self.switch_menu("RootFFS"), width=200, height=70, font=self.stfont),
ctk.CTkButton(self.dynamic_frame, text="Filesystem Backup\nMethod 2", command=lambda: self.switch_menu("TarRootFFS"), width=200, height=70, font=self.stfont),