1 : byte[] 转 CString
假如byte 是二进制数据:
function print_bytes(bytes) { var buf = Memory.alloc(bytes.length); Memory.writeByteArray(buf, byte_to_ArrayBuffer(bytes)); console.log(hexdump(buf, {offset: 0, length: bytes.length, header: false, ansi: true})); } function byte_to_ArrayBuffer(bytes) { var size = bytes.length; var tmparray = []; for (var i = 0; i < size; i++) { var val = bytes[i]; if(val < 0){ val += 256; } tmparray[i] = val } return tmparray; }
普通字符串数据:
var JString = Java.use("java.lang.String"); JString.$new(bytes)
var ByteString = Java.use("com.android.okhttp.okio.ByteString"); ByteString.of(bytes).hex()
Java.openClassFile("/data/local/tmp/gson.dex").load(); var gson = Java.use("com.google.gson.Gson"); var Jgson = gson.$new(); Jgson.toJson(tmp)