frida-java-bridge 6.3.0 → 6.3.2

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.
@@ -2193,6 +2193,7 @@ class DexFile {
2193
2193
  const file = new File(filePath, 'w');
2194
2194
  file.write(buffer.buffer);
2195
2195
  file.close();
2196
+ setReadOnlyDex(filePath, factory);
2196
2197
 
2197
2198
  return new DexFile(filePath, fileValue, factory);
2198
2199
  }
@@ -2251,6 +2252,12 @@ function createTemporaryDex (factory) {
2251
2252
  return JFile.createTempFile(tempFileNaming.prefix, tempFileNaming.suffix + '.dex', cacheDirValue);
2252
2253
  }
2253
2254
 
2255
+ function setReadOnlyDex (filePath, factory) {
2256
+ const JFile = factory.use('java.io.File');
2257
+ const file = JFile.$new(filePath);
2258
+ file.setWritable(false, false);
2259
+ }
2260
+
2254
2261
  function getFactoryCache () {
2255
2262
  switch (factoryCache.state) {
2256
2263
  case 'empty': {
package/lib/mkdex.js CHANGED
@@ -655,6 +655,7 @@ function computeModel (classes) {
655
655
  stringToIndex[fieldName]
656
656
  ];
657
657
  });
658
+ fieldItems.sort(compareFieldItems);
658
659
 
659
660
  const methodItems = methods.map(method => {
660
661
  const [klass, protoId, name, annotationsId] = method;
@@ -744,7 +745,7 @@ function computeModel (classes) {
744
745
  const instanceFields = fieldItems.reduce((result, field, index) => {
745
746
  const [holder] = field;
746
747
  if (holder === classIndex) {
747
- result.push([index, kAccPublic]);
748
+ result.push([index > 0 ? 1 : 0, kAccPublic]);
748
749
  }
749
750
  return result;
750
751
  }, []);
@@ -848,6 +849,21 @@ function compareProtoItems (a, b) {
848
849
  return 0;
849
850
  }
850
851
 
852
+ function compareFieldItems (a, b) {
853
+ const [aClass, aType, aName] = a;
854
+ const [bClass, bType, bName] = b;
855
+
856
+ if (aClass !== bClass) {
857
+ return aClass - bClass;
858
+ }
859
+
860
+ if (aName !== bName) {
861
+ return aName - bName;
862
+ }
863
+
864
+ return aType - bType;
865
+ }
866
+
851
867
  function compareMethodItems (a, b) {
852
868
  const [aClass, aProto, aName] = a;
853
869
  const [bClass, bProto, bName] = b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-java-bridge",
3
- "version": "6.3.0",
3
+ "version": "6.3.2",
4
4
  "description": "Java runtime interop from Frida",
5
5
  "main": "index.js",
6
6
  "files": [