frida定义线程写图片文件

var Runnable = Java.use("java.lang.Runnable"); | header |
var saveImg = Java.registerClass({ //注册一个类
            name: "com.example.runnable",   //包名
            implements: [Runnable], //实现Runnable
            fields: {
                bm: "android.graphics.Bitmap",
            },
            methods: {
                $init: [{
                    returnType: "void",
                    argumentTypes: ["android.graphics.Bitmap"],
                    implementation: function (bitmap) {
                        this.bm.value = bitmap;
                    }
                }],
                run: function () {

                    var path = "/sdcard/Download/tmp/" + guid() + ".jpg"
                    console.log("path=> ", path)
                    var file = Java.use("java.io.File").$new(path)
                    var fos = Java.use("java.io.FileOutputStream").$new(file);

                    this.bm.value.compress(Java.use("android.graphics.Bitmap$CompressFormat").JPEG.value, 100, fos)
                    console.log("success!")
                    fos.flush();
                    fos.close();

                }
            }
        });
上一篇:2021最新Android面试题及答案,再不了解你就out啦


下一篇:线程和进程、多线程、线程状态、线程调度