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();

                }
            }
        });
posted @ 2021-06-18 10:24  公众号python学习开发  阅读(210)  评论(0编辑  收藏  举报