Frida JAVA API 文档
Java
Java.available:
a boolean specifying whether the current process has the a Java VM loaded, i.e. Dalvik or ART. Do not invoke any other Java properties or methods unless this is the case.
Java.enumerateLoadedClasses(callbacks)
enumerate classes loaded right now, where callbacks is an object specifying:
onMatch: function (className): called for each loaded class with className that may be passed to use() to get a JavaScript wrapper.
onComplete: function (): called when all classes have been enumerated.
Java.enumerateLoadedClassesSync(): synchronous version of enumerateLoadedClasses() that returns the class names in an array.
Java.perform(fn): ensure that the current thread is attached to the VM and call fn. (This isn’t necessary in callbacks from Java.)
Java.perform(function () { var Activity = Java.use("android.app.Activity"); Activity.onResume.implementation = function () { send("onResume() got called! Let's call the original implementation"); this.onResume(); }; });
Java.use(className)
dynamically get a JavaScript wrapper for className that you can instantiate objects from by calling $new() on it to invoke a constructor. Call $dispose() on an instance to clean it up explicitly (or wait for the JavaScript object to get garbage-collected, or script to get unloaded). Static and non-static methods are available, and you can even replace a method implementation and throw an exception from it:
Java.perform(function () { var Activity = Java.use("android.app.Activity"); var Exception = Java.use("java.lang.Exception"); Activity.onResume.implementation = function () { throw Exception.$new("Oh noes!"); }; });
Java.scheduleOnMainThread(fn):
run fn on the main thread of the VM.
Java.choose(className, callbacks):
enumerate live instances of the className class by scanning the Java heap, where callbacks is an object specifying:
onMatch: function (instance): called once for each live instance found with a ready-to-use instance just as if you would have called Java.cast() with a raw handle to this particular instance.
This function may return the string stop to cancel the enumeration early.
onComplete: function (): called when all instances have been enumerated
Java.cast(handle, klass):
create a JavaScript wrapper given the existing instance at handle of given class klass (as returned from Java.use()). Such a wrapper also has a class property for getting a wrapper for its class, and a $className property for getting a string representation of its class-name.
var Activity = Java.use("android.app.Activity"); var activity = Java.cast(ptr("0x1234"), Activity);
WeakRef
WeakRef.bind(value, fn): monitor value and call the fn callback as soon as value has been garbage-collected, or the script is about to get unloaded. Returns an id that you can pass to WeakRef.unbind() for explicit cleanup.
This API is useful if you’re building a language-binding, where you need to free native resources when a JS value is no longer needed.
WeakRef.unbind(id): stop monitoring the value passed to WeakRef.bind(value, fn), and call the fn callback immediately.
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Frida hook带handler的method
有些Class里面有Handler对象,就必须在 主线程里执行,否则报错 E/AndroidRuntime( 2434): java.lang.ExceptionInInitializerError E/AndroidRuntime( 2434): at dalvik.system.NativeStart.run(Native Method) E/AndroidRuntime( 2434): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() E/AndroidRuntime( 2434): at android.os.Handler.(Handler.java:200) Frida提供了这样的设施, 那就是 scheduleOnMainThread send(Java.available); Java.perform(function () { send(Java.androidVersion); send(Java...
- 下一篇
Android灵魂画家的18种混合模式
image ️️ Warning!Warning!前方高能,阅读本文可能需要3分钟哦! 有什么料? 重新认识神秘的PorterDuffXfermode。 学会正确的使用PorterDuffXfermode。 收获【两张示例图】,帮助你在实际中正确的运用各种混合模式。 解密PorterDuffXfermode 先上两张示例图,大家快来保存啊! image image 注:这两张图仅用了两个强大的View完成的。【从未如此惊艳!你好,SuperTextView (v1.1) - http://www.jianshu.com/p/1b91e11e441d】,你值得拥有! 自己绘过图的筒靴一定见过或者用过mPaint.setXfermode(Xfermode xfermode),它是干什么的呢?它的作用就是将画布上的当前图像(即目标图像DST)和后面需要绘制的图像(即源图像SRC)按照一定的算法进行混合。简单点说就是把源图像SRC与目标图像DST进行混合。而ProterDuffXfermode继承自Xfermode,提供了18像素混合模式的算法,它们是由Thomas Porter和Tom Du...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- Red5直播服务器,属于Java语言的直播服务器
- CentOS7,CentOS8安装Elasticsearch6.8.6
- Docker安装Oracle12C,快速搭建Oracle学习环境
- CentOS8编译安装MySQL8.0.19
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS6,CentOS7官方镜像安装Oracle11G
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- SpringBoot2更换Tomcat为Jetty,小型站点的福音
- CentOS8安装Docker,最新的服务器搭配容器使用