Frida构造Java函数所需的Map>参数

var HashMap = Java.use('java.util.HashMap').$new();
var ArrayList = Java.use("java.util.ArrayList").$new();
var JavaString = Java.use("java.lang.String");
var JavaObject = Java.use("java.lang.Object");

var s3 = JSON.parse(s2);
var m1 = ArrayList;
var m2 = ArrayList;
var m3 = ArrayList;
var m4 = ArrayList;

m1.add(s3["cookie"]);

var mm1 = Java.cast(Java.cast(m1, ArrayList), JavaObject);
var mm2 = Java.cast(Java.cast(m2, ArrayList), JavaObject);
var mm3 = Java.cast(Java.cast(m3, ArrayList), JavaObject);
var mm4 = Java.cast(Java.cast(m4, ArrayList), JavaObject);

HashMap.put("cookie", mm1);
HashMap.put("x-ss-tc", mm2);
HashMap.put("accept-encoding", mm3);
HashMap.put("user-agent", mm4);

console.log("打印查看,构造是否成功");
var keys = HashMap.keySet();
var key_set = keys.iterator();
while (key_set.hasNext()) {
    var key = key_set.next().toString();
    var value = HashMap.get(key).toString();
    console.log(key + ": " + value);
}
// 代码记录

你可能感兴趣的:(Frida构造Java函数所需的Map>参数)