frida-java-bridge 7.0.6 → 7.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android.js +22 -12
- package/package.json +1 -1
package/lib/android.js
CHANGED
|
@@ -312,6 +312,7 @@ function _getApi () {
|
|
|
312
312
|
|
|
313
313
|
// Android >= 11
|
|
314
314
|
_ZN3art3jni12JniIdManager14DecodeMethodIdEP10_jmethodID: ['art::jni::JniIdManager::DecodeMethodId', 'pointer', ['pointer', 'pointer']],
|
|
315
|
+
_ZN3art3jni12JniIdManager13DecodeFieldIdEP9_jfieldID: ['art::jni::JniIdManager::DecodeFieldId', 'pointer', ['pointer', 'pointer']],
|
|
315
316
|
_ZN3art11interpreter18GetNterpEntryPointEv: ['art::interpreter::GetNterpEntryPoint', 'pointer', []],
|
|
316
317
|
|
|
317
318
|
_ZN3art7Monitor17TranslateLocationEPNS_9ArtMethodEjPPKcPi: ['art::Monitor::TranslateLocation', 'void', ['pointer', 'uint32', 'pointer', 'pointer']]
|
|
@@ -370,6 +371,7 @@ function _getApi () {
|
|
|
370
371
|
'_ZN3art3Dbg20ManageDeoptimizationEv',
|
|
371
372
|
'_ZN3art3Dbg9gRegistryE',
|
|
372
373
|
'_ZN3art3jni12JniIdManager14DecodeMethodIdEP10_jmethodID',
|
|
374
|
+
'_ZN3art3jni12JniIdManager13DecodeFieldIdEP9_jfieldID',
|
|
373
375
|
'_ZN3art11interpreter18GetNterpEntryPointEv',
|
|
374
376
|
'_ZN3art7Monitor17TranslateLocationEPNS_9ArtMethodEjPPKcPi'
|
|
375
377
|
])
|
|
@@ -967,14 +969,14 @@ export function getArtClassSpec (vm) {
|
|
|
967
969
|
const fInfo = {
|
|
968
970
|
artArrayLengthSize: 4,
|
|
969
971
|
artArrayEntrySize: fieldSpec.size,
|
|
970
|
-
// java/
|
|
971
|
-
artArrayMax:
|
|
972
|
+
// java/lang/Thread has 36 fields on Android 16.
|
|
973
|
+
artArrayMax: 50
|
|
972
974
|
};
|
|
973
975
|
|
|
974
976
|
const mInfo = {
|
|
975
977
|
artArrayLengthSize: pointerSize,
|
|
976
978
|
artArrayEntrySize: methodSpec.size,
|
|
977
|
-
// java/
|
|
979
|
+
// java/lang/Thread has 79 methods on Android 16.
|
|
978
980
|
artArrayMax: 100
|
|
979
981
|
};
|
|
980
982
|
|
|
@@ -1015,7 +1017,7 @@ export function getArtClassSpec (vm) {
|
|
|
1015
1017
|
return false;
|
|
1016
1018
|
};
|
|
1017
1019
|
|
|
1018
|
-
const clazz = env.findClass('java/
|
|
1020
|
+
const clazz = env.findClass('java/lang/Thread');
|
|
1019
1021
|
const clazzRef = env.newGlobalRef(clazz);
|
|
1020
1022
|
|
|
1021
1023
|
try {
|
|
@@ -1024,8 +1026,8 @@ export function getArtClassSpec (vm) {
|
|
|
1024
1026
|
object = getApi()['art::JavaVMExt::DecodeGlobal'](vm, thread, clazzRef);
|
|
1025
1027
|
});
|
|
1026
1028
|
|
|
1027
|
-
const fieldInstance = env.getFieldId(clazzRef, '
|
|
1028
|
-
const fieldStatic = env.getStaticFieldId(clazzRef, '
|
|
1029
|
+
const fieldInstance = unwrapFieldId(env.getFieldId(clazzRef, 'name', 'Ljava/lang/String;'));
|
|
1030
|
+
const fieldStatic = unwrapFieldId(env.getStaticFieldId(clazzRef, 'MAX_PRIORITY', 'I'));
|
|
1029
1031
|
|
|
1030
1032
|
let offsetStatic = -1;
|
|
1031
1033
|
let offsetInstance = -1;
|
|
@@ -1038,20 +1040,20 @@ export function getArtClassSpec (vm) {
|
|
|
1038
1040
|
}
|
|
1039
1041
|
}
|
|
1040
1042
|
if (offsetInstance === -1 || offsetStatic === -1) {
|
|
1041
|
-
throw new Error('Unable to find fields in java/
|
|
1043
|
+
throw new Error('Unable to find fields in java/lang/Thread; please file a bug');
|
|
1042
1044
|
}
|
|
1043
1045
|
const sfieldOffset = (offsetInstance !== offsetStatic) ? offsetStatic : 0;
|
|
1044
1046
|
const ifieldOffset = offsetInstance;
|
|
1045
1047
|
|
|
1046
1048
|
let offsetMethods = -1;
|
|
1047
|
-
const methodInstance = env.getMethodId(clazzRef, '
|
|
1049
|
+
const methodInstance = unwrapMethodId(env.getMethodId(clazzRef, 'getName', '()Ljava/lang/String;'));
|
|
1048
1050
|
for (let offset = 0; offset !== MAX_OFFSET; offset += 4) {
|
|
1049
1051
|
if (offsetMethods === -1 && hasEntry(object, offset, methodInstance, mInfo)) {
|
|
1050
1052
|
offsetMethods = offset;
|
|
1051
1053
|
}
|
|
1052
1054
|
}
|
|
1053
1055
|
if (offsetMethods === -1) {
|
|
1054
|
-
throw new Error('Unable to find methods in java/
|
|
1056
|
+
throw new Error('Unable to find methods in java/lang/Thread; please file a bug');
|
|
1055
1057
|
}
|
|
1056
1058
|
|
|
1057
1059
|
let offsetCopiedMethods = -1;
|
|
@@ -1064,7 +1066,7 @@ export function getArtClassSpec (vm) {
|
|
|
1064
1066
|
}
|
|
1065
1067
|
}
|
|
1066
1068
|
if (offsetCopiedMethods === -1) {
|
|
1067
|
-
throw new Error('Unable to find copied methods in java/
|
|
1069
|
+
throw new Error('Unable to find copied methods in java/lang/Thread; please file a bug');
|
|
1068
1070
|
}
|
|
1069
1071
|
|
|
1070
1072
|
spec = {
|
|
@@ -2959,6 +2961,14 @@ export function revertGlobalPatches () {
|
|
|
2959
2961
|
}
|
|
2960
2962
|
|
|
2961
2963
|
function unwrapMethodId (methodId) {
|
|
2964
|
+
return unwrapGenericId(methodId, 'art::jni::JniIdManager::DecodeMethodId');
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
function unwrapFieldId (fieldId) {
|
|
2968
|
+
return unwrapGenericId(fieldId, 'art::jni::JniIdManager::DecodeFieldId');
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
function unwrapGenericId (genericId, apiMethod) {
|
|
2962
2972
|
const api = getApi();
|
|
2963
2973
|
|
|
2964
2974
|
const runtimeOffset = getArtRuntimeSpec(api).offset;
|
|
@@ -2972,11 +2982,11 @@ function unwrapMethodId (methodId) {
|
|
|
2972
2982
|
|
|
2973
2983
|
if (jniIdsIndirection !== kPointer) {
|
|
2974
2984
|
const jniIdManager = runtime.add(jniIdManagerOffset).readPointer();
|
|
2975
|
-
return api[
|
|
2985
|
+
return api[apiMethod](jniIdManager, genericId);
|
|
2976
2986
|
}
|
|
2977
2987
|
}
|
|
2978
2988
|
|
|
2979
|
-
return
|
|
2989
|
+
return genericId;
|
|
2980
2990
|
}
|
|
2981
2991
|
|
|
2982
2992
|
const artQuickCodeReplacementTrampolineWriters = {
|