-
Notifications
You must be signed in to change notification settings - Fork 28
/
_agent.js
1525 lines (1490 loc) · 101 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
📦
980 /src/index.js.map
2740 /src/index.js
11 /src/index.d.ts
43 /src/java/file.d.ts
1010 /src/java/file.js.map
1013 /src/java/file.js
45 /src/java/stringBuilder.d.ts
824 /src/java/stringBuilder.js.map
1440 /src/java/stringBuilder.js
245 /src/java/trace.d.ts
11854 /src/java/trace.js.map
16344 /src/java/trace.js
139 /src/java/trace_change.d.ts
4621 /src/java/trace_change.js.map
6558 /src/java/trace_change.js
56 /src/so/all_so.d.ts
755 /src/so/all_so.js.map
858 /src/so/all_so.js
138 /src/so/hook_func.d.ts
2285 /src/so/hook_func.js.map
3084 /src/so/hook_func.js
44 /src/so/init_array.d.ts
2323 /src/so/init_array.js.map
2346 /src/so/init_array.js
137 /src/so/inlinehook.d.ts
2223 /src/so/inlinehook.js.map
3009 /src/so/inlinehook.js
11 /src/so/scan.d.ts
371 /src/so/scan.js.map
975 /src/so/scan.js
53 /src/so/sktrace/sktrace.d.ts
4028 /src/so/sktrace/sktrace.js.map
6366 /src/so/sktrace/sktrace.js
53 /src/so/so_info.d.ts
766 /src/so/so_info.js.map
465 /src/so/so_info.js
58 /src/so/so_method.d.ts
911 /src/so/so_method.js.map
773 /src/so/so_method.js
146 /src/so/stalker.d.ts
5032 /src/so/stalker.js.map
7659 /src/so/stalker.js
84 /src/so/utils.d.ts
777 /src/so/utils.js.map
695 /src/so/utils.js
292 /src/utils/log.d.ts
4057 /src/utils/log.js.map
3679 /src/utils/log.js
✄
{"version":3,"file":"index.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAYrC,gDAAgD;AAChD,8CAA8C;AAC9C,IAAI,CAAC,OAAO,CAAC;IACb,wDAAwD;IACxD,oDAAoD;IACpD,kDAAkD;IAClD,kFAAkF;IAElF,UAAU;IACV,8BAA8B;IAC9B,0BAA0B;IAC1B,4BAA4B;IAC5B,oCAAoC;IACpC,eAAe;IACf,SAAS;IACT,gBAAgB;IAChB,gCAAgC;IAChC,gDAAgD;IAChD,yCAAyC;IACzC,6BAA6B;IAE7B,MAAM;IACN,iBAAiB;IACjB,4EAA4E;IAC5E,2CAA2C;IAE3C,sCAAsC;IACtC,qCAAqC;IACrC,wCAAwC;IACxC,4CAA4C;IAC5C,qCAAqC;IACrC,YAAY;IACZ,wCAAwC;IACxC,YAAY;IACZ,+CAA+C;IAC/C,UAAU;IACV,gDAAgD;IAChD,WAAW;IACX,qCAAqC;IAErC,uCAAuC;IACvC,wDAAwD;IACxD,KAAK,CAAC,4CAA4C,CAAC,CAAA;IACnD,kEAAkE;IAElE,0DAA0D;IAC1D,8DAA8D;IAC9D,mEAAmE;IACnE,kFAAkF;IAClF,2CAA2C;IAC3C,2DAA2D;IAE3D,4EAA4E;IAC5E,+DAA+D;IAC/D,4BAA4B;IAC5B,cAAc;IAEd,cAAc;IACd,2DAA2D;IAC3D,qCAAqC;IAErC,6EAA6E;IAC7E,iBAAiB;IACjB,mCAAmC;IACnC,4CAA4C;IAC5C,gBAAgB;IAChB,eAAe;IACf,gCAAgC;AAChC,CAAC,CAAC,CAAA"}
✄
import { trace } from "./java/trace.js";
// import {findClass} from './java/findClass.js'
// import {all_java} from './java/all_java.js'
Java.perform(function () {
// import { one_instance } from "./java/one_instance.js"
// import { encryption } from "./java/encryption.js"
// import { findClass } from "./java/findClass.js"
// import {anti_InMemoryDexClassLoader} from './java/anti_InMemoryDexClassLoader';
// native层
// so_method('libAppGuard.so')
// setTimeout(all_so,5000)
// so_info('libAppGuard.so')
// inline_hook('libOnLoad.so',0x9E0)
// init_array()
// scan()
// all_so(false)
// hook_func('libc.so','openat')
// native_trace("libnativeLib.so",0x1208,0x14d);
// native_print("libnativeLib.so",0x1208)
// sktrace('libnativeLib.so')
//java
// trace_change()
// trace("com.cyjh.mobileanjian.vip.p377m.RootUtil",'upgradeRootPermission')
// trace('com.appsflyer.internal.AFLogger')
// ---------------常用java类-------------
// trace('dalvik.system.DexPathList')
// trace('dalvik.system.DexClassLoader')
// trace('dalvik.system.BaseDexClassLoader')
// ---------------mlbb日志-------------
// mlbb的日志-1
// trace("com.ss.android.common.util.b")
// mlbb的日志-2
// trace('com.ss.android.common.applog.AppLog')
// 发送日志加密类
// trace('com.ss.android.common.applog.NetUtil')
// 日志发送的请求类
// trace("gsdk.impl.crash.isolate.b")
// trace('com.adjust.sdk.AdjustConfig')
// trace('com.adjust.sdk.network.ActivityPackageSender')
trace('com.moba.unityplugin.MobaGameUnityActivity');
// trace('com.moba.unityplugin.MobaGameMainActivityWithExtractor')
// mlbb的getDeviceId、getOpenUdid、getInstallId、getClientUDID
// trace("com.ss.android.deviceregister.core.e",'getDeviceId')
// trace('com.ss.android.deviceregister.core.cache.internal.a','a')
// trace('com.appsflyer.internal.AFa1xSDK$AFa1zSDK$AFa1zSDK','AFInAppEventType')
// trace('com.appsflyer.internal.AFa1ySDK')
// setTimeout(trace,1000,'com.appsflyer.internal.AFa1ySDK')
// setTimeout(trace,3000,'com.alibaba.minilibc.android.MtopMethodJniBridge')
// all_java('com.alibaba.minilibc.android.MtopMethodJniBridge')
// setTimeout(all_java,5000)
// findClass()
// hook_file()
// trace('com.alibaba.wireless.security.open.SecException')
// trace('com.uc.crashsdk.JNIBridge')
// setTimeout(trace,1000,'com.appsflyer.internal.AFa1xSDK$AFa1wSDK','values')
// hook_hashmap()
// trace('java.util.HashMap','put')
// trace('ava.lang.reflect.Method','invoke')
// hook_string()
// encryption()
// anti_InMemoryDexClassLoader()
});
✄
export {};
✄
export declare function hook_file(): void;
✄
{"version":3,"file":"file.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/java/file.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,SAAS;IACrB,IAAI,CAAC,OAAO,CAAC;QACT,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAEpC,gBAAgB;QAChB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,cAAc,GAAG,UAAU,IAAI;YACnE,OAAO,CAAC,GAAG,CAAC,iCAAiC,GAAG,IAAI,CAAC,CAAC;YAEtD,IAAG;gBACC,IAAI,SAAS,GAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzC,QAAQ;gBACR,OAAO,CAAC,GAAG,CAAC,aAAa,GAAE,SAAS,CAAC,CAAC;aACzC;YAAA,OAAM,CAAC,EAAC;gBACL,iBAAiB;aACpB;YAED,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,gBAAgB;QAChB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,cAAc,GAAG,UAAU,OAAO,EAAE,QAAQ;YACpG,OAAO,CAAC,GAAG,CAAC,oCAAoC,GAAG,OAAO,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC;YAExF,QAAQ;YACR,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;YAEtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
✄
export function hook_file() {
Java.perform(function () {
var File = Java.use('java.io.File');
// Hook File构造函数
File.$init.overload('java.lang.String').implementation = function (path) {
console.log('File constructor hooked, path: ' + path);
try {
var file_name = this.getName.call(this);
// 输出文件名
console.log('File name: ' + file_name);
}
catch (e) {
// console.log(e)
}
return this.$init.call(this, path);
};
// Hook File构造函数
File.$init.overload('java.lang.String', 'java.lang.String').implementation = function (dirPath, fileName) {
console.log('File constructor hooked, dirPath: ' + dirPath + ', fileName: ' + fileName);
// 输出文件名
console.log('File name: ' + fileName);
return this.$init.call(this, dirPath, fileName);
};
});
}
✄
export declare function hook_string(): void;
✄
{"version":3,"file":"stringBuilder.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/java/stringBuilder.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,WAAW;IAE3B,2DAA2D;IACzD,oFAAoF;IACpF,qBAAqB;IACrB,kFAAkF;IAClF,0EAA0E;IAC1E,mCAAmC;IACnC,0CAA0C;IAC1C,kFAAkF;IAClF,0CAA0C;IAE1C,qBAAqB;IACrB,mCAAmC;IACnC,mBAAmB;IACnB,KAAK;IAEH,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACzD,aAAa,CAAC,QAAQ,CAAC,cAAc,GAAG;QACvC,IAAI,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1B,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,KAAK,IAAI,EAAC;YACb,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;AACN,CAAC;AAED,yCAAyC;AAIzC,yFAAyF;AACzF,6CAA6C;AAC7C,0HAA0H;AAC1H,wCAAwC;AACxC,uBAAuB;AACvB,kCAAkC;AAClC,SAAS;AACT,IAAI"}
✄
export function hook_string() {
// var targetClass = Java.use("java.lang.StringBuilder");
// targetClass.append.overload('java.lang.String').implementation = function (str) {
// var output = '';
// output = output.concat("=================String.append====================");
// output = output.concat("str: " + str + " => " + JSON.stringify(str));
// output = output.concat("\r\n")
// output = output.concat(stacktrace());
// output = output.concat("=================String.append====================");
// if (output.indexOf("AFa1wSDK") != -1)
// log(output);
// var retval = this.append(str);
// return retval;
// };
const StringBuilder = Java.use('java.lang.StringBuilder');
StringBuilder.toString.implementation = function () {
var res = this.toString();
var tmp = "";
if (res !== null) {
tmp = res.toString().replace("/n", "");
console.log(tmp);
}
return res;
};
}
// export function hook_stringBuilder() {
// StringBuilder.$init.overload('java.lang.String').implementation = function (str) {
// var output = str.toString() + '\n'
// output=output.concat(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new()));
// output=output.concat("\r\n");
// log(output);
// return this.$init(str);
// };
// }
✄
export declare function _trace(targetClass: any, method: any): void;
export declare function findAllJavaClasses(targetClass: any, targetMethod: any, is_trace: any): void;
export declare function trace(targetClass: any, targetMethod: any): void;
✄
{"version":3,"file":"trace.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/java/trace.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,GAAG,EAA4B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE5E,SAAS,cAAc,CAAC,GAAG,EAAE,IAAI;IAC7B,IAAI;QACA,OAAO,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC;KAClD;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KACnC;AACL,CAAC;AAED,SAAS,SAAS,CAAC,MAAM;IACrB,IAAI,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE;QACnC,IAAI,MAAM,CAAC,OAAO,IAAI,SAAS,EAAE;YAC7B,OAAO,MAAM,CAAC,OAAO,CAAC;SACzB;KACJ;IACD,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;QAC9B,IAAI,MAAM,CAAC,EAAE,IAAI,SAAS,EAAE;YACxB,OAAO,MAAM,CAAC,EAAE,CAAC;SACpB;KACJ;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM;AACN,SAAS,aAAa,CAAC,GAAG,EAAE,KAAK;IAC7B,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,SAAS,GAAG,IAAI,CAAC;IACrB,IAAI,SA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AAA;gBACvC,IAAI,GAAG,IAAI,CAAC;gBACZ,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC1B,MAAM,CAAC,KAAK,EAAC,YAAY,CAAC,CAAC;aAC9B;QACL,CAAC;QACD,UAAU,EAAE;YACR,GAAG,CAAC,yBAAyB,CAAC,CAAA;QAClC,CAAC;KACJ,CAAC,CAAC;IAEH,IAAI,MAAM,GAAG,oBAAoB,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC;IACpF,aAAa,CAAC,OAAO,CAAC,UAAU,MAAM;QAClC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC,CAAA;IACF,GAAG,CAAC,MAAM,CAAC,CAAA;AACf,CAAC;AAGD,MAAM,UAAU,KAAK,CAAC,WAAW,EAAE,YAAY;IAC3C,qDAAqD;IAErD,qBAAqB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AACrD,CAAC"}
✄
//@ts-nocheck
import { log, stacktrace } from "../utils/log.js";
function hasOwnProperty(obj, name) {
try {
return obj.hasOwnProperty(name) || name in obj;
}
catch (e) {
return obj.hasOwnProperty(name);
}
}
function getHandle(object) {
if (hasOwnProperty(object, '$handle')) {
if (object.$handle != undefined) {
return object.$handle;
}
}
if (hasOwnProperty(object, '$h')) {
if (object.$h != undefined) {
return object.$h;
}
}
return null;
}
//查看域值
function inspectObject(obj, input) {
var isInstance = false;
var obj_class = null;
if (getHandle(obj) === null) {
obj_class = obj.class;
}
else {
var Class = Java.use("java.lang.Class");
obj_class = Java.cast(obj.getClass(), Class);
isInstance = true;
}
input = input.concat("Inspecting Fields: => ", isInstance, " => ", obj_class.toString());
input = input.concat("\n");
var fields = obj_class.getDeclaredFields();
for (var i in fields) {
if (isInstance || Boolean(fields[i].toString().indexOf("static ") >= 0)) {
// output = output.concat("\t\t static static static " + fields[i].toString());
var className = obj_class.toString().trim().split(" ")[1];
// console.Red("className is => ",className);
var fieldName = fields[i].toString().split(className.concat(".")).pop();
var fieldType = fields[i].toString().split(" ").slice(-2)[0];
var fieldValue = undefined;
if (!(obj[fieldName] === undefined))
fieldValue = obj[fieldName].value;
input = input.concat(fieldType + " \t" + fieldName + " => ", fieldValue + " => ", JSON.stringify(fieldValue));
input = input.concat("\n");
}
}
return input;
}
function bytes2hex(array) {
// var result=Java.use("java.util.Arrays").toString();
//把结果存到数组里
var result = "";
for (var i = 0; i < array.length; ++i) {
result += array[i].charCodeAt(0);
result += ",";
}
return result;
}
function getReflectFields(val1, output) {
var clazz = Java.use("java.lang.Class");
var parametersTest = Java.cast(val1.getClass(), clazz);
//getDeclaredFields()获取所有字段
var fields = parametersTest.getDeclaredFields();
fields.forEach(function (field) {
output = output.concat("field type is: " + (field.getType()) + "\n");
output = output.concat("field name is: " + (field.getName()) + "\n");
output = output.concat("field value is: " + field.get(val1) + "\n");
});
return output;
}
function getReflectMethod(val1) {
try {
var clazz = Java.use("java.lang.Class");
var parametersTest = Java.cast(val1.getClass(), clazz);
//getDeclaredMethods()获取所有方法
var methods = parametersTest.getDeclaredMethods();
methods.forEach(function (method) {
var methodName = method.getName();
var val1Class = val1.getClass();
var val1ClassName = Java.use(val1Class.getName());
var overloads = val1ClassName[methodName].overloads;
overloads.forEach(function (overload) {
var proto = "(";
overload.argumentTypes.forEach(function (type) {
proto += type.className + ", ";
});
if (proto.length > 1) {
proto = proto.substr(0, proto.length - 2);
}
proto += ")";
overload.implementation = function () {
var args = [];
for (var j = 0; j < arguments.length; j++) {
for (var i in arguments[j]) {
var value = String(arguments[j][i]);
send(val1ClassName + "." + methodName + " and arguments value is: " + value);
}
args[j] = arguments[j] + "";
}
//打印方法参数
send(val1ClassName + "." + methodName + " and args is: " + args);
//调用方法
var retval = this[methodName].apply(this, arguments);
//打印方法返回值
send(methodName + " return value is: " + retval);
return retval; //返回方法返回值
};
});
});
}
catch (e) {
send("'" + val1 + "' hook fail: " + e);
}
}
function traceMethod(targetMethod, unparseMethod) {
log("targetMethod: " + targetMethod);
var delim = targetMethod.lastIndexOf(".");
var targetClass = targetMethod.slice(0, delim);
var targetMethod = targetMethod.slice(delim + 1, targetMethod.length);
var hook = Java.use(targetClass);
if (!hook[targetMethod]) {
log("Class not found: " + targetClass);
return;
}
var overloadCount = hook[targetMethod].overloads.length;
//多个函数重载会有一个问题,当参数是Object[] objArr,不能给它赋值,因此需要单独重载特定参数函数
// hook["values"].overload('java.lang.String', 'java.lang.String', 'int').implementation = function (str, str2, i) {
// console.log(`AFa1xSDK.values is called: str=${str}, str2=${str2}, i=${i}`);
// var result = this["values"](str, str2, i);
// console.log(`AFa1xSDK.values result=${result}`);
// return result;
// };
for (var i = 0; i < overloadCount; i++) {
hook[targetMethod].overloads[i].implementation = function () {
var output = "";
//画个横线
for (var p = 0; p < 100; p++) {
output = output.concat("==");
}
output = output.concat("\n");
var retval = this[targetMethod].apply(this, arguments);
//域值
output = inspectObject(this, output);
// 进入函数
output = output.concat("*********entered " + unparseMethod + "********* \n");
for (var j = 0; j < arguments.length; j++) {
output = output.concat("arg[" + j + "]: " + arguments[j] + " => " + JSON.stringify(arguments[j]));
output = output.concat("\n");
}
//调用栈
var stacktraceLog = stacktrace();
output = output.concat(stacktraceLog);
// //返回值
output = output.concat("\n retval: " + retval + " => " + JSON.stringify(retval));
output = output.concat("\n-------------------test---------------------\n");
// 测试的地方
// 将retval转为hashmap
// var val1 = Java.cast(retval,Java.use("java.util.HashMap"));
// // 修改vpn_ip键的值改为''
// val1.put("vpn_ip","");
// retval = null;
// log(print_hashmap(retval))
// output = output.concat(this.e);
// console.log('CopyOnWriteArrayList values: ' + val.size());
//离开函数
output = output.concat("\n ********* exiting " + targetMethod + '*********\n');
//画个横线
for (var p = 0; p < 100; p++) {
output = output.concat("==");
}
// print_hashmap(retval)
log(output);
return retval;
};
}
}
export function _trace(targetClass, method) {
var output = "Tracing Class: " + hook + "\n";
var hook = Java.use(targetClass);
var methods = hook.class.getDeclaredMethods();
hook.$dispose();
var methodsDict = {};
output += "\t\nSpec: => \n";
methods.forEach(_method => {
_method = _method.toString();
output += _method + "\n";
var parsedMethod = _method.replace(targetClass + ".", "TOKEN").match(/\sTOKEN(.*)\(/)[1];
if (method && method.toLowerCase() !== parsedMethod.toLowerCase())
return;
methodsDict[_method] = parsedMethod;
});
//添加构造函数
var varructors = hook.class.getDeclaredConstructors();
if (varructors.length > 0) {
varructors.forEach(function (varructor) {
output += "Tracing " + varructor.toString() + "\n";
});
//有时候hook构造函数会报错,看情况取消
methodsDict["$init"] = '$init';
}
log(output);
//对数组中所有的方法进行hook,
for (var unparseMethod in methodsDict) {
var parsedMethod = methodsDict[unparseMethod];
traceMethod(targetClass + "." + parsedMethod, unparseMethod);
}
}
var BaseDexClassLoader = Java.use("dalvik.system.BaseDexClassLoader");
var classloader = Java.use("java.lang.ClassLoader");
var DexPathList = Java.use("dalvik.system.DexPathList");
var DexFile = Java.use("dalvik.system.DexFile");
var DexPathListElement = Java.use("dalvik.system.DexPathList$Element");
// 遍历所有类加载器并查找目标类
function findClassesInClassLoader(loader, targetClass, targetMethod, trace) {
var pathClassLoader = Java.cast(loader, BaseDexClassLoader);
// log("ClassLoader pathList: " + pathClassLoader.pathList.value);
var dexPathList = Java.cast(pathClassLoader.pathList.value, DexPathList);
// log("ClassLoader dexElements: " + dexPathList.dexElements.value.length);
for (var i = 0; i < dexPathList.dexElements.value.length; i++) {
var dexPathListElement = Java.cast(dexPathList.dexElements.value[i], DexPathListElement);
if (dexPathListElement.dexFile.value) {
var dexFile = Java.cast(dexPathListElement.dexFile.value, DexFile);
var mCookie = dexFile.mCookie.value;
if (dexFile.mInternalCookie.value) {
mCookie = dexFile.mInternalCookie.value;
}
var classNameArr = dexPathListElement.dexFile.value.getClassNameList(mCookie);
// log("dexFile.getClassNameList.length: " + classNameArr.length);
for (var i = 0; i < classNameArr.length; i++) {
var className = classNameArr[i];
if (className.includes(targetClass)) {
log("Find class: " + className);
if (trace) {
Java.classFactory.loader = loader;
}
}
}
}
}
}
// 钩住所有的类加载器
export function findAllJavaClasses(targetClass, targetMethod, is_trace) {
// // 第一种,不行,报错global reference table overflow,可以在返回值找到类,不能找到方法
// var loadClass = classloader["loadClass"].overloads.length;
// for (var i = 0; i < loadClass; i++) {
// classloader["loadClass"].overloads[i].implementation = function () {
// var retval = this["loadClass"].apply(this, arguments);
// var className = arguments[0];
// log("class:"+className);
// if (className.includes(targetClass)) {
// log("Find class: " + className);
// Java.classFactory.loader = this;
// Java.enumerateLoadedClasses({
// onMatch: function (clazz) {
// if (clazz.toLowerCase() == targetClass.toLowerCase()) {
// log('find targetClass class: ' + clazz)
// var method;
// var output = "Tracing Class: " + targetClass + "\n";
// var methods = retval.getDeclaredMethods()
// var methodsDict = {};
// output += "\t\nSpec: => \n";
// methods.forEach(_method => {
// _method = _method.toString()
// output += _method + "\n";
// var parsedMethod = _method.replace(targetClass + ".", "TOKEN").match(/\sTOKEN(.*)\(/)[1];
// if (method && method.toLowerCase() !== parsedMethod.toLowerCase())
// return;
// methodsDict[_method] = parsedMethod;
// });
// //添加构造函数
// var varructors = retval.getDeclaredConstructors();
// if (varructors.length > 0) {
// varructors.forEach(function (varructor) {
// output += "Tracing " + varructor.toString() + "\n";
// })
// //有时候hook构造函数会报错,看情况取消
// methodsDict["$init"]='$init';
// }
// log(output);
// //对数组中所有的方法进行hook,
// for (var unparseMethod in methodsDict) {
// var parsedMethod = methodsDict[unparseMethod];
// traceMethod(targetClass + "." + parsedMethod, unparseMethod);
// }
// }
// },
// onComplete: function () {
// log("Search Class Completed!")
// }
// });
// }
// return retval;
// }
// }
// jni指针错误
// var BaseDexClassLoader = Java.use("dalvik.system.BaseDexClassLoader");
// var loadClass = BaseDexClassLoader["findResource"].overloads.length;
// for (var i = 0; i < loadClass; i++) {
// BaseDexClassLoader["findResource"].overloads[i].implementation = function () {
// var retval = this["findResource"].apply(this, arguments);
// if (arguments[0].includes("com/appsflyer/internal")) {
// log("Find class: ");
// }
// return retval;
// }
// }
// // // 第三种,通过热加载dex的方式
// var overloadCount = BaseDexClassLoader["$init"].overloads.length;
// for (var i = 0; i < overloadCount; i++) {
// BaseDexClassLoader["$init"].overloads[i].implementation = function () {
// var retval = this["$init"].apply(this, arguments);
// findClassesInClassLoader(this, targetClass,targetMethod,trace);
// return retval;
// }
// }
}
function enumerateClassLoaders(targetClass, targetMethod) {
var find = false;
Java.enumerateClassLoaders({
onMatch: function (loader) {
try {
if (loader.findClass(targetClass)) {
log("Successfully found loader");
log("loader is : " + loader);
Java.classFactory.loader = loader;
log("Switch Classloader Successfully ! ");
}
}
catch (error) {
// console.log('enumerateClassLoaders error: ' + error + '\n')
}
},
onComplete: function () {
// log("EnumerateClassloader END")
}
});
log('Begin enumerateClasses ...');
var targetClasses = new Array();
Java.enumerateLoadedClasses({
onMatch: function (clazz) {
// console.log(clazz)
if (clazz.toLowerCase().indexOf(targetClass.toLowerCase()) > -1) {
// if (clazz.toLowerCase() == targetClass.toLowerCase()) {
log('find targetClass class: ' + clazz);
find = true;
targetClasses.push(clazz);
_trace(clazz, targetMethod);
}
},
onComplete: function () {
log("Search Class Completed!");
}
});
var output = "On Total Tracing :" + String(targetClasses.length) + " classes :\r\n";
targetClasses.forEach(function (target) {
output = output.concat(target);
output = output.concat("\r\n");
});
log(output);
}
export function trace(targetClass, targetMethod) {
// findAllJavaClasses(targetClass,targetMethod,true);
enumerateClassLoaders(targetClass, targetMethod);
}
✄
export declare function _trace(targetClass: any, method: any): void;
export declare function trace_change(target: any, method: any): void;
✄
{"version":3,"file":"trace_change.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/java/trace_change.ts"],"names":[],"mappings":"AAAA,aAAa;AAEb,OAAO,EAAE,GAAG,EAAiB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEjE,SAAS,kBAAkB,CAAC,IAAI;IAC5B,IAAI,UAAU,GAAG,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D,qDAAqD;oBACrD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;oBACzB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;iBACxB;YACL,CAAC;YACD,UAAU,EAAE;YACZ,CAAC;SACJ,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC"}
✄
//@ts-nocheck
import { log, stacktrace } from "../utils/log.js";
function extractPackageName(path) {
var startIndex = path.lastIndexOf('/');
var endIndex = path.indexOf('/', startIndex + 1);
if (startIndex !== -1 && endIndex !== -1) {
return path.substring(startIndex + 1, endIndex);
}
else {
return 'com.lazada.android'; // 无法提取包名时返回空字符串或其他默认值
}
}
function traceMethod(targetMethod, unparseMethod) {
var delim = targetMethod.lastIndexOf(".");
var targetClass = targetMethod.slice(0, delim);
var targetMethod = targetMethod.slice(delim + 1, targetMethod.length);
var hook = Java.use(targetClass);
if (!hook[targetMethod]) {
log("Class not found: " + targetClass);
return;
}
var overloadCount = hook[targetMethod].overloads.length;
for (var i = 0; i < overloadCount; i++) {
hook[targetMethod].overloads[i].implementation = function () {
var output = "";
for (var j = 0; j < arguments.length; j++) {
output = output.concat("arg[" + j + "]: " + arguments[j] + " => " + JSON.stringify(arguments[j]));
output = output.concat("\n");
}
var retval = this[targetMethod].apply(this, arguments);
// //返回值
output = output.concat("\n retval: " + retval + " => " + JSON.stringify(retval));
// 进入函数
output = output.concat("*********entered " + unparseMethod + "********* \n");
log("*********entered " + unparseMethod + "********* \n");
output = output.concat("\n----------------------------------------\n");
var stacktraceLog = stacktrace();
if (targetMethod == "getDataDir" && stacktraceLog.indexOf("com.lazada.android") != -1) {
var File = Java.use('java.io.File');
var path = retval.getPath();
if (path.indexOf('ratel') == -1) {
var replacedPath = path + '/app_ratel_env_mock/default_0/data/';
output = output.concat("replace path is => ", replacedPath, "\n");
var file = File.$new(replacedPath);
log(output);
return file;
}
}
// var context= arguments[0];
// var dir = context.getDir("SGLib",0);
// output = output.concat("dir is => ",dir.getAbsolutePath(),"\n");
// // var cls = "com.appsflyer.internal.AFf1cSDK"
// // var obj = Java.use(cls)
// // var csl2 = 'com.appsflyer.internal.AFa1xSDK'
// // var obj2 = Java.use(csl2)
// // output = output.concat("value values " + bytes2hex(obj2._values.value) + '\n');
// // output = output.concat("value AFInAppEventType " + bytes2hex(obj2._AFInAppEventType.value) + '\n');
// // output = output.concat("value AFKeystoreWrapper "+obj2._AFKeystoreWrapper.value.charCodeAt(0)+'\n');
// // output = output.concat("value AFf1cSDK.AFInAppEventType " + bytes2hex(obj.AFInAppEventType.value) + '\n');
// // output = output.concat("value AFf1cSDK.values " + obj.values.value.charCodeAt(0) + '\n');
// // output = output.concat("value AFf1cSDK.AFKeystoreWrapper " + obj.AFKeystoreWrapper.value.charCodeAt(0) + '\n');
// // output = output.concat("value AFf1cSDK.valueOf " + obj.valueOf.value + '\n');
// // output = output.concat("value AFf1cSDK.AFInAppEventParameterName " + obj.AFInAppEventParameterName.value + '\n');
// // output = output.concat("value AFf1cSDK.AFLogger " + obj.AFLogger.value + '\n');
// // output = output.concat("value AFf1cSDK.afErrorLog " + obj.afErrorLog.value + '\n');
// // output = output.concat(arguments[-1]+'\n')
output = output.concat("----------------------------------------\n");
//离开函数
output = output.concat("\n ********* exiting " + targetMethod + '*********\n');
log(output);
return retval;
};
}
}
export function _trace(targetClass, method) {
var output = "Tracing Class: " + targetClass + "\n";
var hook = Java.use(targetClass);
var methods = hook.class.getDeclaredMethods();
hook.$dispose();
var methodsDict = {};
methods.forEach(_method => {
_method = _method.toString();
var parsedMethod = _method.replace(targetClass + ".", "TOKEN").match(/\sTOKEN(.*)\(/)[1];
if (method && method.toLowerCase() !== parsedMethod.toLowerCase())
return;
methodsDict[parsedMethod] = _method;
});
var Targets = methodsDict;
//添加构造函数
var constructors = hook.class.getDeclaredConstructors();
if (constructors.length > 0) {
//有时候hook构造函数会报错,看情况取消
// methodsDict["$init"]='$init';
}
//对数组中所有的方法进行hook,
for (var parsedMethod in methodsDict) {
var unparseMethod = methodsDict[parsedMethod];
traceMethod(targetClass + "." + parsedMethod, unparseMethod);
}
}
export function trace_change(target, method) {
Java.perform(function () {
//有一种特殊的情况,需要use一下,才能hook到
try {
Java.use(target);
}
catch (error) {
// console.log(error)
}
// log('\ntrace begin ... !')
Java.enumerateClassLoaders({
onMatch: function (loader) {
try {
if (loader.findClass(target)) {
Java.classFactory.loader = loader;
}
}
catch (error) {
// console.log('enumerateClassLoaders error: ' + error + '\n')
}
},
onComplete: function () {
}
});
var targetClasses = new Array();
Java.enumerateLoadedClasses({
onMatch: function (clazz) {
if (clazz.toLowerCase().indexOf(target.toLowerCase()) > -1) {
// if (clazz.toLowerCase() == target.toLowerCase()) {
targetClasses.push(clazz);
_trace(clazz, method);
}
},
onComplete: function () {
}
});
});
}
✄
export declare function all_so(system?: boolean): void;
✄
{"version":3,"file":"all_so.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/so/all_so.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,uCAAuC;AAEvC,MAAM,UAAU,MAAM,CAAC,SAAkB,KAAK;IAC1C;QACI,OAAO,CAAC,gBAAgB,CAAC;YACrB,OAAO,EAAE,UAAU,MAAM;gBAErB,IAAI,MAAM,EAAE;oBACR,2HAA2H;oBAC3H,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,GAAG,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;iBACnI;qBAAM;oBACH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;wBACtC,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,GAAG,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;iBACnI;YACL,CAAC;YACD,UAAU,EAAE;YACZ,CAAC;SACJ,CAAC,CAAC;KACN;AACL,CAAC"}
✄
//@ts-nocheck
// import {log} from "../utils/log.js";
export function all_so(system = false) {
{
Process.enumerateModules({
onMatch: function (module) {
if (system) {
// log('Module name: ' + module.name + " - " + "Base Address: " + module.base.toString() + " - " + "path: " + module.path);
console.log('Module name: ' + module.name + " - " + "Base Address: " + module.base.toString() + " - " + "path: " + module.path);
}
else {
if (!module.path.includes('/data/app'))
console.log('Module name: ' + module.name + " - " + "Base Address: " + module.base.toString() + " - " + "path: " + module.path);
}
},
onComplete: function () {
}
});
}
}
✄
export declare function hook_func(so_name: any, addr: any): void;
export declare function _hook_func(so_name: any, func_name: any): void;
✄
{"version":3,"file":"hook_func.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/so/hook_func.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,MAAM,UAAU,SAAS,CAAC,OAAO,EAAE,IAAI;IACnC,IAAI,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAC7E,IAAI,kBAAkB,IAAI,IAAI,EAAE;QAC5B,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE;YACnC,OAAO,EAAE,UAAU,IAAI;gBACnB,IAAI,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;gBACnC,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC;gBACjC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE;oBAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;iBACpB;YACL,CAAC;YACD,OAAO,EAAE,UAAU,MAAM;gBACrB,IAAI,IAAI,CAAC,IAAI;oBACT,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAE;YACnC,CAAC;SACJ,CAAC,CAAC;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GAAG;IACtB,wCAAwC;IACxC,2CAA2C;IAC3C,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,UAAU,CAAC,IAAI,EAAE,IAAI;IAC1B,4BAA4B;IAC5B,IAAI,GAAG,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC1C,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAA;IACvG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE;QACrB,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,KAAK;KACd,CAAC,CAAC,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACnB,CAAC"}
✄
//@ts-nocheck
export function hook_func(so_name, addr) {
var android_dlopen_ext = Module.findExportByName(null, "android_dlopen_ext");
if (android_dlopen_ext != null) {
Interceptor.attach(android_dlopen_ext, {
onEnter: function (args) {
var soName = args[0].readCString();
console.log("soName: " + soName);
if (soName.indexOf(so_name) != -1) {
this.hook = true;
}
},
onLeave: function (retval) {
if (this.hook)
_hook_func(so_name, addr);
}
});
}
}
export function _hook_func(so_name, func_name) {
console.log('find so');
var so_addr = Module.findBaseAddress(so_name);
console.log('so_addr: ' + so_addr);
var func = Module.findExportByName(so_name, func_name);
console.log("[+] Hooking function: " + func);
Java.perform(function () {
Interceptor.attach(func, {
onEnter: function (args) {
console.log('enter');
// console.log(hexdump(this.context.PC))
// console.log("args[0] Intercepted: " + hexdump(args[0]))
// console.log("args[0] Intercepted: " + readStdString(args[1]))
// console.log("args[2] Intercepted: " + args[2])
// console.log("args[3] Intercepted: " + hexdump(args[3]))
// console.log("args[4] Intercepted: " + hexdump(args[4]))
// console.log("args[5] Intercepted: " + hexdump(args[5]))
// console.log("args[6] Intercepted: " + hexdump(args[6]))
// console.log("args[7] Intercepted: " + hexdump(args[7]))
// console.log("args[8] Intercepted: " + hexdump(args[8]))
// console.log("args[9] Intercepted: " + hexdump(args[9]))
// console.log("args[10] Intercepted: " + hexdump(args[10]))
// console.log("args[11] Intercepted: " + hexdump(args[11]))
// console.log("args[12] Intercepted: " + hexdump(args[12]))
console.log('*********************\nCCCryptorCreate called from:\n*********************' + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join('\n') + '\n');
},
onLeave: function (retval) {
console.log("[+] Returned: " + hexdump(retval));
// console.log("retval is :", retval)
return retval;
}
});
});
}
function readStdString(str) {
// console.log(Memory.readCString(str));
// console.log(Memory.readUtf8String(str));
return Memory.readUtf8String(str);
}
function print_dump(addr, size) {
//console(Memory.methods());
var buf = Memory.readByteArray(addr, size);
console.log("[function] send[*] " + addr.toString() + " " + "length: " + size.toString() + "\n[data]");
console.log(hexdump(buf, {
offset: 0,
length: size,
header: false,
ansi: false
}));
console.log("");
}
✄
export declare function init_array(): void;
✄
{"version":3,"file":"init_array.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/so/init_array.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,MAAM,UAAU,UAAU;IACtB,IAAI,OAAO,CAAC,WAAW,IAAI,CAAC,EAAE;QAC1B,IAAI,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACnD;SAAM;QACH,IAAI,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;KACrD;IAED,IAAI,kBAAkB,GAAE,IAAI,CAAC;IAC7B,IAAI,yBAAyB,GAAG,IAAI,CAAC;IACrC,IAAI,0BAA0B,GAAG,IAAI,CAAC;IACtC,IAAI,MAAM,EAAE;QACR,8BAA8B;QAC9B,IAAI,OAAO,GAAG,MAAM,CAAC,gBAAgB,EAAE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AC,MAAM,CAAC,GAAG,CAAC,EAAC;oBAC9D,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,YAAY;wBAC7D,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;oBAC1C,IAAI,IAAI,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,OAAO;oBAC/B,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM;oBACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;oBAC1B,IAAI,CAAC,WAAW,GAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;oBACzE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,EACzC,YAAY,EAAC,IAAI,CAAC,OAAO,EACzB,YAAY,EAAC,IAAI,CAAC,OAAO,EACzB,gBAAgB,EAAC,IAAI,CAAC,WAAW,CACnC,CAAC;oBACJ,YAAY;iBACd;YACL,CAAC;YACD,OAAO,EAAE,UAAS,MAAM;YACxB,CAAC;SACJ,CAAC,CAAA;KACL;AAGL,CAAC;AACD,yBAAyB"}
✄
//@ts-nocheck
export function init_array() {
if (Process.pointerSize == 4) {
var linker = Process.findModuleByName("linker");
}
else {
var linker = Process.findModuleByName("linker64");
}
var addr_call_function = null;
var addr_g_ld_debug_verbosity = null;
var addr_async_safe_format_log = null;
if (linker) {
//console.log("found linker");
var symbols = linker.enumerateSymbols();
for (var i = 0; i < symbols.length; i++) {
var name = symbols[i].name;
if (name.indexOf("call_function") >= 0) {
addr_call_function = symbols[i].address;
// console.log("call_function",JSON.stringify(symbols[i]));
}
else if (name.indexOf("g_ld_debug_verbosity") >= 0) {
addr_g_ld_debug_verbosity = symbols[i].address;
ptr(addr_g_ld_debug_verbosity).writeInt(2);
}
else if (name.indexOf("async_safe_format_log") >= 0 && name.indexOf('va_list') < 0) {
// console.log("async_safe_format_log",JSON.stringify(symbols[i]));
addr_async_safe_format_log = symbols[i].address;
}
}
}
if (addr_async_safe_format_log) {
Interceptor.attach(addr_async_safe_format_log, {
onEnter: function (args) {
this.log_level = args[0];
this.tag = ptr(args[1]).readCString();
this.fmt = ptr(args[2]).readCString();
if (this.fmt.indexOf("c-tor") >= 0 && this.fmt.indexOf('Done') < 0) {
this.function_type = ptr(args[3]).readCString(), // func_type
this.so_path = ptr(args[5]).readCString();
var strs = new Array(); //定义一数组
strs = this.so_path.split("/"); //字符分割
this.so_name = strs.pop();
this.func_offset = ptr(args[4]).sub(Module.findBaseAddress(this.so_name));
console.log("func_type:", this.function_type, '\nso_name:', this.so_name, '\nso_path:', this.so_path, '\nfunc_offset:', this.func_offset);
// hook代码在这加
}
},
onLeave: function (retval) {
}
});
}
}
// setTimeout(init_array)
✄
export declare function inline_hook(so_name: any, addr: any): void;
export declare function _inline_hook(so_name: any, addr: any): void;
✄
{"version":3,"file":"inlinehook.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/so/inlinehook.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,MAAM,UAAU,WAAW,CAAC,OAAO,EAAE,IAAI;IACrC,IAAI,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAC7E,IAAI,kBAAkB,IAAI,IAAI,EAAE;QAC5B,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE;YACnC,OAAO,EAAE,UAAU,IAAI;gBACnB,IAAI,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;gBACnC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE;oB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CAAC,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;gBAC/C,qCAAqC;gBACrC,OAAO,MAAM,CAAC;YAClB,CAAC;SACJ,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,aAAa,CAAC,GAAG;IACtB,wCAAwC;IACxC,2CAA2C;IAC3C,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,UAAU,CAAC,IAAI,EAAE,IAAI;IAC1B,4BAA4B;IAC5B,IAAI,GAAG,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC1C,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAA;IACvG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE;QACrB,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,KAAK;KACd,CAAC,CAAC,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACnB,CAAC"}
✄
//@ts-nocheck
export function inline_hook(so_name, addr) {
var android_dlopen_ext = Module.findExportByName(null, "android_dlopen_ext");
if (android_dlopen_ext != null) {
Interceptor.attach(android_dlopen_ext, {
onEnter: function (args) {
var soName = args[0].readCString();
if (soName.indexOf(so_name) != -1) {
this.hook = true;
}
},
onLeave: function (retval) {
if (this.hook)
_inline_hook(so_name, addr);
}
});
}
}
export function _inline_hook(so_name, addr) {
console.log('find so');
var so_addr = Module.findBaseAddress(so_name);
console.log('so_addr: ' + so_addr);
var func = so_addr.add(addr);
console.log("[+] Hooking function: " + func);
Java.perform(function () {
Interceptor.attach(func, {
onEnter: function (args) {
console.log('enter');
// console.log(hexdump(this.context.PC))
// console.log("args[0] Intercepted: " + hexdump(args[0]))
// console.log("args[0] Intercepted: " + readStdString(args[1]))
// console.log("args[2] Intercepted: " + args[2])
// console.log("args[3] Intercepted: " + hexdump(args[3]))
// console.log("args[4] Intercepted: " + hexdump(args[4]))
// console.log("args[5] Intercepted: " + hexdump(args[5]))
// console.log("args[6] Intercepted: " + hexdump(args[6]))
// console.log("args[7] Intercepted: " + hexdump(args[7]))
// console.log("args[8] Intercepted: " + hexdump(args[8]))
// console.log("args[9] Intercepted: " + hexdump(args[9]))
// console.log("args[10] Intercepted: " + hexdump(args[10]))
// console.log("args[11] Intercepted: " + hexdump(args[11]))
// console.log("args[12] Intercepted: " + hexdump(args[12]))
console.log('*********************\nCCCryptorCreate called from:\n*********************' + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join('\n') + '\n');
},
onLeave: function (retval) {
console.log("[+] Returned: " + hexdump(retval));
// console.log("retval is :", retval)
return retval;
}
});
});
}
function readStdString(str) {
// console.log(Memory.readCString(str));
// console.log(Memory.readUtf8String(str));
return Memory.readUtf8String(str);
}
function print_dump(addr, size) {
//console(Memory.methods());
var buf = Memory.readByteArray(addr, size);
console.log("[function] send[*] " + addr.toString() + " " + "length: " + size.toString() + "\n[data]");
console.log(hexdump(buf, {
offset: 0,
length: size,
header: false,
ansi: false
}));
console.log("");
}
✄
export {};
✄
{"version":3,"file":"scan.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/so/scan.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,0FAA0F;AAC1F,2BAA2B;;AAE3B,uEAAuE;AAEvE,+FAA+F;AAC/F,4EAA4E;AAC5E,oLAAoL;AACpL,aAAa;AACb,qCAAqC;AACrC,qBAAqB;AACrB,sCAAsC;AACtC,aAAa;AACb,oCAAoC;AACpC,qCAAqC;AACrC,YAAY;AACZ,UAAU;AACV,IAAI;AAEJ,iEAAiE;AACjE,iFAAiF"}
✄
// //@ts-nocheck
// var _m = Process.enumerateModules();// enumerate loaded modules and take the first on_m
// for (var module of _m) {
export {};
// var pattern = 'C7 C7 65 47 65 74 44 65 78 44 61 74 61 00 35 30'
// Memory.scan(/*NativePointer*/ module.base, /*number*/ module.size, /*string*/ pattern, {
// onMatch: function (address, size) {// called when pattern matches
// console.log("Memory.scan() found at " + address +'Module name: ' + module.name + " - " + "Base Address: " + module.base.toString() + " - " + "path: " + module.path);
// },
// onError: function(reason){
// //搜索失败
// // console.log('搜索失败');
// },
// onComplete: function () {
// // console.log("搜索完毕")
// }
// });
// }
// // var results = Memory.scanSync(m.base, m.size, pattern);
// // console.log("Memory.scanSync() result = \n" + JSON.stringify(results));
✄
export declare function sktrace(so_name: any): void;
✄
{"version":3,"file":"sktrace.js","sourceRoot":"/home/thouger/Desktop/code/frida_script/","sources":["src/so/sktrace/sktrace.ts"],"names":[],"mappings":"AAAA,aAAa;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyF3B,EAAE;IACC,UAAU,EAAE,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE;QACxC,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACpB,gBAAgB;IAClB,CAAC,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;CAC5B,CAAC,CAAC;AAGH,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChD,SAAS,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI;IACvC,0DAA0D;IAC1D,WAAW;IACX,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;IAC3B,MAAM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G,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,SAAS,CAAC,aAAa,CAAC,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAO;IAC3B,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;AAC3C,CAAC"}
✄
//@ts-nocheck
import { hook_dlopen } from "../utils.js";
const arm64CM = new CModule(`
#include <gum/gumstalker.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern void on_message(const gchar *message);
static void log(const gchar *format, ...);
static void on_arm64_before(GumCpuContext *cpu_context, gpointer user_data);
static void on_arm64_after(GumCpuContext *cpu_context, gpointer user_data);
void hello() {
on_message("Hello form CModule");
}
gpointer shared_mem[] = {0, 0};