0
点赞
收藏
分享

微信扫一扫

uniapp 解决H5跨域的问题

ivy吖 2023-11-07 阅读 29

配置环境

github地址: https://github.com/frida/frida

安装frida

安装最新版frida

PS: 注意用管理员权限运行cmd

安装指定版本的frida 

1. 首先卸载已经安装的frida

2. 指定版本安装(注意python版本)

然后查看指定版本的frida对应的frida-tools版本,直接github上找到该版本对应即可

当前pixel6 安卓13 使用python版本 3.11.5  frida&frida-server 16.1.4  frida-tools 12.2.1 可以正常使用 

验证是否安装成功

>frida --version
16.1.4  //输出版本说明frida-tool安装成功

>python
Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import frida  //python可以正常import frida说明frida安装成功
>>>

3. frida server安装

找到和当前frida版本一直的frida-server下载即可: https://github.com/frida/frida/releases/download/16.1.4/frida-server-16.1.4-android-arm64.xz

下载解压后推送到手机,这里推送到 /data/local/tmp目录下,并重命名文件为fs,然后给予fs权限,然后启动frida-server

#推送到手机
adb push frida-server-16.1.4-android-arm64 /data/local/tmp/fs

#给予权限
chmod 777 /data/local/tmp/fs

#启动frida-server
/data/local/tmp/fs


验证frida-server是否正常启动

vscode中编写一个js文件 test.js ,js文件中加入一行输入即可 console.log("frida server 设置成功!");

然后在terminal中执行下面的代码,注入js文件到当前手机所在的app进程

> frida -UF -l .\test.js
     ____
    / _  |   Frida 16.1.4 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at https://frida.re/docs/home/
   . . . .
   . . . .   Connected to Pixel 6 (id=19161FDF600A68)
frida server 设置成功!  //输出这里说明frida-server 正常启动
frida关闭 
1. 关闭cmd窗口关闭frida客户端和服务端

由于是在cmd中通过adb shell启动的fs,最简单的方法是直接关闭cmd,这样frida-server会自动关闭,这也要求使用中不要关闭cmd,不然frida-server就关闭了.

2. 关闭frida-server进程

也可以查找frida-server进程,然后kill -9强制关闭进程.注意如果把frida-server改名了,查找时需要注意

1|oriole:/ $ ps -ef|grep fs|grep -v grep
root           285     2 0 21:19:57 ?     00:00:00 [ufs_mgc_hibern8]
root           286     2 0 21:19:57 ?     00:00:00 [ufs_eh_wq_0]
root           287     2 0 21:19:57 ?     00:00:00 [ufs_clk_gating_]
root           319     2 0 21:19:58 ?     00:00:00 [gpu-dvfs-contro]
root           320     2 0 21:19:58 ?     00:00:00 [gpu-dvfs-clockd]
root           477     1 0 21:19:58 ?     00:00:40 vold --blkid_context=u:r:blkid:s0 --blkid_untrusted_context=u:r:blkid_untrusted:s0 --fsck_context=u:r:fsck:s0 --fsck_untrusted_context=u:r:fsck_untrusted:s0
root           623     2 0 21:19:59 ?     00:03:37 [f2fs_ckpt-254:4]
root           624     2 0 21:19:59 ?     00:00:00 [f2fs_flush-254:]
root           625     2 0 21:19:59 ?     00:00:55 [f2fs_discard-25]
root           643     2 0 21:19:59 ?     00:00:05 [f2fs_gc-254:42]
radio         1014     1 0 21:20:01 ?     00:01:23 rfsd -d
system        1639     1 0 21:20:04 ?     00:00:09 storageproxyd -d /dev/trusty-ipc-dev0 -r /dev/sg1 -p /data/vendor/ss -t ufs
root         14277     2 0 10:17:31 ?     00:00:01 [kworker/u17:0-ufs_clk_gating_0]
root         15842     2 0 10:33:20 ?     00:00:00 [kworker/u17:2-ufs_clk_gating_0]
root         16974 16753 0 10:41:59 136:0 00:00:00 fs
oriole:/ $ kill -9 16974
/system/bin/sh: kill: 16974: Operation not permitted
1|oriole:/ $ su
oriole:/ # kill -9 16974

4. frida 代码提示配置

在vscode的frida项目根目录下执行局部安装即可

npm -i @types/frida-gun

frida的基本用法

frida的代码尽量使用java.perform给包起来

1. hook实例方法

Java.perform(function () {
    // hook方法
    let MainActivity = Java.use("com.zj.wuaipojie2023_3.MainActivity");
    MainActivity["check"].implementation = function () {
        console.log(`MainActivity.check is called`);
        let result = this["check"]();
        console.log(`MainActivity.check result=${result}`);
        return 999;
    };
    // 主动调用实例方法
    // 首先获得实例
    Java.choose("com.zj.wuaipojie2023_3.MainActivity",{
        onMatch:function(obj){
            console.log("onMatch: ",obj);
            obj.setNum(998);
        },
        onComplete:function(){
            console.log("choose complete!")
        }
    })

    //主动调用实例方法: 解密函数
    Java.choose("com.zj.wuaipojie2023_3.MainActivity", {
        onMatch: function (obj) {
            let result = obj.decrypt(`hnci}|jwfclkczkppkcpmwckng\u007f`, 2);
            console.log("解密结果: ", result);
        },
        onComplete:function(){

        }
    });
});

注意: 调用实例方法时,Java.choose第二个参数对象中的onComplete方法不能省略,可以写成空方法,但是不能省略,否则会报错!

举报

相关推荐

0 条评论