-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.py
executable file
·1852 lines (1647 loc) · 91.2 KB
/
main.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
import collections
import inspect
import os
import platform
import re
from PyQt6 import QtCore, QtGui
from PyQt6.QtCore import QThread, pyqtSlot, Qt, QEvent, QPoint, QMutex, QWaitCondition
from PyQt6.QtGui import QPixmap, QTextCursor, QShortcut, QKeySequence, QColor, QIcon, QPalette
from PyQt6.QtWidgets import QLabel, QMainWindow, QMessageBox, QApplication, QInputDialog, QTableWidgetItem
import frida_code
import gadget
import gvar
import hex_viewer
import misc
import parse_unity_dump
import scan_result
import spawn
import ui
import ui_win
from disasm import DisassembleWorker
from enum_ranges import EnumRangesViewClass
from history import HistoryViewClass
def is_readable_addr(addr):
for i in range(len(gvar.enumerate_ranges)):
if int(gvar.enumerate_ranges[i][0], 16) <= int(addr, 16) <= int(gvar.enumerate_ranges[i][1], 16):
return True
return False
def size_to_read(addr):
for i in range(len(gvar.enumerate_ranges)):
if int(gvar.enumerate_ranges[i][0], 16) <= int(addr, 16) <= int(gvar.enumerate_ranges[i][1], 16):
return int(gvar.enumerate_ranges[i][1], 16) - int(addr, 16)
def set_mem_range(prot):
try:
result = gvar.frida_instrument.mem_enumerate_ranges(prot)
# print("[main][set_mem_range] mem_enumerate_ranges result: ", result)
except Exception as e:
print(e)
return
# enumerateRanges --> [(base, base + size - 1, prot, size, path), ... ]
gvar.enumerate_ranges.clear()
for i in range(len(result)):
gvar.enumerate_ranges.append(
(result[i]['base'], hex(int(result[i]['base'], 16) + result[i]['size'] - 1), result[i]['protection'],
result[i]['size'], result[i]['file']['path'] if result[i].get('file') is not None else ""))
# print("[main][set_mem_range] gvar.enumerate_ranges: ", gvar.enumerate_ranges)
def hex_calculator(s):
""" https://leetcode.com/problems/basic-calculator-ii/solutions/658480/Python-Basic-Calculator-I-II-III-easy
-solution-detailed-explanation/comments/881191/"""
def twos_complement(input_value: int, num_bits: int) -> int:
mask = 2 ** num_bits - 1
return ((input_value ^ mask) + 1) & mask
def replace(match):
num = int(match.group(0), 16)
return "- " + hex(twos_complement(num, 64))
# Multiply, divide op are not supported
if re.search(r"[*/]", s):
return False
# Find negative hex value which starts with ffffffff and replace it with "- 2's complement"
pattern = re.compile(r'[fF]{8}\w*')
s = pattern.sub(replace, s)
s = s.replace('0x', '')
num, op, arr, stack = '', "+", collections.deque(s + "+"), []
while sym := arr.popleft() if arr else None:
if str.isdigit(sym):
num += sym
elif re.search(r"[a-zA-F]", sym):
num += sym
elif sym in ('+', '-'):
if num == '':
num = '0'
stack += int(op + num, 16),
op, num = sym, ''
return hex(sum(stack))
def process_read_mem_result(result: str) -> str:
remove_target = '0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF\n'
result = result.replace(result[result.find('\n') + 1:result.find(remove_target)], '')
result = result.replace(remove_target, '')
# Remove any residual whitespace
for i in range(5):
result = result.replace(' ' * (14 - i), '')
return result
class GetFileFromDeviceWorker(QThread):
get_file_from_device_finished_signal = QtCore.pyqtSignal()
def __init__(self, file_path, output_path):
super(GetFileFromDeviceWorker, self).__init__()
self.file_path = file_path
self.output_path = output_path
if os.path.exists(self.output_path):
os.remove(self.output_path)
def run(self) -> None:
try:
gvar.frida_instrument.get_file_from_device(self.file_path)
except Exception as e:
print(f"[main][GetFileFromDeviceWorker] {e}")
self.get_file_from_device_finished_signal.emit()
return
@pyqtSlot(bytes)
def get_file_from_device_sig_func(self, sig: bytes):
if len(sig) > 0:
with open(self.output_path, 'ab') as f:
f.write(sig)
else:
self.get_file_from_device_finished_signal.emit()
class Il2CppDumpWorker(QThread):
il2cpp_dump_signal = QtCore.pyqtSignal(str)
def __init__(self, il2cpp_frida_instrument, statusBar):
super(Il2CppDumpWorker, self).__init__()
self.il2cpp_frida_instrument = il2cpp_frida_instrument
self.statusBar = statusBar
def run(self) -> None:
self.statusBar.showMessage("\tIl2cpp dumping...stay")
try:
result = self.il2cpp_frida_instrument.il2cpp_dump()
if result is not None:
self.il2cpp_dump_signal.emit(result)
except Exception as e:
if str(e) == gvar.ERROR_SCRIPT_DESTROYED:
self.statusBar.showMessage(f"\t{e}...try again")
self.il2cpp_frida_instrument.sessions.clear()
return
class MemRefreshWorker(QThread):
update_hexdump_result_signal = QtCore.pyqtSignal(str)
def __init__(self):
super().__init__()
self.watch_memory_spin_box = None
self.interval = None
self.hex_dump_result = None
self.hex_dump_result_start_address = None
self.paused = False
self.mutex = QMutex()
self.pause_condition = QWaitCondition()
def run(self) -> None:
if gvar.frida_instrument is not None:
gvar.frida_instrument.start_mem_refresh()
while True:
# Check for pause
self.mutex.lock()
if self.paused:
self.pause_condition.wait(self.mutex) # Pause until resumed
self.mutex.unlock()
self.interval = int(self.watch_memory_spin_box.value() * 1000)
if gvar.frida_instrument is not None:
try:
gvar.frida_instrument.get_mem_refresh(100 if self.interval == 0 else self.interval,
gvar.current_frame_start_address)
except Exception as e:
print(f"[main]{inspect.currentframe().f_code.co_name}: {e}")
self.msleep(100) if self.interval == 0 else self.msleep(self.interval)
if self.hex_dump_result_start_address == gvar.current_frame_start_address:
self.update_hexdump_result_signal.emit(self.hex_dump_result)
@pyqtSlot(str)
def refresh_hexdump_result_sig_func(self, sig: str):
self.hex_dump_result = sig[sig.find('\n') + 1:]
self.hex_dump_result_start_address = "".join(("0x", self.hex_dump_result[:self.hex_dump_result.find(' ')]))
def pause(self):
self.mutex.lock()
self.paused = True
self.mutex.unlock()
def resume(self):
self.mutex.lock()
self.paused = False
self.pause_condition.wakeAll()
self.mutex.unlock()
class WindowClass(QMainWindow, ui.Ui_MainWindow if (platform.system() == 'Darwin') else ui_win.Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.spawn_dialog = None
self.statusBar()
self.status_light = QLabel()
self.set_status_light()
self.text_length = None
self.is_il2cpp_checked = None
self.il2cpp_dump_worker = None
self.il2cpp_frida_instrument = None
self.parse_unity_dump_dialog = None
self.parse_result_table_created_signal_connected = False
self.method_clicked_signal_connected = False
self.get_file_from_device_worker = None
self.hex_edit_shortcut = QShortcut(QKeySequence(Qt.Key.Key_F2), self)
self.is_remote_attach_checked = False
self.is_spawn_checked = False
gvar.hex_viewer_signal_manager = hex_viewer.HexViewerSignalManager()
gvar.hex_viewer_signal_manager.backtrace_text_edit_backtrace_addr_clicked_signal.connect(
self.backtrace_text_edit_backtrace_addr_clicked_sig_func)
self.hexViewer.wheel_up_signal.connect(self.wheel_up_sig_func)
self.hexViewer.move_signal.connect(self.move_sig_func)
self.hexViewer.refresh_signal.connect(self.refresh_sig_func)
self.hexViewer.mem_patch_addr_signal.connect(self.mem_patch_addr_sig_func)
self.hexViewer.set_watchpoint_addr_signal.connect(self.set_watchpoint_addr_sig_func)
self.hexViewer.statusBar = self.statusBar()
self.default_color = QLabel().palette().color(QPalette.ColorRole.WindowText)
self.listImgViewer.module_name_signal.connect(lambda sig: self.module_name_sig_func(sig, "listImgViewer"))
self.parseImgListImgViewer.module_name_signal.connect(
lambda sig: self.module_name_sig_func(sig, "parseImgListImgViewer"))
self.prepare_gadget_dialog = gadget.GadgetDialogClass()
self.prepare_gadget_dialog.frida_portal_node_info_signal.connect(self.frida_portal_node_info_sig_func)
self.prepare_gadget_dialog.gadget_ui.fridaPortalModeCheckBox.setChecked(True)
self.gadgetBtn.clicked.connect(self.prepare_gadget)
self.statusBar().showMessage(f"\tWelcome! frida-portal is listening on {gadget.get_local_ip()}:{gvar.frida_portal_cluster_port}", 10000)
self.platform = None
self.is_list_pid_checked = False
self.attach_target_name = None # Name to attach. need to provide on the AppList widget
self.attach_target_name_reserved = None
self.attached_name = None # Main module name after frida attached successfully
self.spawn_target_id = None # Target identifier to do frida spawn. need to provide on the AppList widget
self.remote_addr = ''
self.mem_refresh_worker = None
self.mem_refresh_interval = 0
self.refresh_hexdump_result_signal_connected = False
self.refresh_curr_addr_shortcut = QShortcut(QKeySequence(Qt.Key.Key_F3), self)
self.refresh_curr_addr_shortcut.activated.connect(self.refresh_curr_addr)
self.is_palera1n = False
self.attachBtn.clicked.connect(lambda: self.attach_frida("attachBtnClicked"))
self.detachBtn.clicked.connect(self.detach_frida)
self.offsetInput.returnPressed.connect(lambda: self.offset_ok_btn_pressed_func("returnPressed"))
self.offsetOkbtn.pressed.connect(lambda: self.offset_ok_btn_pressed_func("pressed"))
self.offsetOkbtn.clicked.connect(self.offset_ok_btn_func)
self.status_img_name.returnPressed.connect(lambda: self.offset_ok_btn_pressed_func("returnPressed"))
self.addrInput.returnPressed.connect(lambda: self.addr_btn_pressed_func("returnPressed"))
self.addrBtn.pressed.connect(lambda: self.addr_btn_pressed_func("pressed"))
self.addrBtn.clicked.connect(self.addr_btn_func)
self.tabWidget.tabBarClicked.connect(self.util_tab_bar_click_func)
self.tabWidget2.tabBarClicked.connect(self.status_tab_bar_click_func)
self.hexEditBtn.clicked.connect(self.hex_edit)
self.hexEditDoneBtn.clicked.connect(self.hex_edit)
self.hex_edit_shortcut.activated.connect(self.hex_edit)
self.memScanHexCheckBox.stateChanged.connect(self.mem_scan_hex_checkbox)
self.memScanTypeComboBox.currentTextChanged.connect(self.mem_scan_type_combobox)
self.floatDoubleRoundedScanOptionRadioButton.toggled.connect(self.float_double_rounded_scan_option)
self.floatDoubleExactScanOptionRadioButton.toggled.connect(self.float_double_rounded_scan_option)
self.memScanTargetImg.setEnabled(False)
self.memScanTargetImg.returnPressed.connect(self.mem_scan_target_img_pressed_func)
self.memScanTargetImgCheckBox.stateChanged.connect(self.mem_scan_target_img_checkbox)
self.enum_ranges_view = EnumRangesViewClass()
self.enum_ranges_view.refresh_enum_ranges_signal.connect(self.refresh_enum_ranges_sig_func)
self.enum_ranges_view.enum_ranges_item_clicked_signal.connect(self.enum_ranges_item_clicked_sig_func)
self.showEnumRangesBtn.clicked.connect(self.enum_ranges_view.show_enum_ranges)
self.scan_result_view_thread = QThread()
self.scan_result_view_worker = scan_result.ScanResultViewWorker()
self.scan_result_view_worker.set_scan_options_signal.connect(self.set_scan_options_sig_func)
self.scan_result_view_worker.notify_mem_scan_to_main_signal.connect(self.notify_mem_scan_to_main_sig_func)
self.scan_result_view_worker.scan_result_addr_signal.connect(self.scan_result_addr_sig_func)
self.scan_result_view_worker.scan_result_view_ui.memScanResultTableWidget.\
watch_point_widget.watch_point_ui.\
disassemResult.watchpoint_addr_clicked_signal.connect(self.watchpoint_addr_clicked_sig_func)
self.scan_result_view_worker.moveToThread(self.scan_result_view_thread)
self.scan_result_view_thread.start()
self.memDumpBtn.clicked.connect(self.dump_module)
self.memDumpModuleName.returnPressed.connect(self.dump_module)
self.memDumpModuleName.textChanged.connect(lambda: self.search_img("memDumpModuleName"))
self.parseImgName.textChanged.connect(lambda: self.search_img("parseImgName"))
self.listPIDCheckBox.stateChanged.connect(self.list_pid)
self.attachTypeCheckBox.stateChanged.connect(self.remote_attach)
self.spawnModeCheckBox.stateChanged.connect(self.spawn_mode)
self.unityCheckBox.stateChanged.connect(self.il2cpp_checkbox)
self.watchMemoryCheckBox.stateChanged.connect(self.watch_mem_checkbox)
self.refreshBtn.clicked.connect(self.refresh_curr_addr)
self.moveBackwardBtn.clicked.connect(self.move_backward)
self.moveForwardBtn.clicked.connect(self.move_forward)
self.disasm_thread = QThread()
self.disasm_worker = DisassembleWorker()
self.disasm_worker.hex_viewer = self.hexViewer
self.disasm_worker.hex_viewer.wheel_signal.connect(self.disasm_worker.hex_viewer_wheel_sig_func)
self.disasm_worker.hex_viewer.scroll_signal.connect(self.disasm_worker.hex_viewer_scroll_sig_func)
self.disasm_worker.moveToThread(self.disasm_thread)
self.disasm_thread.start()
self.disassemBtnClickedCount = 0
self.disassemBtn.clicked.connect(self.show_disassemble_result)
self.history_view = HistoryViewClass()
self.history_view.history_addr_signal.connect(self.history_addr_sig_func)
self.history_view.history_ui.historyTableWidget.set_watch_func_signal.connect(
self.hexViewer.set_watch_func_sig_func)
self.history_view.history_ui.historyTableWidget.set_watch_regs_signal.connect(
self.hexViewer.set_watch_regs_sig_func)
self.history_view.history_ui.historyTableWidget.history_remove_row_signal.connect(
self.hexViewer.history_remove_row_sig_func)
self.hexViewer.watch_list_signal.connect(self.history_view.history_ui.historyTableWidget.watch_list_sig_func)
self.hexViewer.add_address_to_history_signal.connect(self.history_view.add_address_to_history_sig_func)
self.historyBtn.clicked.connect(self.history_view.show_history)
self.utilViewer.parse_img_name = self.parse_img_name
self.utilViewer.parse_img_base = self.parse_img_base
self.utilViewer.parse_img_path = self.parse_img_path
self.utilViewer.parseImgName = self.parseImgName
self.utilViewer.statusBar = self.statusBar()
self.parseImgTabWidget.tabBarClicked.connect(self.parse_img_tab_bar_click_func)
self.parse_img_name.returnPressed.connect(lambda: self.utilViewer.parse("parse_img_name"))
self.parseBtn.clicked.connect(lambda: self.utilViewer.parse("parseBtn"))
self.parseImgName.returnPressed.connect(lambda: self.utilViewer.parse("parseImgName"))
self.utilViewer.search_input = self.utilViewerSearchInput
self.utilViewer.search_input.returnPressed.connect(self.utilViewer.search_text)
self.utilViewer.search_button = self.utilViewerSearchBtn
self.utilViewer.search_button.clicked.connect(self.utilViewer.search_text)
self.utilViewer.app_info_btn = self.appInfoBtn
self.utilViewer.app_info_btn.clicked.connect(self.utilViewer.app_info)
self.utilViewer.pull_package_btn = self.pullPackageBtn
self.utilViewer.pull_package_btn.clicked.connect(self.utilViewer.pull_package)
self.utilViewer.full_memory_dump_btn = self.fullMemoryDumpBtn
self.utilViewer.full_memory_dump_btn.clicked.connect(self.utilViewer.full_memory_dump)
self.utilViewer.binary_diff_btn = self.binaryDiffBtn
self.utilViewer.binary_diff_btn.clicked.connect(self.utilViewer.binary_diff)
self.utilViewer.dex_dump_btn = self.dexDumpBtn
self.utilViewer.dex_dump_btn.clicked.connect(self.utilViewer.dex_dump)
self.utilViewer.dex_dump_check_box = self.dexDumpCheckBox
self.utilViewer.dex_dump_check_box.stateChanged.connect(self.utilViewer.dex_dump_checkbox)
self.utilViewer.show_proc_self_maps_btn = self.showMapsBtn
self.utilViewer.show_proc_self_maps_btn.clicked.connect(self.utilViewer.show_maps)
# Install event filter to use tab and move to some input fields
self.interested_widgets = []
QApplication.instance().installEventFilter(self)
@pyqtSlot(str)
def set_scan_options_sig_func(self, sig: str):
scan_value = self.memScanPattern.toPlainText()
is_hex_checked = self.memScanHexCheckBox.isChecked()
if scan_value.strip() == '':
return
hex_regex = re.compile(r'(\b0x[a-fA-F0-9]+\b)')
match = hex_regex.match(scan_value)
if match is not None: # Pointer scan
try:
scan_value = hex_calculator(scan_value)
except Exception as e:
self.statusBar().showMessage(f"\t[main]{inspect.currentframe().f_code.co_name}: {e}", 5000)
return
if scan_value is False:
self.statusBar().showMessage("\tCan't operate *, /", 5000)
return
byte_pairs = misc.hex_value_byte_pairs(scan_value.replace('0x', ''))
if gvar.arch == 'arm64' and (8 - len(byte_pairs) < 0):
self.statusBar().showMessage("\tWrong pointer size", 5000)
return
elif gvar.arch == 'arm64' and (8 - len(byte_pairs) > 0):
byte_pairs = ['00' for _ in range(8 - len(byte_pairs))] + byte_pairs
elif gvar.arch == 'arm' and (4 - len(byte_pairs) < 0):
self.statusBar().showMessage("\tWrong pointer size", 5000)
return
else:
byte_pairs = ['00' for _ in range(4 - len(byte_pairs))] + byte_pairs
reversed_bytes = "".join(reversed(byte_pairs))
scan_value = reversed_bytes
scan_type = "Pointer"
scan_module = self.memScanTargetImgCheckBox.isChecked()
if scan_module:
scan_module_name = self.memScanTargetImg.text()
else:
scan_module_name = ''
scan_start = self.memScanStartAddress.toPlainText()
scan_end = self.memScanEndAddress.toPlainText()
scan_prot = 'r--'
if not self.memProtWritableCheckBox.isChecked() and not self.memProtExecutableCheckBox.isChecked():
scan_prot = 'r--'
elif self.memProtWritableCheckBox.isChecked() and not self.memProtExecutableCheckBox.isChecked():
scan_prot = 'rw-'
elif not self.memProtWritableCheckBox.isChecked() and self.memProtExecutableCheckBox.isChecked():
scan_prot = 'r-x'
elif self.memProtWritableCheckBox.isChecked() and self.memProtExecutableCheckBox.isChecked():
scan_prot = 'rwx'
scan_options = [scan_value, is_hex_checked, scan_type, scan_module_name, scan_start, scan_end, scan_prot]
else:
if sig == 'First Scan': # Set the options for the first scan
scan_type = self.memScanTypeComboBox.itemText(self.memScanTypeComboBox.currentIndex())
if not is_hex_checked:
if scan_type == '1 Byte' or scan_type == '2 Bytes' or \
scan_type == '4 Bytes' or scan_type == '8 Bytes' or \
scan_type == 'Int' or scan_type == 'String':
scan_value = misc.change_value_to_little_endian_hex(scan_value, scan_type, 10)
if 'Error' in scan_value:
self.statusBar().showMessage(scan_value, 3000)
return
if 'Error' in (result := misc.hex_pattern_check(scan_value)):
self.statusBar().showMessage(result, 3000)
return
elif scan_type == 'Float' or scan_type == 'Double':
if self.floatDoubleExactScanOptionRadioButton.isChecked():
scan_value = misc.change_value_to_little_endian_hex(scan_value, scan_type, 10)
if 'Error' in scan_value:
self.statusBar().showMessage(scan_value, 3000)
return
if 'Error' in (result := misc.hex_pattern_check(scan_value)):
self.statusBar().showMessage(result, 3000)
return
elif self.floatDoubleRoundedScanOptionRadioButton.isChecked():
try:
rounded_value = round(float(scan_value))
except Exception as e:
self.statusBar().showMessage(f"\t{inspect.currentframe().f_code.co_name}: {e}", 3000)
print(f"[main][set_scan_options_sig_func] {e}")
return
float_double_scan_value_hex_pattern = misc.generate_hex_pattern_for_rounded_float_double(rounded_value, scan_type)
print(f"[main][set_scan_options_sig_func] float_double_scan_value_hex_pattern: {float_double_scan_value_hex_pattern}")
float_double_scan_value_byte_pairs = misc.hex_value_byte_pairs(float_double_scan_value_hex_pattern.replace("??", "").strip())
print(f"[main][set_scan_options_sig_func] float_double_scan_value_byte_pairs: {float_double_scan_value_byte_pairs}")
scan_value = {"scan_type": scan_type,
"rounded_value": rounded_value,
"scan_value_length": len(float_double_scan_value_byte_pairs),
"scan_value": float_double_scan_value_hex_pattern}
# print(f"[main][set_scan_options_sig_func] scan_value: {scan_value}")
if scan_type == 'String':
scan_value_string = misc.change_little_endian_hex_to_value(scan_value, scan_type)
print(f"[main][set_scan_options_sig_func] scan_value_string: {scan_value_string}")
if 'Error' in scan_value_string:
self.statusBar().showMessage(scan_value_string, 3000)
return
pattern_length = len(scan_value_string)
scan_type = {'String': pattern_length}
if scan_type == 'Array of Bytes':
if 'Error' in (result := misc.hex_pattern_check(scan_value)):
self.statusBar().showMessage(result, 3000)
return
pattern_length = len(scan_value.replace(' ', '')) / 2
scan_type = {'Array of Bytes': pattern_length}
scan_module = self.memScanTargetImgCheckBox.isChecked()
if scan_module:
scan_module_name = self.memScanTargetImg.text()
else:
scan_module_name = ''
scan_start = self.memScanStartAddress.toPlainText()
scan_end = self.memScanEndAddress.toPlainText()
scan_prot = 'r--'
if not self.memProtWritableCheckBox.isChecked() and not self.memProtExecutableCheckBox.isChecked():
scan_prot = 'r--'
elif self.memProtWritableCheckBox.isChecked() and not self.memProtExecutableCheckBox.isChecked():
scan_prot = 'rw-'
elif not self.memProtWritableCheckBox.isChecked() and self.memProtExecutableCheckBox.isChecked():
scan_prot = 'r-x'
elif self.memProtWritableCheckBox.isChecked() and self.memProtExecutableCheckBox.isChecked():
scan_prot = 'rwx'
# For the first scan, scan_value should be in hexadecimal byte format
scan_options = [scan_value, is_hex_checked, scan_type, scan_module_name, scan_start, scan_end, scan_prot]
else: # Set the options for the next scan
scan_type = self.memScanTypeComboBox.itemText(self.memScanTypeComboBox.currentIndex())
if scan_type == '1 Byte' or scan_type == '2 Bytes' or \
scan_type == '4 Bytes' or scan_type == '8 Bytes' or \
scan_type == 'Int':
if is_hex_checked:
# Scan_value should not be in hexadecimal byte format
scan_value = misc.change_little_endian_hex_to_value(scan_value, scan_type)
if type(scan_value) is str and 'Error' in scan_value:
self.statusBar().showMessage(scan_value, 3000)
return
else:
integer_regex = re.compile(r'^-?\d+$')
if integer_regex.match(scan_value) is None:
self.statusBar().showMessage("\tWrong value", 3000)
return
if scan_type == 'Float' or scan_type == 'Double':
if self.floatDoubleExactScanOptionRadioButton.isChecked():
if is_hex_checked:
# Scan_value should not be in hexadecimal byte format
scan_value = misc.change_little_endian_hex_to_value(scan_value, scan_type)
if type(scan_value) is str and 'Error' in scan_value:
self.statusBar().showMessage(scan_value, 3000)
return
elif self.floatDoubleRoundedScanOptionRadioButton.isChecked():
try:
rounded_value = round(float(scan_value))
except Exception as e:
self.statusBar().showMessage(f"\t{inspect.currentframe().f_code.co_name}: {e}", 3000)
print(f"[main][set_scan_options_sig_func] {e}")
return
scan_value = {"rounded_value": rounded_value}
if scan_type == 'String':
if not is_hex_checked:
pattern_length = len(scan_value)
scan_value = misc.change_value_to_little_endian_hex(scan_value, scan_type, 10)
else:
scan_value_string = misc.change_little_endian_hex_to_value(scan_value, scan_type)
print(f"[main][set_scan_options_sig_func] scan_value_string: {scan_value_string}")
if 'Error' in scan_value_string:
self.statusBar().showMessage(scan_value_string, 3000)
return
pattern_length = len(scan_value_string)
scan_type = {'String': pattern_length}
if scan_type == 'Array of Bytes':
if 'Error' in (result := misc.hex_pattern_check(scan_value)):
self.statusBar().showMessage(result, 3000)
return
pattern_length = len(scan_value.replace(' ', '')) / 2
scan_type = {'Array of Bytes': pattern_length}
scan_options = [scan_value, is_hex_checked, scan_type, "", "", "", ""]
print(f"[main][set_scan_options_sig_func] scan_options: {scan_options}")
self.scan_result_view_worker.get_scan_options_signal.emit(scan_options)
if sig == "First Scan":
self.memScanTypeComboBox.setEnabled(False)
if self.memScanTypeComboBox.currentText() == "Float" or self.memScanTypeComboBox.currentText() == "Double":
self.floatDoubleExactScanOptionRadioButton.setEnabled(False)
self.floatDoubleRoundedScanOptionRadioButton.setEnabled(False)
self.memScanTargetImgCheckBox.setEnabled(False)
if self.memScanTargetImgCheckBox.isChecked():
self.memScanTargetImg.setEnabled(False)
self.memScanStartAddress.setEnabled(False)
self.memScanEndAddress.setEnabled(False)
self.memProtWritableCheckBox.setEnabled(False)
self.memProtExecutableCheckBox.setEnabled(False)
@pyqtSlot(list)
def notify_mem_scan_to_main_sig_func(self, sig: list):
# sig --> ["Scan", 0] or ["First Scan", 1]...
# Memory scan started
if sig[0] == "Scan" and sig[1] == 0:
self.stop_or_restart_mem_refresh(0) # Stop refreshing memory
self.watchMemoryCheckBox.setEnabled(False)
# New scan
if sig[0] == "New Scan" and sig[1] == 1:
self.memScanTypeComboBox.setEnabled(True)
if self.memScanTypeComboBox.currentText() == "Float" or self.memScanTypeComboBox.currentText() == "Double":
self.floatDoubleExactScanOptionRadioButton.setEnabled(True)
self.floatDoubleRoundedScanOptionRadioButton.setEnabled(True)
self.memScanTargetImgCheckBox.setEnabled(True)
if self.memScanTargetImgCheckBox.isChecked():
self.memScanTargetImg.setEnabled(True)
self.memScanStartAddress.setEnabled(True)
self.memScanEndAddress.setEnabled(True)
self.memProtWritableCheckBox.setEnabled(True)
self.memProtExecutableCheckBox.setEnabled(True)
# Memory scan completed
if sig[1] == 1:
self.stop_or_restart_mem_refresh(1) # Restart refreshing memory
self.watchMemoryCheckBox.setEnabled(True)
@pyqtSlot(str)
def scan_result_addr_sig_func(self, sig: str):
self.addrInput.setText(sig)
self.addr_btn_func()
@pyqtSlot(str)
def watchpoint_addr_clicked_sig_func(self, sig: str):
self.addrInput.setText(sig)
self.addr_btn_func()
@pyqtSlot(str)
def wheel_up_sig_func(self, sig: str):
# If memory refresh worker is running, update gvar.current_frame_start_address and return
if self.watchMemoryCheckBox.isChecked() and self.mem_refresh_worker.isRunning():
if self.status_img_base.toPlainText() == hex_calculator(f"{sig}"):
return
else:
gvar.current_frame_start_address = hex_calculator(f"{sig} - 10")
return
self.pause_or_resume_mem_refresh(0)
# print(f"[main][wheel_up_sig_func] {sig}")
if self.status_img_base.toPlainText() == hex_calculator(f"{sig}"):
self.pause_or_resume_mem_refresh(1)
return
addr = hex_calculator(f"{sig} - 10")
# print(f"[main][wheel_up_sig_func] {addr}")
self.addrInput.setText(addr)
self.addr_btn_func()
self.pause_or_resume_mem_refresh(1)
@pyqtSlot(int)
def move_sig_func(self, sig: int):
self.move_backward() if sig == 0 else self.move_forward()
@pyqtSlot(int)
def refresh_sig_func(self, sig: int):
if sig:
self.refresh_curr_addr()
@pyqtSlot(str)
def mem_patch_addr_sig_func(self, sig: str):
if sig and self.scan_result_view_worker is not None:
self.scan_result_view_worker.scan_result_view_ui.memScanResultTableWidget.\
mem_patch_widget.add_row([sig])
self.scan_result_view_worker.scan_result_view_ui.memScanResultTableWidget.\
mem_patch_widget.show()
@pyqtSlot(str)
def set_watchpoint_addr_sig_func(self, sig: str):
if sig and self.scan_result_view_worker is not None:
self.scan_result_view_worker.scan_result_view_ui.memScanResultTableWidget.\
watch_point_widget.watch_point_ui.watchpointAddrInput.setText(sig)
self.scan_result_view_worker.scan_result_view_ui.memScanResultTableWidget. \
watch_point_widget.show()
@pyqtSlot(str)
def module_name_sig_func(self, sig: str, caller):
if caller == "listImgViewer":
self.memDumpModuleName.setText(sig)
elif caller == "parseImgListImgViewer":
self.parseImgName.setText(sig)
@pyqtSlot(str)
def spawn_target_id_sig_func(self, sig: str):
if self.is_spawn_checked:
self.spawn_target_id = sig
else:
self.attach_target_name = sig
self.attach_target_name_reserved = sig
if self.is_remote_attach_checked is True:
if re.search(r"^\d+\.\d+\.\d+\.\d+:\d+$", self.spawn_dialog.spawn_ui.remoteAddrInput.text()) is None:
QMessageBox.information(self, "info", "Enter IP:PORT")
self.spawn_target_id = None
self.attach_target_name = None
return
self.remote_addr = self.spawn_dialog.spawn_ui.remoteAddrInput.text()
self.attach_frida("spawn_target_id_sig_func")
self.spawn_dialog = None
self.spawn_target_id = None
self.attach_target_name = None
self.remote_addr = ''
@pyqtSlot(str)
def il2cpp_dump_sig_func(self, sig: str): # sig --> dumped il2cpp file path in the device
if sig is not None:
QThread.msleep(100)
self.statusBar().showMessage("\tIl2cpp Dump Done!", 5000)
self.listImgViewer.moveCursor(QTextCursor.MoveOperation.Start, QTextCursor.MoveMode.MoveAnchor)
self.listImgViewer.setTextColor(QColor("Red"))
dir_to_save = os.getcwd() + "\\dump\\" if platform.system() == "Windows" else os.getcwd() + "/dump/"
dump_file_name = sig.split('/')[-1]
output_path = None
if self.is_remote_attach_checked and gvar.frida_portal_mode is False:
os.system(
f"frida-pull -H {self.il2cpp_frida_instrument.remote_addr} \"{sig}\" {dir_to_save}")
elif self.is_remote_attach_checked is False and gvar.frida_portal_mode is False:
os.system(f"frida-pull -U \"{sig}\" {dir_to_save}")
elif gvar.frida_portal_mode is True:
output_path = dir_to_save + dump_file_name
else:
dir_to_save = ""
dump_file_name = sig
self.listImgViewer.insertPlainText(f"Dumped file at: {dir_to_save}{dump_file_name}\n\n")
self.listImgViewer.setTextColor(self.default_color)
# After il2cpp dump some android apps crash
self.il2cpp_dump_worker.terminate()
self.memDumpBtn.setEnabled(True)
if output_path is not None:
self.get_file_from_device(sig, output_path)
@pyqtSlot(int)
def frida_attach_sig_func(self, sig: int):
if sig: # sig == 1
gvar.is_frida_attached = True
if self.is_remote_attach_checked:
gvar.remote = True
else: # sig == 0
gvar.is_frida_attached = False
self.detach_frida()
self.set_status_light()
@pyqtSlot(str)
def change_frida_script_sig_func(self, sig: str):
if sig != 'scripts/default.js':
self.stop_or_restart_mem_refresh(0)
else:
self.stop_or_restart_mem_refresh(1)
@pyqtSlot(list)
def frida_portal_node_info_sig_func(self, sig: list): # Node info signal
if sig:
self.remote_addr = "localhost"
self.attach_target_name = sig[0]
self.attach_frida("frida_portal_node_info_sig_func")
@pyqtSlot(str)
def history_addr_sig_func(self, sig: str):
self.addrInput.setText(sig)
self.addr_btn_func()
@pyqtSlot(str)
def refresh_enum_ranges_sig_func(self, sig: str):
set_mem_range(sig)
@pyqtSlot(list)
def enum_ranges_item_clicked_sig_func(self, sig: list):
if sig[0] == 0:
self.memScanStartAddress.setText(sig[1])
if sig[0] == 1:
self.memScanEndAddress.setText(sig[1])
if sig[0] == 2:
self.memProtWritableCheckBox.setChecked(False)
self.memProtExecutableCheckBox.setChecked(False)
if sig[1] == 'rw-':
self.memProtWritableCheckBox.setChecked(True)
if sig[1] == 'rwx':
self.memProtWritableCheckBox.setChecked(True)
self.memProtExecutableCheckBox.setChecked(True)
if sig[1] == 'r-x':
self.memProtExecutableCheckBox.setChecked(True)
if sig[0] == 3:
if self.memScanTargetImgCheckBox.isChecked():
try:
module = gvar.frida_instrument.get_module_by_name(sig[1])
except Exception as e:
self.statusBar().showMessage(f"\t{inspect.currentframe().f_code.co_name}: {e}", 3000)
return
if module != '':
self.memScanTargetImg.setText(sig[1])
self.memScanStartAddress.setText(module['base'])
self.memScanEndAddress.setText(hex(int(module['base'], 16) + module['size'] - 1))
else:
self.memScanTargetImg.setText('')
self.memScanStartAddress.setText('0000000000000000')
self.memScanEndAddress.setText('00007fffffffffff')
@pyqtSlot(str)
def backtrace_text_edit_backtrace_addr_clicked_sig_func(self, sig: str):
self.addrInput.setText(sig)
self.addr_btn_func()
@pyqtSlot(str)
def update_hexdump_result_sig_func(self, sig: str):
if self.watchMemoryCheckBox.isChecked() and sig == "":
print(f"[main][update_hexdump_result_sig_func] signal is not received")
self.hexViewer.setPlainText(sig)
curr_addr = int(sig[:sig.find(' ')], 16)
if (base_addr := self.status_img_base.toPlainText()) != '' and (curr_addr >= int(base_addr, 16)):
current_addr = hex(curr_addr) + f"({hex(curr_addr - int(base_addr, 16))})"
else:
current_addr = hex(curr_addr)
self.status_current.setPlainText(current_addr)
gvar.current_frame_block_number = 0
self.disasm_worker.disassemble(gvar.arch, gvar.current_frame_start_address, sig)
@pyqtSlot(int)
def parse_result_table_create_sig_func(self, sig: int):
if sig == 0:
pass
elif sig == 1: # New tableview
try:
self.parse_unity_dump_dialog.parse_result.method_clicked_signal.disconnect()
self.method_clicked_signal_connected = False
except Exception as e:
self.method_clicked_signal_connected = False
if self.method_clicked_signal_connected is False:
self.parse_unity_dump_dialog.parse_result.method_clicked_signal.connect(self.method_clicked_sig_func)
self.method_clicked_signal_connected = True
@pyqtSlot(str)
def method_clicked_sig_func(self, sig: str):
if sig:
self.addrInput.setText(sig)
self.addr_btn_func()
@pyqtSlot()
def get_file_from_device_finished_sig_func(self):
if self.get_file_from_device_worker is not None and self.get_file_from_device_worker.isRunning():
gvar.frida_instrument.get_file_from_device_signal.disconnect()
self.get_file_from_device_worker.get_file_from_device_finished_signal.disconnect()
self.get_file_from_device_worker.quit()
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
if self.prepare_gadget_dialog is not None:
self.prepare_gadget_dialog.gadget_dialog.close()
if self.disasm_worker is not None:
self.disasm_worker.disasm_window.close()
if self.utilViewer.dex_dump_worker is not None:
self.utilViewer.dex_dump_worker.quit()
def eventFilter(self, obj, event):
self.interested_widgets = [self.offsetInput, self.addrInput]
if event.type() == QEvent.Type.KeyPress and event.key() == Qt.Key.Key_Tab:
try:
if self.tabWidget.tabText(
self.tabWidget.currentIndex()) == "Viewer" and self.tabWidget2.currentIndex() == 0:
self.interested_widgets.append(self.status_img_name)
elif self.tabWidget.tabText(
self.tabWidget.currentIndex()) == "Viewer" and self.tabWidget2.currentIndex() == 2:
self.interested_widgets.append(self.memScanPattern)
if self.memScanTargetImgCheckBox.isChecked():
self.interested_widgets.append(self.memScanTargetImg)
self.interested_widgets.append(self.memScanStartAddress)
self.interested_widgets.append(self.memScanEndAddress)
elif self.tabWidget.tabText(self.tabWidget.currentIndex()) == "Util":
self.interested_widgets = [self.parse_img_name, self.parseImgName]
# Get the index of the currently focused widget in our list
index = self.interested_widgets.index(self.focusWidget())
# Try to focus the next widget in the list
self.interested_widgets[(index + 1) % len(self.interested_widgets)].setFocus()
except ValueError:
# The currently focused widget is not in our list, so we focus the first one
self.interested_widgets[0].setFocus()
# We've handled the event ourselves, so we don't pass it on
return True
# For other events, we let them be handled normally
return super().eventFilter(obj, event)
def adjust_label_pos(self):
tc = self.hexViewer.textCursor()
text_length = len(tc.block().text())
if self.text_length == text_length:
return
else:
self.text_length = text_length
current_height = self.height()
if text_length >= 83:
resize_width = text_length * 14 + round(text_length / 10)
else:
resize_width = text_length * 13
self.resize(resize_width, current_height)
if text_length >= 77:
self.label_3.setIndent(28 + (text_length - 77) * 8)
else:
self.label_3.setIndent(28 - (77 - text_length) * 7)
def list_pid(self, state):
self.is_list_pid_checked = state == Qt.CheckState.Checked.value
def remote_attach(self, state):
self.is_remote_attach_checked = state == Qt.CheckState.Checked.value
def spawn_mode(self, state):
self.is_spawn_checked = state == Qt.CheckState.Checked.value
def prepare_gadget(self):
try:
# if self.prepare_gadget_dialog is None:
# self.prepare_gadget_dialog = gadget.GadgetDialogClass()
# self.prepare_gadget_dialog.frida_portal_node_info_signal.connect(self.frida_portal_node_info_sig_func)
self.prepare_gadget_dialog.gadget_dialog.show()
except Exception as e:
self.statusBar().showMessage(f"\t{inspect.currentframe().f_code.co_name}: {e}", 3000)
return
def attach_frida(self, caller: str):
if gvar.is_frida_attached is True:
try:
# Check if script is still alive. if not exception will occur
gvar.frida_instrument.dummy_script()
QMessageBox.information(self, "info", "Already attached")
except Exception as e:
self.statusBar().showMessage(f"\t{inspect.currentframe().f_code.co_name}: {e}", 3000)
gvar.frida_instrument.sessions.clear()
return
try:
if not caller == "frida_portal_node_info_sig_func":
if (self.is_list_pid_checked and not self.is_spawn_checked and self.attach_target_name is None) or \
(self.is_spawn_checked and self.spawn_target_id is None):
self.spawn_dialog = spawn.SpawnDialogClass()
if self.is_list_pid_checked and not self.is_spawn_checked:
self.spawn_dialog.is_pid_list_checked = True
self.spawn_dialog.spawn_ui.spawnTargetIdInput.setPlaceholderText("AppStore")
self.spawn_dialog.spawn_ui.appListLabel.setText("PID Name")
self.spawn_dialog.spawn_ui.spawnBtn.setText("Attach")
self.spawn_dialog.attach_target_name_signal.connect(self.spawn_target_id_sig_func)
self.spawn_dialog.spawn_target_id_signal.connect(self.spawn_target_id_sig_func)
if self.is_remote_attach_checked is False:
self.spawn_dialog.spawn_ui.remoteAddrInput.setEnabled(False)
self.spawn_dialog.spawn_ui.spawnTargetIdInput.setFocus()
else:
self.spawn_dialog.spawn_ui.remoteAddrInput.setFocus()
return
if self.is_remote_attach_checked and self.remote_addr == '':
self.remote_addr, ok = QInputDialog.getText(self, 'Remote Attach', 'Enter IP:PORT')
if ok is False:
return
gvar.frida_instrument = frida_code.Instrument("scripts/default.js",
self.is_remote_attach_checked,
self.remote_addr,
self.attach_target_name if (
self.is_list_pid_checked and not self.is_spawn_checked) else self.spawn_target_id,
self.is_spawn_checked)
# Connect frida attach signal function
gvar.frida_instrument.attach_signal.connect(self.frida_attach_sig_func)
gvar.frida_instrument.change_frida_script_signal.connect(self.change_frida_script_sig_func)
msg = gvar.frida_instrument.instrument(caller)
elif caller == "frida_portal_node_info_sig_func":
gvar.frida_instrument = frida_code.Instrument("scripts/default.js",
True,
self.remote_addr,
self.attach_target_name,
False)
# Connect frida attach signal function
gvar.frida_instrument.attach_signal.connect(self.frida_attach_sig_func)
gvar.frida_instrument.change_frida_script_signal.connect(self.change_frida_script_sig_func)
msg = gvar.frida_instrument.instrument(caller)
self.remote_addr = ''
except Exception as e:
print(e)
self.statusBar().showMessage(f"\t{inspect.currentframe().f_code.co_name}: {e}", 3000)
return
if msg is not None:
QMessageBox.information(self, "info", msg)
self.offsetInput.clear()
return
set_mem_range('r--')
try:
self.platform = gvar.frida_instrument.platform()
if self.platform == 'darwin':
self.is_palera1n = gvar.frida_instrument.is_palera1n()
self.utilViewer.platform = self.platform
gvar.arch = gvar.frida_instrument.arch()
modules = gvar.frida_instrument.list_modules()
name = modules[0]['name']
for module in modules:
if module['name'] == 'libil2cpp.so' or module['name'] == 'UnityFramework' or \
module['name'] == 'libUnreal.so' or module['name'] == 'libUE4.so':
name = module['name']
break
self.attached_name = name
self.set_status(name)
for module in modules:
if module['name'] == 'libpairipcore.so':
gvar.frida_instrument.set_exception()
break
except Exception as e:
print(e)
return
def is_addr_in_mem_range_for_palera1n(self, result):
# If the hexdump result is dict and has 'palera1n', it means mem addr not in the mem range
return not (isinstance(result, dict) and 'palera1n' in result)
def offset_ok_btn_pressed_func(self, caller):
self.is_cmd_pressed = QApplication.instance().keyboardModifiers() & (
Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.MetaModifier)
if self.is_cmd_pressed in (Qt.KeyboardModifier.ControlModifier, Qt.KeyboardModifier.MetaModifier):
if gvar.is_frida_attached: gvar.frida_instrument.force_read_mem_addr(True)
else:
if gvar.is_frida_attached: gvar.frida_instrument.force_read_mem_addr(False)
if caller == "returnPressed":
self.offset_ok_btn_func()
def offset_ok_btn_func(self):
if gvar.is_frida_attached is False: