今天在用Frida调试内存的时候遇到的问题,正常方法无论怎么都无法转换成中文字符串,现在把解决问题的方法记录一下供以后参考.
---------------------------------------------------------------------------------------------------------------------------------
16进制数组作为参数传递
var a = [0xab,0x8a];
function utf8ToString(bytes) {
let result = '';
let i = 0;
let wc, c;
while (i < bytes.length) {
// 1-byte sequence
if ((bytes[i] & 0x80) === 0) {
wc = bytes[i];
i++;
}
// 2-byte sequence
else if ((bytes[i] & 0xE0) === 0xC0) {
wc = ((bytes[i] & 0x1F) << 6) | (bytes[i + 1] & 0x3F);
i += 2;
}
// 3-byte sequence (not supported by all)
e