[原创]使用 frida 实现 android 本地文件读写 | 宜武汇-ag真人国际厅网站

function readfile_2(filename){

    var addr_fopen = module.findexportbyname("libc.so", "fopen");

    var addr_fread = module.findexportbyname("libc.so", "fread");

    var addr_fseek = module.findexportbyname("libc.so", "fseek");

    var addr_ftell = module.findexportbyname("libc.so", "ftell");

    var addr_fclose = module.findexportbyname("libc.so", "fclose");

     

    var fopenptr = new nativefunction(addr_fopen, "pointer", ["pointer", "pointer"]);

    var freadptr = new nativefunction(addr_fread, 'int', ['pointer', 'int','int','pointer']);

    var fseekptr = new nativefunction(addr_fseek, 'int', ['pointer', 'int','int']);

    var ftellptr = new nativefunction(addr_ftell, "int", ["pointer"]);

    var fcloseptr = new nativefunction(addr_fclose, "int", ["pointer"]);

 

    var pf = fopenptr(memory.allocutf8string(filename), memory.allocutf8string("rb"))

    fseekptr(pf, 0, 2);

    var size = fseekptr(fp);

    fseekptr(pf, 0, 0);

    console.log(size)

    var databuffer = memory.alloc(size);

    freadptr(databuffer, 1, size, pf);

    console.log(databuffer.readcstring())

    fcloseptr(file);

var filename = "/sdcard/test.txt"

readfile_2(filename);

原文链接:https://bbs.kanxue.com/thread-278134.htm

网络摘文,本文作者:15h,如若转载,请注明出处:https://www.15cov.cn/2023/08/27/原创使用-frida-实现-android-本地文件读写/

发表评论

邮箱地址不会被公开。 必填项已用*标注

网站地图