-
Notifications
You must be signed in to change notification settings - Fork 19
/
_agent.js
7835 lines (7672 loc) · 490 KB
/
_agent.js
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
📦
368 /agent/main.js.map
281 /agent/main.js
5519 /agent/breakpoint/BPStatus.js.map
5372 /agent/breakpoint/BPStatus.js
4754 /agent/breakpoint/backtrace.js.map
6723 /agent/breakpoint/backtrace.js
8230 /agent/breakpoint/breakpoint.js.map
7731 /agent/breakpoint/breakpoint.js
251 /agent/breakpoint/include.js.map
95 /agent/breakpoint/include.js
588 /agent/breakpoint/stack.js.map
321 /agent/breakpoint/stack.js
163 /agent/cmoudles/include.js.map
10 /agent/cmoudles/include.js
1294 /agent/debugger.js.map
1076 /agent/debugger.js
188 /agent/instructions/include.js.map
26 /agent/instructions/include.js
3292 /agent/instructions/instruction.js.map
3124 /agent/instructions/instruction.js
4967 /agent/logger.js.map
6715 /agent/logger.js
472 /agent/parser/ArtParser.js.map
306 /agent/parser/ArtParser.js
349 /agent/parser/DynamicParser.js.map
183 /agent/parser/DynamicParser.js
356 /agent/parser/Il2cppParser.js.map
260 /agent/parser/Il2cppParser.js
380 /agent/parser/ParserBase.js.map
216 /agent/parser/ParserBase.js
2777 /agent/parser/StringParser.js.map
2437 /agent/parser/StringParser.js
459 /agent/parser/StructParser.js.map
285 /agent/parser/StructParser.js
521 /agent/parser/SymbolParser.js.map
333 /agent/parser/SymbolParser.js
320 /agent/parser/include.js.map
191 /agent/parser/include.js
167 /agent/plugins/LIEF/include.js.map
10 /agent/plugins/LIEF/include.js
2828 /agent/plugins/QBDI/ContextParser.js.map
2341 /agent/plugins/QBDI/ContextParser.js
5424 /agent/plugins/QBDI/QBDIMain.js.map
5710 /agent/plugins/QBDI/QBDIMain.js
2580 /agent/plugins/QBDI/StructInfo.js.map
2858 /agent/plugins/QBDI/StructInfo.js
47593 /agent/plugins/QBDI/arm64-v8a/share/qbdiAARCH64/frida-qbdi.js.map
69209 /agent/plugins/QBDI/arm64-v8a/share/qbdiAARCH64/frida-qbdi.js
209 /agent/plugins/QBDI/include.js.map
49 /agent/plugins/QBDI/include.js
165 /agent/plugins/V8/include.js.map
10 /agent/plugins/V8/include.js
171 /agent/plugins/capstone/include.js.map
10 /agent/plugins/capstone/include.js
167 /agent/plugins/curl/include.js.map
10 /agent/plugins/curl/include.js
342 /agent/plugins/include.js.map
224 /agent/plugins/include.js
171 /agent/plugins/keystone/include.js.map
10 /agent/plugins/keystone/include.js
230 /agent/plugins/main.js.map
54 /agent/plugins/main.js
170 /agent/plugins/openssl/include.js.map
10 /agent/plugins/openssl/include.js
244 /agent/plugins/plugin_main.js.map
54 /agent/plugins/plugin_main.js
3031 /agent/signal.js.map
2693 /agent/signal.js
3431 /agent/utils.js.map
3191 /agent/utils.js
1484 /node_modules/@frida/process/index.js
↻ process
4686 /node_modules/@frida/util/support/types.js
19179 /node_modules/@frida/util/util.js
↻ util
105701 /node_modules/frida-il2cpp-bridge/dist/index.js.map
143555 /node_modules/frida-il2cpp-bridge/dist/index.js
↻ frida-il2cpp-bridge
✄
{"version":3,"file":"main.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/main.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,YAAY,CAAA;AACnB,OAAO,eAAe,CAAA;AACtB,OAAO,aAAa,CAAA;AAEpB,OAAO,yBAAyB,CAAA;AAChC,OAAO,2BAA2B,CAAA;AAClC,OAAO,uBAAuB,CAAA;AAC9B,OAAO,qBAAqB,CAAA;AAE5B,OAAO,sBAAsB,CAAA;AAE7B,OAAO,qBAAqB,CAAA"}
✄
import './logger.js';
import './utils.js';
import './debugger.js';
import './signal.js';
import './breakpoint/include.js';
import './instructions/include.js';
import './cmoudles/include.js';
import './parser/include.js';
import './plugins/include.js';
import "frida-il2cpp-bridge";
✄
{"version":3,"file":"BPStatus.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/breakpoint/BPStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,OAAO,QA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GAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA,CAAA,CAAC,CAAC,CAAA;AAClE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA"}
✄
import { logd, logw } from "../logger.js";
export class BPStatus {
// is stuck at breakpoint
static isPaused = new Map();
// current using thread id
static currentThreadId = 0;
// record current pc
static currentPC = new Map();
// record breakpoints
static breakpoints = new Set();
// map bp type
static bpType = new Map();
// map action step function to thread
static actionStep = new Map();
// map thread to contextMap
static threadContextMap = new Map();
static addBp = (bp, type) => {
BPStatus.breakpoints.add(bp);
BPStatus.bpType.set(bp, type);
};
static removeBp = (bp) => {
BPStatus.breakpoints.delete(bp);
BPStatus.bpType.delete(bp);
};
static getBpType = (bp) => {
const ret = BPStatus.bpType.get(bp);
if (ret == null)
throw new Error("bp type is null");
return ret;
};
static setPaused = (thread_id, paused) => {
BPStatus.isPaused.set(thread_id, paused);
BPStatus.currentThreadId = thread_id;
};
static hasPausedThread = () => {
for (const [_key, value] of BPStatus.isPaused) {
if (value)
return true;
}
return false;
};
static addStepAction = (action, thread_id = BPStatus.currentThreadId) => {
let actions = BPStatus.actionStep.get(thread_id);
if (actions == undefined) {
actions = new Array();
BPStatus.actionStep.set(thread_id, actions);
}
actions.push(action);
};
static listStepAction = (thread_id = BPStatus.currentThreadId) => {
let index = -1;
logw(`selectd thread_id: ${thread_id}`);
BPStatus.actionStep.forEach((value, _key) => {
logd(`[${++index}]\n\taction: ${value}`);
});
};
static getStepActions = (thread_id = BPStatus.currentThreadId) => {
const actions = BPStatus.actionStep.get(thread_id);
if (actions == undefined)
return [];
return actions;
};
static removeAllStepAction = (thread_id = BPStatus.currentThreadId) => {
const actions = BPStatus.actionStep.get(thread_id);
if (actions == undefined)
throw new Error("actions is null");
actions.splice(0, actions.length);
};
static removeIndexStepAction = (index, thread_id = BPStatus.currentThreadId) => {
const actions = BPStatus.actionStep.get(thread_id);
if (actions == undefined)
throw new Error("actions is null");
actions.splice(index, 1);
};
static addThreadContext = (thread_id, address, context) => {
let contextMap = BPStatus.threadContextMap.get(thread_id);
if (contextMap == undefined) {
contextMap = new Map();
BPStatus.threadContextMap.set(thread_id, contextMap);
}
contextMap.set(address, context);
};
static getCurrentContext = (thread_id = BPStatus.currentThreadId) => {
const contextMap = BPStatus.threadContextMap.get(thread_id);
if (contextMap == undefined)
throw new Error("contextMap is null");
const address = BPStatus.currentPC.get(BPStatus.currentThreadId);
if (address == undefined)
throw new Error("address is null");
let context = undefined;
for (const [key, value] of contextMap) {
if (key.equals(address)) {
context = value;
break;
}
}
// contextMap.forEach((value, key) => logd(`key = ${key} value = ${value}`))
if (context == undefined)
throw new Error("context is null");
return context;
};
static toString() {
let disp = '\n';
disp += `CurrentThreadId : ${BPStatus.currentThreadId}\n`;
disp += `CurrentPC : ${JSON.stringify(Array.from(BPStatus.currentPC))}\n`;
disp += `Breakpoints size : ${BPStatus.breakpoints.size}\n`;
disp += `\t${JSON.stringify(Array.from(BPStatus.breakpoints.entries()))}\n`;
disp += `threadContextMap size : ${BPStatus.threadContextMap.size}\n`;
disp += `\t${JSON.stringify(Array.from(BPStatus.threadContextMap.entries()))}\n`;
return disp;
}
static saveBuffer() {
// mmap maps a section of memory to hold data(BPStatus)
// todo ...
}
toBuffer() {
const data = JSON.stringify({
isPaused: BPStatus.isPaused,
currentThreadId: BPStatus.currentThreadId,
currentPC: Array.from(BPStatus.currentPC.entries())
// ...
});
return Buffer.from(data);
}
static fromBuffer(buffer) {
const json = buffer.toString();
const data = JSON.parse(json);
BPStatus.isPaused = data.isPaused;
BPStatus.currentThreadId = data.currentThreadId;
BPStatus.currentPC = new Map(data.currentPC);
// ...
}
}
export var BP_TYPE;
(function (BP_TYPE) {
BP_TYPE[BP_TYPE["LR"] = 0] = "LR";
BP_TYPE[BP_TYPE["SP"] = 1] = "SP";
BP_TYPE[BP_TYPE["RANGE"] = 2] = "RANGE";
BP_TYPE[BP_TYPE["Function"] = 3] = "Function";
})(BP_TYPE || (BP_TYPE = {}));
Reflect.set(globalThis, "BPStatus", BPStatus);
Reflect.set(globalThis, "status", () => { logd(BPStatus.toString()); });
Reflect.set(globalThis, "bps", BPStatus);
✄
{"version":3,"file":"backtrace.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/breakpoint/backtrace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIxC,MAAM,OAAO,SAAS;IAElB,gBAAwB,CAAC;IAEzB,gBAAgB;IAChB,MAAM,CAAC,gBAAgB,GAAG,CAAC,MAAkB,QAAQ,CAAC,iBAAiB,EAAE,EAAE,QAAiB,KAAK,EAAE,UAAmB,KAAK,EAAE,QAAgB,CAAC,EAAiB,EAAE;QAC7J,IAAI,OAAO,GAAW,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;aACtF,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;aACf,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC;aAC5B,GAAG,CAAC,CAAC,GAAgB,EAAE,KAAa,EAAE,EAAE;YACrC,IAAI,MAAM,GAAW,GAAG,EAAE,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,EAAE,CAAA;YACpD,OAAO,MAAM,CAAA;QACjB,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAA;QACf,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAC7C,CAAC,CAAA;IAED,iBAAiB;IACjB,MAAM,CAAC,iBAAiB,GAAG,GAAG,EAAE;QAE5B;;;;;;;;;;;;;;;;;;;;;WAqB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QAAQ,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;oBAC9N,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;iBACtE;aACJ;YAAC,MAAM,EAAC,kBAAkB,EAAE;YAC7B,OAAO,EAAE,CAAA;YACT,OAAO,mBAAmB,CAAC,cAAc,CAAA;QAC7C,CAAC,EAAE,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;IAE5C,CAAC,CAAA;;AAIL,YAAY;AACZ,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAA;AACzD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAC1D,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAA"}
✄
import { logd, logz } from "../logger.js";
import { BPStatus } from "./BPStatus.js";
export class BackTrace {
constructor() { }
// impl by frida
static BackTraceByFrida = (ctx = BPStatus.getCurrentContext(), fuzzy = false, retText = false, slice = 6) => {
let tmpText = Thread.backtrace(ctx, fuzzy ? Backtracer.FUZZY : Backtracer.ACCURATE)
.slice(0, slice)
.map(DebugSymbol.fromAddress)
.map((sym, index) => {
let strRet = `${PD(`[${index}]`, 5)} ${sym}`;
return strRet;
})
.join(`\n`);
return !retText ? logd(tmpText) : tmpText;
};
// impl by system
static BackTraceBySystem = () => {
/**
* typedef enum {
_URC_NO_REASON = 0,
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
!defined(__ARM_DWARF_EH__)
_URC_OK = 0, // used by ARM EHABI
#endif
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
_URC_FATAL_PHASE2_ERROR = 2,
_URC_FATAL_PHASE1_ERROR = 3,
_URC_NORMAL_STOP = 4,
_URC_END_OF_STACK = 5,
_URC_HANDLER_FOUND = 6,
_URC_INSTALL_CONTEXT = 7,
_URC_CONTINUE_UNWIND = 8,
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
!defined(__ARM_DWARF_EH__)
_URC_FAILURE = 9 // used by ARM EHABI
#endif
*/
let _Unwind_Reason_Code;
(function (_Unwind_Reason_Code) {
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_NO_REASON"] = 0] = "_URC_NO_REASON";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_FOREIGN_EXCEPTION_CAUGHT"] = 1] = "_URC_FOREIGN_EXCEPTION_CAUGHT";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_FATAL_PHASE2_ERROR"] = 2] = "_URC_FATAL_PHASE2_ERROR";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_FATAL_PHASE1_ERROR"] = 3] = "_URC_FATAL_PHASE1_ERROR";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_NORMAL_STOP"] = 4] = "_URC_NORMAL_STOP";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_END_OF_STACK"] = 5] = "_URC_END_OF_STACK";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_HANDLER_FOUND"] = 6] = "_URC_HANDLER_FOUND";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_INSTALL_CONTEXT"] = 7] = "_URC_INSTALL_CONTEXT";
_Unwind_Reason_Code[_Unwind_Reason_Code["_URC_CONTINUE_UNWIND"] = 8] = "_URC_CONTINUE_UNWIND";
})(_Unwind_Reason_Code || (_Unwind_Reason_Code = {}));
// using _Unwind_Backtrace
const _Unwind_Backtrace = new NativeFunction(DebugSymbol.fromName("_Unwind_Backtrace").address, 'int', ['pointer', 'pointer']);
// _Unwind_Word _Unwind_GetIP(struct _Unwind_Context *);
const _Unwind_GetIP = new NativeFunction(DebugSymbol.fromName("_Unwind_GetIP").address, 'pointer', ['pointer']);
// void _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Word);
const _Unwind_SetIP = new NativeFunction(DebugSymbol.fromName("_Unwind_SetIP").address, 'void', ['pointer', 'pointer']);
// _Unwind_Word _Unwind_GetGR(struct _Unwind_Context *, int);
const _Unwind_GetGR = new NativeFunction(DebugSymbol.fromName("_Unwind_GetGR").address, 'pointer', ['pointer', 'int']);
// void _Unwind_SetGR(struct _Unwind_Context *, int, _Unwind_Word);
const _Unwind_SetGR = new NativeFunction(DebugSymbol.fromName("_Unwind_SetGR").address, 'void', ['pointer', 'int', 'pointer']);
// _Unwind_Word _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
const _Unwind_GetIPInfo = new NativeFunction(DebugSymbol.fromName("_Unwind_GetIPInfo").address, 'pointer', ['pointer', 'pointer']);
// _Unwind_Word _Unwind_GetCFA(struct _Unwind_Context *);
const _Unwind_GetCFA = new NativeFunction(DebugSymbol.fromName("_Unwind_GetCFA").address, 'pointer', ['pointer']);
// _Unwind_Word _Unwind_GetBSP(struct _Unwind_Context *);
const _Unwind_GetBSP = new NativeFunction(DebugSymbol.fromName("_Unwind_GetBSP").address, 'pointer', ['pointer']);
// _Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *);
const _Unwind_GetDataRelBase = new NativeFunction(DebugSymbol.fromName("_Unwind_GetDataRelBase").address, 'pointer', ['pointer']);
// _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
const _Unwind_GetTextRelBase = new NativeFunction(DebugSymbol.fromName("_Unwind_GetTextRelBase").address, 'pointer', ['pointer']);
logd(`DataRelBase ${_Unwind_GetDataRelBase} | TextRelBase ${_Unwind_GetTextRelBase}`);
var count = 0;
_Unwind_Backtrace(new NativeCallback((ctx, _arg) => {
try {
const ip = _Unwind_GetIP(ctx); // lr
logd(`Frame ${PD(`# ${++count}`, 5)}\n\t${DebugSymbol.fromAddress(ip)} | ${Instruction.parse(ip)}`);
// InstructionParser.printCurrentInstruction(ip, 5)
if (Process.arch == 'arm64') {
// x19 - x31 (64-bit) Non-Volatile Register
const x19 = _Unwind_GetGR(ctx, 19);
const x20 = _Unwind_GetGR(ctx, 20);
const x21 = _Unwind_GetGR(ctx, 21);
const x22 = _Unwind_GetGR(ctx, 22);
const x23 = _Unwind_GetGR(ctx, 23);
const x24 = _Unwind_GetGR(ctx, 24);
const x25 = _Unwind_GetGR(ctx, 25);
const x26 = _Unwind_GetGR(ctx, 26);
const x27 = _Unwind_GetGR(ctx, 27);
const x28 = _Unwind_GetGR(ctx, 28);
const fp = _Unwind_GetGR(ctx, 29);
const lr = _Unwind_GetGR(ctx, 30);
// const sp: NativePointer = _Unwind_GetGR(ctx, 31) // misapplication
const cfa = _Unwind_GetCFA(ctx);
// const bsp: NativePointer = _Unwind_GetBSP(ctx)
logz(`\t${PD(`x19: ${x19}`)} ${PD(`x20: ${x20}`)} ${PD(`x21: ${x21}`)} ${PD(`x22: ${x22}`)} ${PD(`x23: ${x23}`)} ${PD(`x24: ${x24}`)}\n\t${PD(`x25: ${x25}`)} ${PD(`x26: ${x26}`)} ${PD(`x27: ${x27}`)} ${PD(`x28: ${x28}`)}`);
logz(`\t${PD(`fp: ${fp}`)} ${PD(`lr: ${lr}`)} ${PD(`sp: ${cfa}`)}`);
}
}
catch { /* end of stack */ }
newLine();
return _Unwind_Reason_Code._URC_NO_REASON;
}, 'int', ['pointer', 'pointer']), NULL);
};
}
// backtrace
Reflect.set(globalThis, "bt", BackTrace.BackTraceByFrida);
Reflect.set(globalThis, "btf", BackTrace.BackTraceByFrida);
Reflect.set(globalThis, "bts", BackTrace.BackTraceBySystem);
✄
{"version":3,"file":"breakpoint.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/breakp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AAG,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;SACrG;IACL,CAAC,CAAA;IAEO,MAAM,CAAC,iBAAiB,GAAG,CAAC,OAAwB,EAAE,EAAE;QAC5D,MAAM,EAAE,GAAG,OAA0B,CAAA;QACrC,MAAM,aAAa,GAAW,OAAO,CAAC,kBAAkB,EAAE,CAAA;QAC1D,IAAI,CAAC,OAAO,aAAa,CAAC,aAAa,CAAC,MAAM,aAAa,MAAM,CAAC,CAAA;QAClE,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QAC7B,iBAAiB,CAAC,uBAAuB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QAChD,UAAU,CAAC,OAAO,CAAC,CAAA;QACnB,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;QACpE,4EAA4E;QAC5E,MAAM,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC3C,CAAC,CAAA;IAEO,MAAM,CAAC,eAAe,GAAG,CAAC,OAAsB,EAAE,EAAE;QACxD,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IACpC,CAAC,CAAA;;AAIL,oDAAoD;AACpD,4CAA4C;AAC5C,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA,CAAC,aAAa;AACtE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA,CAAC,WAAW"}
✄
import { InstructionParser } from '../instructions/instruction.js';
import { logd, logh, logw, logz } from '../logger.js';
import { BPStatus, BP_TYPE } from './BPStatus.js';
import { padding as PD } from '../utils.js';
import { Debugger } from '../debugger.js';
import { Signal } from '../signal.js';
const DebugType = false;
export class BreakPoint {
static InnerAttach(localPtr, threadid) {
if (DebugType)
logw(`InnerAttach ${localPtr}`);
Interceptor.attach(localPtr, {
onEnter(_args) {
threadid = threadid == undefined ? Process.getCurrentThreadId() : threadid;
logw(`Enter ${localPtr} | threadid ${threadid} | MAIN ? ${Boolean(threadid === getMainThreadId())}`);
Stalker.follow(threadid, {
events: {
call: false,
ret: false,
exec: true,
block: false,
compile: false,
},
transform: function (iterator) {
let instruction = iterator.next();
if (DebugType)
logw(instruction.toString());
do {
if (Debugger.getModule(threadid).has(instruction.address)) {
if (DebugType)
logz(`${DebugSymbol.fromAddress(instruction?.address)} ${instruction}`);
iterator.putCallout(BreakPoint.CalloutInner);
}
iterator.keep();
} while ((instruction = iterator.next()) !== null);
}
});
},
// only function bp need unfollow here
onLeave: BPStatus.getBpType(localPtr) != BP_TYPE.Function ? undefined : function (_retval) {
Stalker.unfollow(threadid);
}
});
}
static continueThread = (thread_id = BPStatus.currentThreadId) => {
if (!BPStatus.hasPausedThread())
throw new Error("no paused thread");
Stalker.unfollow(thread_id);
Signal.sem_post_thread_id(thread_id);
BPStatus.breakpoints.delete(BPStatus.currentPC.get(thread_id));
BPStatus.currentThreadId = 0;
BPStatus.setPaused(thread_id, false);
};
static attchByFunction = (mPtr = NULL, mdName = null, threadid) => {
let localPtr = NULL;
if (mPtr instanceof NativePointer)
localPtr = mPtr;
else {
if (typeof mPtr === 'string') {
localPtr = typeof mPtr === 'string' ? (mPtr.startsWith("0x") ? ptr(mPtr) : (function () {
const md = Module.findExportByName(mdName, mPtr);
if (md == null)
throw new Error("md is null");
return md;
})()) : mPtr;
}
else
localPtr = BreakPoint.checkArgs(mPtr);
}
try {
BPStatus.addBp(localPtr, BP_TYPE.Function);
BreakPoint.InnerAttach(localPtr, threadid);
}
catch (error) {
// if err, don't add it to BPStatus
}
};
static checkArgs = (mPtr = NULL) => {
let localPtr = NULL;
if (mPtr instanceof NativePointer)
return localPtr;
if (typeof mPtr === 'number') {
localPtr = ptr(mPtr);
}
else {
throw new Error("mPtr must be number");
}
if (localPtr == null)
throw new Error("mPtr is null");
return localPtr;
};
// inlinehook unfollow by pc == lr
static attachByLR = (mPtr = NULL, threadid) => {
let localPtr = BreakPoint.checkArgs(mPtr);
BPStatus.addBp(localPtr, BP_TYPE.LR);
BreakPoint.InnerAttach(localPtr, threadid);
throw new Error("not implement");
};
// inlinehook unfollow by stack < 0
static attachBySP = (mPtr = NULL, threadid) => {
let localPtr = BreakPoint.checkArgs(mPtr);
BPStatus.addBp(localPtr, BP_TYPE.SP);
BreakPoint.InnerAttach(localPtr, threadid);
throw new Error("not implement");
};
// inlinehook unfollow by RANGE
static attachByRange = (mPtr = NULL, threadid) => {
let localPtr = BreakPoint.checkArgs(mPtr);
BPStatus.addBp(localPtr, BP_TYPE.RANGE);
BreakPoint.InnerAttach(localPtr, threadid);
throw new Error("not implement");
};
static CalloutInner = (context) => {
// clear()
const currentPC = context.pc;
// todo moduleFilters implement
const thread_id = Process.getCurrentThreadId();
BPStatus.addThreadContext(thread_id, context.pc, context);
BPStatus.currentPC.set(thread_id, currentPC);
// check hit
BPStatus.setPaused(thread_id, true);
if (BPStatus.breakpoints.has(currentPC.sub(4 * 4))) {
logw(`Hit breakpoint at ${DebugSymbol.fromAddress(currentPC)} | ${Instruction.parse(currentPC)}`);
Signal.sem_post_thread_id(thread_id);
}
if (Process.arch == "arm64") {
BreakPoint.callOutInnerArm64(context);
}
else if (Process.arch == "arm") {
BreakPoint.callOutInnerArm(context);
}
};
static printRegs = (context) => {
if (Process.arch == "arm64") {
const tc = context;
logw(`${PD(`X0: ${tc.x0}`)} ${PD(`X1: ${tc.x1}`)} ${PD(`X2: ${tc.x2}`)} ${PD(`X3: ${tc.x3}`)} ${PD(`X4: ${tc.x4}`)} ${PD(`X5: ${tc.x5}`)} ${PD(`X6: ${tc.x6}`)}`);
logw(`${PD(`X7: ${tc.x7}`)} ${PD(`x8: ${tc.x8}`)} ${PD(`X9: ${tc.x9}`)} ${PD(`X10: ${tc.x10}`)} ${PD(`X11: ${tc.x11}`)} ${PD(`X12: ${tc.x12}`)} ${PD(`X13: ${tc.x13}`)}`);
logw(`${PD(`X14: ${tc.x14}`)} ${PD(`X15: ${tc.x15}`)} ${PD(`X19: ${tc.x19}`)} ${PD(`X20: ${tc.x20}`)} ${PD(`X21: ${tc.x21}`)} ${PD(`X22: ${tc.x22}`)} ${PD(`X23: ${tc.x23}`)}`);
logw(`${PD(`X24: ${tc.x24}`)} ${PD(`X25: ${tc.x25}`)} ${PD(`X26: ${tc.x26}`)} ${PD(`X27: ${tc.x27}`)} ${PD(`X28: ${tc.x28}`)}`);
logh(`\n${PD(`FP(X29): ${tc.fp}`)} ${PD(`LR(X30): ${tc.lr}`)} ${PD(`SP(X31): ${tc.sp}`)} ${PD(`PC: ${tc.pc}`)}`);
}
else if (Process.arch == "arm") {
const tc = context;
logw(`R0: ${PD(tc.r0)} R1: ${PD(tc.r1)} R2: ${PD(tc.r2)} R3: ${PD(tc.r3)}`);
logw(`R4: ${PD(tc.r4)} R5: ${PD(tc.r5)} R6: ${PD(tc.r6)} R7: ${PD(tc.r7)}`);
logw(`R8: ${PD(tc.r8)} R9: ${PD(tc.r9)} R10: ${PD(tc.r10)} R11: ${PD(tc.r11)}`);
logh(`\nIP(R12): ${PD(tc.r12)} SP(R13): ${PD(tc.sp)} LR(R14): ${PD(tc.lr)} PC(R15): ${PD(tc.pc)}`);
}
};
static callOutInnerArm64 = (context) => {
const tc = context;
const currentThread = Process.getCurrentThreadId();
logd(`\n[ ${getThreadName(currentThread)} @ ${currentThread} }\n`);
BreakPoint.printRegs(context);
InstructionParser.printCurrentInstruction(tc.pc);
printStack(context);
BPStatus.getStepActions(currentThread).forEach(action => action(tc));
// BreakPoint.BackTraceBySystem() // recommend using in StepAction not there
Signal.sem_wait_threadid(currentThread);
};
static callOutInnerArm = (context) => {
throw new Error("not implement");
};
}
// Reflect.set(globalThis, "BreakPoint", BreakPoint)
// Reflect.set(globalThis, "bp", BreakPoint)
Reflect.set(globalThis, "b", BreakPoint.attchByFunction); // breakpoint
Reflect.set(globalThis, "c", BreakPoint.continueThread); // continue
✄
{"version":3,"file":"include.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/breakpoint/include.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AACtB,OAAO,iBAAiB,CAAA;AACxB,OAAO,gBAAgB,CAAA;AACvB,OAAO,YAAY,CAAA"}
✄
import './BPStatus.js';
import './breakpoint.js';
import './backtrace.js';
import './stack.js';
✄
{"version":3,"file":"stack.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/breakpoint/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,MAAM,UAAU,GAAG,CAAC,GAAc,EAAC,EAAE;IACjC,IAAI,GAAG,IAAI,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACjE,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,EAAE,CAAA,EAAE;QAC3B,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QAC5C,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;AACN,CAAC,CAAA;AAMD,UAAU,CAAC,UAAU,GAAG,UAAU,CAAA"}
✄
import { logd } from '../logger.js';
const printStack = (ctx) => {
if (ctx == undefined)
throw new Error("ctx can not be undefined");
import("frida-stack").then(md => {
logd(`[+]${md.Stack.getModuleInfo(ctx.pc)}`);
logd(md.Stack.native(ctx));
});
};
globalThis.printStack = printStack;
✄
{"version":3,"file":"include.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/cmoudles/include.ts"],"names":[],"mappings":""}
✄
export {};
✄
{"version":3,"file":"debugger.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/debugger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,OAAO,QAAQ;IAEjB,MAAM,CAAC,aAAa,GAAG,IAAI,GAAG,CAAS,CAAC,cAAc,CAAC,CAAC,CAAA;IAExD,MAAM,CAAC,eAAe,GAAG,IAAI,GAAG,EAAqB,CAAA;IAErD,MAAM,CAAC,SAAS,GAAG,CAAC,YAAoB,QAAQ,CAAC,eAAe,EAAa,EAAE;QAC3E,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YACzC,OAAO,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAE,CAAA;SAClD;aAAM;YACH,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;YAC9E,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;YAC5C,OAAO,GAAG,CAAA;SACb;IACL,CAAC,CAAA;IAED,MAAM,CAAC,qBAAqB,GAAG,CAAC,IAAmB,EAAa,EAAE;QAC9D,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;QAC7C,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,CAAC,UAAU,IAAI,IAAI,EAAE;YAC/C,IAAI,CAAC,iBAAiB,CAAC,CAAA;YACvB,OAAO,IAAI,CAAC,SAAS,EAAE,CAAA;SAC1B;QACD,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QAC1C,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAA;IAC/B,CAAC,CAAA;IAED,MAAM,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE;QACpC,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC,CAAA;;AAIL,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA"}
✄
import { BPStatus } from "./breakpoint/BPStatus.js";
import { loge } from "./logger.js";
export class Debugger {
static moduleFilters = new Set(["libil2cpp.so"]);
static CacheByThreadId = new Map();
static getModule = (thread_id = BPStatus.currentThreadId) => {
if (Debugger.CacheByThreadId.has(thread_id)) {
return Debugger.CacheByThreadId.get(thread_id);
}
else {
const ret = new ModuleMap((md) => Debugger.moduleFilters.has(md.name));
Debugger.CacheByThreadId.set(thread_id, ret);
return ret;
}
};
static getModuleMapByAddress = (mPtr) => {
const dbgInfo = DebugSymbol.fromAddress(mPtr);
if (dbgInfo == null || dbgInfo.moduleName == null) {
loge(`dbgInfo is null`);
return this.getModule();
}
Debugger.addModuleName(dbgInfo.moduleName);
return Debugger.getModule();
};
static addModuleName = (name) => {
Debugger.moduleFilters.add(name);
};
}
Reflect.set(globalThis, "Debugger", Debugger);
✄
{"version":3,"file":"include.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/instructions/include.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA"}
✄
import './instruction.js';
✄
{"version":3,"file":"instruction.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/instructions/instruction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,OAAO,iBAAiB;IAE1B,gBAAwB,CAAC;IAEzB,MAAM,CAA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IAED,MAAM,CAAC,SAAS,CAAC,OAAsB;QACnC,IAAI;YACA,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACtC,IAAI,GAAG,CAAC,QAAQ,IAAI,IAAI,EAAE;gBACtB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;gBACvB,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;gBAC9B,MAAM,GAAG,GAAG,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;gBAC5C,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAA;aACxB;SACJ;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,EAAE,CAAA;SACZ;QACD,OAAO,EAAE,CAAA;IACb,CAAC;;AAGL,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,CAAA;AAC/D,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAA;AAEjD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,IAAoB,EAAE,QAAiB,EAAE,EAAE,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA,CAAC,OAAO;AACnJ,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,IAAoB,EAAE,QAAiB,EAAE,EAAE,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA,CAAC,QAAQ"}
✄
import { BPStatus } from "../breakpoint/BPStatus.js";
import { loge, logl, logz } from "../logger.js";
export class InstructionParser {
constructor() { }
static printCurrentInstruction = (pc = BPStatus.currentPC.get(BPStatus.currentThreadId), extraIns = 8, ret = false) => {
if (!ret)
newLine();
if (typeof pc === 'number')
pc = ptr(pc);
let count = extraIns;
// fake start
let instruction_start = pc.sub(4 * ((extraIns / 2)));
const arrayRet = [];
// got real start
let offset = 0;
do {
try {
const ins = Instruction.parse(instruction_start.add(offset * 4));
instruction_start = ins.address;
break;
}
catch (error) {
++offset;
}
} while (true);
let ins = Instruction.parse(instruction_start);
do {
// // error ins
// if (ins.toString().includes('udf')) {
// logl(` ${DebugSymbol.fromAddress(ins.address)} | [ ${getErrorDisc(ins.address)} ]`)
// ins = Instruction.parse(ins.address.add(0x4))
// continue
// }
let ins_str = `${DebugSymbol.fromAddress(ins.address)} | ${ins.toString()}`;
const ins_op = InstructionParser.InsParser(ins.address);
if (ins_op.length != 0)
ins_str += `\t-> ${ins_op}`;
ins.address.equals(pc) ? loge(`-> ${ins_str}`) : logz(` ${ins_str}`);
if (ret)
arrayRet.push({ address: ins.address, dis: ins_str });
try {
ins = Instruction.parse(ins.next);
}
catch (error) {
logl(` ${DebugSymbol.fromAddress(ins.next)} | [ ${getErrorDisc(ins.next)} ]`);
ins = Instruction.parse(ins.address.add(0x4));
}
} while (--count > 0);
if (!ret)
newLine();
if (ret)
return arrayRet;
function getErrorDisc(mPtr) {
const bt_array = mPtr.readByteArray(4);
const bt_array_str = Array.from(new Uint8Array(bt_array)).map((item) => item.toString(16).padStart(2, '0')).join(' ');
return bt_array_str;
}
};
static InsParser(address) {
try {
const ins = Instruction.parse(address);
if (ins.mnemonic == "bl") {
const opstr = ins.opStr;
const op = opstr.split("#")[1];
const sym = DebugSymbol.fromAddress(ptr(op));
return sym.toString();
}
}
catch (error) {
return '';
}
return '';
}
}
Reflect.set(globalThis, "InstructionParser", InstructionParser);
Reflect.set(globalThis, "ins", InstructionParser);
Reflect.set(globalThis, "dism", (mPtr, extraIns) => { InstructionParser.printCurrentInstruction(mPtr, extraIns); }); // dism
Reflect.set(globalThis, "pi", (mPtr, extraIns) => { InstructionParser.printCurrentInstruction(mPtr, extraIns); }); // dism
✄
{"version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,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAClH,CAAC,CAAC,CAAA;AACN,CAAC,CAAA;AAED,IAAI,YAAY,GAAwB,IAAI,GAAG,EAAE,CAAA;AACjD,UAAU,CAAC,kBAAkB,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAE,EAAE,EAAE;IACtE,IAAI,KAAK,GAAuB,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IACnE,IAAI,KAAK,IAAI,SAAS;QAAE,KAAK,GAAG,CAAC,CAAA;IACjC,IAAI,KAAK,GAAG,QAAQ,EAAE;QAClB,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;QAC9C,OAAO,IAAI,CAAA;KACd;IACD,OAAO,KAAK,CAAA;AAChB,CAAC,CAAA;AAWD,UAAU,CAAC,IAAI,GAAG,IAAI,CAAA;AACtB,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAA;AAC/B,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAC9B,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA"}
✄
export var LogRedirect;
(function (LogRedirect) {
LogRedirect[LogRedirect["LOGCAT"] = 0] = "LOGCAT";
LogRedirect[LogRedirect["CMD"] = 1] = "CMD";
LogRedirect[LogRedirect["BOTH"] = 2] = "BOTH";
LogRedirect[LogRedirect["TOAST"] = 3] = "TOAST";
LogRedirect[LogRedirect["NOP"] = 4] = "NOP";
})(LogRedirect || (LogRedirect = {}));
export var android_LogPriority;
(function (android_LogPriority) {
/** For internal use only. */
android_LogPriority[android_LogPriority["ANDROID_LOG_UNKNOWN"] = 0] = "ANDROID_LOG_UNKNOWN";
/** The default priority, for internal use only. */
android_LogPriority[android_LogPriority["ANDROID_LOG_DEFAULT"] = 1] = "ANDROID_LOG_DEFAULT";
/** Verbose logging. Should typically be disabled for a release apk. */
android_LogPriority[android_LogPriority["ANDROID_LOG_VERBOSE"] = 2] = "ANDROID_LOG_VERBOSE";
/** Debug logging. Should typically be disabled for a release apk. */
android_LogPriority[android_LogPriority["ANDROID_LOG_DEBUG"] = 3] = "ANDROID_LOG_DEBUG";
/** Informational logging. Should typically be disabled for a release apk. */
android_LogPriority[android_LogPriority["ANDROID_LOG_INFO"] = 4] = "ANDROID_LOG_INFO";
/** Warning logging. For use with recoverable failures. */
android_LogPriority[android_LogPriority["ANDROID_LOG_WARN"] = 5] = "ANDROID_LOG_WARN";
/** Error logging. For use with unrecoverable failures. */
android_LogPriority[android_LogPriority["ANDROID_LOG_ERROR"] = 6] = "ANDROID_LOG_ERROR";
/** Fatal logging. For use when aborting. */
android_LogPriority[android_LogPriority["ANDROID_LOG_FATAL"] = 7] = "ANDROID_LOG_FATAL";
/** For internal use only. */
android_LogPriority[android_LogPriority["ANDROID_LOG_SILENT"] = 8] = "ANDROID_LOG_SILENT"; /* only for SetMinPriority(); must be last */
})(android_LogPriority || (android_LogPriority = {}));
export var LogColor;
(function (LogColor) {
LogColor[LogColor["TRACE"] = 0] = "TRACE";
LogColor[LogColor["MARK"] = 1] = "MARK";
LogColor[LogColor["FATAL"] = 2] = "FATAL";
LogColor[LogColor["WHITE"] = 0] = "WHITE";
LogColor[LogColor["RED"] = 1] = "RED";
LogColor[LogColor["YELLOW"] = 3] = "YELLOW";
LogColor[LogColor["C31"] = 31] = "C31";
LogColor[LogColor["C32"] = 32] = "C32";
LogColor[LogColor["C33"] = 33] = "C33";
LogColor[LogColor["C34"] = 34] = "C34";
LogColor[LogColor["C35"] = 35] = "C35";
LogColor[LogColor["C36"] = 36] = "C36";
LogColor[LogColor["C41"] = 41] = "C41";
LogColor[LogColor["C42"] = 42] = "C42";
LogColor[LogColor["C43"] = 43] = "C43";
LogColor[LogColor["C44"] = 44] = "C44";
LogColor[LogColor["C45"] = 45] = "C45";
LogColor[LogColor["C46"] = 46] = "C46";
LogColor[LogColor["C90"] = 90] = "C90";
LogColor[LogColor["C91"] = 91] = "C91";
LogColor[LogColor["C92"] = 92] = "C92";
LogColor[LogColor["C93"] = 93] = "C93";
LogColor[LogColor["C94"] = 94] = "C94";
LogColor[LogColor["C95"] = 95] = "C95";
LogColor[LogColor["C96"] = 96] = "C96";
LogColor[LogColor["C97"] = 97] = "C97";
LogColor[LogColor["C100"] = 100] = "C100";
LogColor[LogColor["C101"] = 101] = "C101";
LogColor[LogColor["C102"] = 102] = "C102";
LogColor[LogColor["C103"] = 103] = "C103";
LogColor[LogColor["C104"] = 104] = "C104";
LogColor[LogColor["C105"] = 105] = "C105";
LogColor[LogColor["C106"] = 106] = "C106";
LogColor[LogColor["C107"] = 107] = "C107";
})(LogColor || (LogColor = {}));
export const logw = (message) => log(message, LogColor.YELLOW);
export const logt = (message) => log(message, LogColor.TRACE);
export const logm = (message) => log(message, LogColor.MARK);
export const logf = (message) => log(message, LogColor.FATAL);
export const loge = (message) => log(message, LogColor.RED);
export const logg = (message) => log(message, LogColor.C32);
export const logo = (message) => log(message, LogColor.C33);
export const logl = (message) => log(message, LogColor.C34);
export const logn = (message) => log(message, LogColor.C35);
export const logd = (message) => log(message, LogColor.C36);
export const logh = (message) => log(message, LogColor.C96);
export const logz = (message) => log(message, LogColor.C90);
const LOG_TO = LogRedirect.CMD;
const LOG_COUNT_MAX = 20;
export function log(message, type = LogColor.WHITE, filter = false) {
if (LOG_TO == LogRedirect.NOP)
return;
if (filter && !filterDuplicateOBJ(message, LOG_COUNT_MAX))
return;
switch (LOG_TO) {
case LogRedirect.CMD:
switch (type) {
case LogColor.WHITE:
console.debug(message);
break;
case LogColor.RED:
console.error(message);
break;
case LogColor.YELLOW:
console.warn(message);
break;
case LogColor.TRACE:
console.trace(message);
break;
case LogColor.MARK:
console.debug(message);
break;
case LogColor.FATAL:
console.error(message);
break;
default:
console.log(`\x1b[${type}m${message}\x1b[0m`);
break;
}
break;
case LogRedirect.LOGCAT:
logcat(message);
break;
case LogRedirect.TOAST:
showToast(message);
break;
default:
console.log(`\x1b[${type}m${message}\x1b[0m`);
break;
}
}
export const logcat = (msg) => {
Java.perform(() => {
const jstr = Java.use("java.lang.String");
Java.use("android.util.Log").d(jstr.$new("ZZZ"), jstr.$new(msg));
});
};
const showToast = (message) => {
Java.perform(() => {
let Toast = Java.use("android.widget.Toast");
let context = Java.use("android.app.ActivityThread").currentApplication().getApplicationContext();
// .overload('android.content.Context', 'java.lang.CharSequence', 'int')
Java.scheduleOnMainThread(() => Toast.makeText(context, Java.use("java.lang.String").$new(message), 1).show());
});
};
var nameCountMap = new Map();
globalThis.filterDuplicateOBJ = (objstr, maxCount = 10) => {
let count = nameCountMap.get(objstr.toString());
if (count == undefined)
count = 0;
if (count < maxCount) {
nameCountMap.set(objstr.toString(), count + 1);
return true;
}
return false;
};
globalThis.logd = logd;
globalThis.loge = console.error;
globalThis.logw = console.warn;
globalThis.logi = console.info;
✄
{"version":3,"file":"ArtParser.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/ArtParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,SAAU,SAAQ,UAAU;IAErC,IAAI,CAAC,MAAqB;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,WAAW;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACtB,CAAC;IAED,QAAQ;QACJ,MAAM;QACN,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAED,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA"}
✄
import { ParserBase } from "./ParserBase.js";
export class ArtParser extends ParserBase {
from(handle) {
this.handle = handle;
}
asArtMethod() {
return this.handle;
}
asString() {
//todo
return '';
}
}
Reflect.set(globalThis, "ArtParser", ArtParser);
✄
{"version":3,"file":"DynamicParser.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/DynamicParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,aAAc,SAAQ,UAAU;IAEzC,gBAA0B,KAAK,EAAE,CAAA,CAAC,CAAC;CAGtC;AAED,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,aAAa,CAAC,CAAA"}
✄
import { ParserBase } from "./ParserBase.js";
export class DynamicParser extends ParserBase {
constructor() { super(); }
}
Reflect.set(globalThis, "DynamicParser", DynamicParser);
✄
{"version":3,"file":"Il2cppParser.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/Il2cppParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,YAAa,SAAQ,UAAU;CAoC3C;AAED,kDAAkD;AAElD,IAAI;AAEJ,iDAAiD;AAEjD,IAAI;AAEJ,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA"}
✄
import { ParserBase } from "./ParserBase.js";
export class Il2cppParser extends ParserBase {
}
// export class GameObject extends Il2Cpp.Object {
// }
// export class Transform extends Il2Cpp.Object {
// }
Reflect.set(globalThis, "Il2cppParser", Il2cppParser);
✄
{"version":3,"file":"ParserBase.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/ParserBase.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,MAAM,OAAgB,UAAU;IAElB,MAAM,GAAkB,IAAI,CAAA;IAEtC,gBAA0B,CAAC;IAE3B,IAAI,CAAC,MAAqB;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;IAChC,CAAC;CAEJ"}
✄
// import 'frida-il2cpp-bridge'
export class ParserBase {
handle = NULL;
constructor() { }
from(handle) {
this.handle = handle;
}
toString() {
return this.constructor.name;
}
}
✄
{"version":3,"file":"StringParser.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/StringParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,YAAa,SAAQ,UAAU;IAExC,WAAW;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAA;IACxC,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAA;IACvC,CAAC;IAED,UAAU;QACN,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,SAAS;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAA;IACpC,CAAC;IAED,aAAa;QACT,gDAAgD;QAChD,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAED,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA;AAErD,MAAM,OAAO,SAAS;IAEV,MAAM,CAAC,eAAe,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,CAAA;IAExD,MAAM,CAAe;IAErB,YAAY,OAAsB,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;QACrE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;IACtB,CAAC;IAEO,OAAO;QACX,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;QACtC,IAAI,CAAC,MAAM;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E,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,eAAe;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;QAC9B,IAAI,CAAC,OAAO,EAAE,CAAA;QACd,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,QAAQ;QACJ,IAAI;YACA,MAAM,IAAI,GAAkB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAkB,CAAA;YAC/D,OAAO,IAAI,CAAC,cAAc,EAAE,CAAA;SAC/B;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAA;SAClE;IACL,CAAC;IAEO,QAAQ;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAA;QACvB,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;QACvC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAA;QACjF,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACzB,CAAC;;AAGL,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA"}
✄
import { ParserBase } from "./ParserBase.js";
export class StringParser extends ParserBase {
asU16String() {
return this.handle.readUtf16String();
}
asU8String() {
return this.handle.readUtf8String();
}
asStdSting() {
return new StdString(this.handle).toString();
}
asCString() {
return this.handle.readCString();
}
asUnityString() {
// return new Il2Cpp.String(this.handle).content
return '';
}
}
Reflect.set(globalThis, "StringParser", StringParser);
export class StdString {
static STD_STRING_SIZE = 3 * Process.pointerSize;
handle;
constructor(mPtr = Memory.alloc(StdString.STD_STRING_SIZE)) {
this.handle = mPtr;
}
dispose() {
const [data, isTiny] = this._getData();
if (!isTiny)
Java.api.$delete(data);
}
static fromPointer(ptrs) {
return StdString.fromPointers([ptrs, ptrs.add(Process.pointerSize), ptrs.add(Process.pointerSize * 2)]);
}
static fromPointers(ptrs) {
if (ptrs.length != 3)
return '';
return StdString.fromPointersRetInstance(ptrs).disposeToString();
}
static from(pointer) {
try {
return pointer.add(Process.pointerSize * 2).readCString();
}
catch (error) {
// LOGE("StdString.from ERROR" + error)
return 'ERROR';
}
}
static fromPointersRetInstance(ptrs) {
if (ptrs.length != 3)
return new StdString();
const stdString = new StdString();
stdString.handle.writePointer(ptrs[0]);
stdString.handle.add(Process.pointerSize).writePointer(ptrs[1]);
stdString.handle.add(2 * Process.pointerSize).writePointer(ptrs[2]);
return stdString;
}
disposeToString() {
const result = this.toString();
this.dispose();
return result;
}
toString() {
try {
const data = this._getData()[0];
return data.readUtf8String();
}
catch (error) {
return StdString.from(this.handle.add(Process.pointerSize * 2));
}
}
_getData() {
const str = this.handle;
const isTiny = (str.readU8() & 1) === 0;
const data = isTiny ? str.add(1) : str.add(2 * Process.pointerSize).readPointer();
return [data, isTiny];
}
}
Reflect.set(globalThis, 'StdString', StdString);
✄
{"version":3,"file":"StructParser.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/StructParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,YAAa,SAAQ,UAAU;IAExC,gBAA0B,KAAK,EAAE,CAAA,CAAC,CAAC;IAEnC,SAAS,CAAC,MAAc;QACpB,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/B,MAAM;QAEN,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAED,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA"}
✄
import { ParserBase } from "./ParserBase.js";
export class StructParser extends ParserBase {
constructor() { super(); }
asCStruct(c_code) {
const cmd = new CModule(c_code);
//todo
return '';
}
}
Reflect.set(globalThis, "StructParser", StructParser);
✄
{"version":3,"file":"SymbolParser.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/SymbolParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,YAAa,SAAQ,UAAU;IAExC,gBAA0B,KAAK,EAAE,CAAA,CAAC,CAAC;IAEnC,aAAa;QACT,OAAO,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;IAED,WAAW,CAAC,GAA+B;QACvC,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IACrC,CAAC;CACJ;AAED,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA"}
✄
import { ParserBase } from "./ParserBase.js";
export class SymbolParser extends ParserBase {
constructor() { super(); }
asDebugSymbol() {
return DebugSymbol.fromAddress(this.handle);
}
asMapString(map) {
return map.get(this.handle) || '';
}
}
Reflect.set(globalThis, "SymbolParser", SymbolParser);
✄
{"version":3,"file":"include.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/parser/include.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,gBAAgB,CAAA;AACvB,OAAO,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA"}
✄
import './ParserBase.js';
import './ArtParser.js';
import './DynamicParser.js';
import './SymbolParser.js';
import './StructParser.js';
import './Il2cppParser.js';
import './StringParser.js';
✄
{"version":3,"file":"include.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/plugins/LIEF/include.ts"],"names":[],"mappings":""}
✄
export {};
✄
{"version":3,"file":"ContextParser.js","sourceRoot":"C:/Users/admin/Desktop/git_project/FridaDebugger/","sources":["agent/plugins/QBDI/ContextParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,MAAM,OAAO,aAAa;IAEtB,oBAAoB;IACpB,WAAW,GAAuB,EAAE,CAAA;IAEpC,YAAY,WAA+B;QACvC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAClC,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAA;IAClC,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtD,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IAC/D,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACrD,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,KAAkB,EAAE,KAAa,EAAE,KAAoB,EAAE,EAAE;YACvF,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAA;QACrE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAmB,EAAE,KAAa,EAAE,KAAoB,EAAE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gBACH,QAAQ,GAAG,KAAK,CAAA;aACnB;YACD,MAAM,mBAAmB,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,gBAAgB,EAAE,CAAC,MAAM,CAAC,CAAA;YAC7G,IAAI,CAAC,GAAG,WAAW,IAAI,mBAAmB,MAAM,OAAO,CAAC,QAAQ,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;SACnI;QAED,SAAS,cAAc,CAAC,KAAa,EAAE,MAAc;YACjD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC;IACL,CAAC,CAAA;IAED,mBAAmB,GAAG,GAAa,EAAE;QACjC,OAAO,IAAI,CAAC,WAAW;aAClB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;aACjE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;IAC7C,CAAC,CAAA;CAEJ;AAED,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,aAAa,CAAC,CAAA"}
✄
import { logd } from "../../logger.js";
export class ContextParser {
// saved src context
contextInfo = [];
constructor(contextInfo) {
this.contextInfo = contextInfo;
}