frida-java-bridge 4.6.0 → 5.2.1

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/index.js CHANGED
@@ -576,6 +576,6 @@ function initFactoryFromLoadedApk (factory, apk) {
576
576
  }
577
577
 
578
578
  const runtime = new Runtime();
579
- WeakRef.bind(runtime, () => { runtime._dispose(); });
579
+ Script.bindWeak(runtime, () => { runtime._dispose(); });
580
580
 
581
581
  module.exports = runtime;
package/lib/android.js CHANGED
@@ -1541,7 +1541,7 @@ set_replacement_method (gpointer original_method,
1541
1541
  g_mutex_lock (&lock);
1542
1542
 
1543
1543
  g_hash_table_insert (methods, original_method, replacement_method);
1544
- g_hash_table_add (replacements, replacement_method);
1544
+ g_hash_table_insert (replacements, replacement_method, original_method);
1545
1545
 
1546
1546
  g_mutex_unlock (&lock);
1547
1547
  }
@@ -1563,6 +1563,20 @@ delete_replacement_method (gpointer original_method)
1563
1563
  g_mutex_unlock (&lock);
1564
1564
  }
1565
1565
 
1566
+ gpointer
1567
+ translate_method (gpointer method)
1568
+ {
1569
+ gpointer translated_method;
1570
+
1571
+ g_mutex_lock (&lock);
1572
+
1573
+ translated_method = g_hash_table_lookup (replacements, method);
1574
+
1575
+ g_mutex_unlock (&lock);
1576
+
1577
+ return (translated_method != NULL) ? translated_method : method;
1578
+ }
1579
+
1566
1580
  gpointer
1567
1581
  find_replacement_method_from_quick_code (gpointer method,
1568
1582
  gpointer thread)
@@ -1691,6 +1705,7 @@ on_leave_gc_concurrent_copying_copying_phase (GumInvocationContext * ic)
1691
1705
  get: new NativeFunction(cm.get_replacement_method, 'pointer', ['pointer'], fastOptions),
1692
1706
  set: new NativeFunction(cm.set_replacement_method, 'void', ['pointer', 'pointer'], fastOptions),
1693
1707
  delete: new NativeFunction(cm.delete_replacement_method, 'void', ['pointer'], fastOptions),
1708
+ translate: new NativeFunction(cm.translate_method, 'pointer', ['pointer'], fastOptions),
1694
1709
  findReplacementFromQuickCode: cm.find_replacement_method_from_quick_code
1695
1710
  },
1696
1711
  getOatQuickMethodHeaderImpl,
@@ -1793,6 +1808,10 @@ function makeMethodMangler (methodId) {
1793
1808
  return new MethodMangler(methodId);
1794
1809
  }
1795
1810
 
1811
+ function translateMethod (methodId) {
1812
+ return artController.replacedMethods.translate(methodId);
1813
+ }
1814
+
1796
1815
  function revertGlobalPatches () {
1797
1816
  patchedClasses.forEach(entry => {
1798
1817
  entry.vtablePtr.writePointer(entry.vtable);
@@ -4045,6 +4064,7 @@ module.exports = {
4045
4064
  ArtStackVisitor,
4046
4065
  ArtMethod,
4047
4066
  makeMethodMangler,
4067
+ translateMethod,
4048
4068
  revertGlobalPatches,
4049
4069
  deoptimizeEverything,
4050
4070
  deoptimizeBootImage,
@@ -265,7 +265,7 @@ class ClassFactory {
265
265
  wrap (handle, klass, env) {
266
266
  const C = klass.$C;
267
267
  const wrapper = new C(handle, STRATEGY_VIRTUAL, env, false);
268
- wrapper.$r = WeakRef.bind(wrapper, vm.makeHandleDestructor(handle));
268
+ wrapper.$r = Script.bindWeak(wrapper, vm.makeHandleDestructor(handle));
269
269
  return wrapper;
270
270
  }
271
271
 
@@ -746,7 +746,7 @@ function Wrapper (handle, strategy, env, owned = true) {
746
746
  if (owned) {
747
747
  const h = env.newGlobalRef(handle);
748
748
  this.$h = h;
749
- this.$r = WeakRef.bind(this, vm.makeHandleDestructor(h));
749
+ this.$r = Script.bindWeak(this, vm.makeHandleDestructor(h));
750
750
  } else {
751
751
  this.$h = handle;
752
752
  this.$r = null;
@@ -834,7 +834,7 @@ Object.defineProperties(Wrapper.prototype, {
834
834
  const ref = this.$r;
835
835
  if (ref !== null) {
836
836
  this.$r = null;
837
- WeakRef.unbind(ref);
837
+ Script.unbindWeak(ref);
838
838
  }
839
839
 
840
840
  if (this.$h !== null) {
package/lib/env.js CHANGED
@@ -229,7 +229,7 @@ Env.prototype.throwIfExceptionPending = function () {
229
229
 
230
230
  const error = new Error(descriptionStr);
231
231
  error.$h = handle;
232
- WeakRef.bind(error, makeErrorHandleDestructor(this.vm, handle));
232
+ Script.bindWeak(error, makeErrorHandleDestructor(this.vm, handle));
233
233
 
234
234
  throw error;
235
235
  };
@@ -531,6 +531,10 @@ Env.prototype.monitorExit = proxy(218, 'int32', ['pointer', 'pointer'], function
531
531
  return impl(this.handle, obj);
532
532
  });
533
533
 
534
+ Env.prototype.getDirectBufferAddress = proxy(230, 'pointer', ['pointer', 'pointer'], function (impl, obj) {
535
+ return impl(this.handle, obj);
536
+ });
537
+
534
538
  Env.prototype.getObjectRefType = proxy(232, 'int32', ['pointer', 'pointer'], function (impl, ref) {
535
539
  return impl(this.handle, ref);
536
540
  });
package/lib/types.js CHANGED
@@ -588,7 +588,7 @@ function PrimitiveArray (handle, spec, type, length, env, owned = true) {
588
588
  if (owned) {
589
589
  const h = env.newGlobalRef(handle);
590
590
  this.$h = h;
591
- this.$r = WeakRef.bind(this, env.vm.makeHandleDestructor(h));
591
+ this.$r = Script.bindWeak(this, env.vm.makeHandleDestructor(h));
592
592
  } else {
593
593
  this.$h = handle;
594
594
  this.$r = null;
@@ -662,7 +662,7 @@ Object.defineProperties(PrimitiveArray.prototype, {
662
662
  const ref = this.$r;
663
663
  if (ref !== null) {
664
664
  this.$r = null;
665
- WeakRef.unbind(ref);
665
+ Script.unbindWeak(ref);
666
666
  }
667
667
  }
668
668
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-java-bridge",
3
- "version": "4.6.0",
3
+ "version": "5.2.1",
4
4
  "description": "Java runtime interop from Frida",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -48,7 +48,6 @@
48
48
  "ThumbWriter",
49
49
  "UnixInputStream",
50
50
  "UnixOutputStream",
51
- "WeakRef",
52
51
  "X86Relocator",
53
52
  "X86Writer",
54
53
  "ptr",