frida 执行读写操作
function writeSomething(path, contents) {
var fopen_addr = Module.findExportByName("libc.so", "fopen");
var fputs_addr = Module.findExportByName("libc.so", "fputs");
var fclose_addr = Module.findExportByName("libc.so", "fclose");
// console.log("fopen=>",fopen_addr," fputs=>",fputs_addr," fclose=>",fclose_addr);
var fopen = new NativeFunction(fopen_addr, "pointer", ["pointer", "pointer"]);
var fputs = new NativeFunction(fputs_addr, "int", ["pointer", "pointer"]);
var fclose = new NativeFunction(fclose_addr, "int", ["pointer"]);
//console.log(path,contents)
var fileName = Memory.allocUtf8String(path);
var mode = Memory.allocUtf8String("a+");
var fp = fopen(fileName, mode);
var buffer = Memory.allocUtf8String(contents);
var retval = fputs(buffer,fp)
console.log("fputs:", retval);
fclose(fp);
}
表示 写入手机的路径 没有读写权限
网友评论