H5 app开启web调试

前言:

在Android app逆向时,H5类型的app的加密通常在js中,所以就需要一种手段来查看源代码,查看加密过程。

0、如何确认h5 app

以狗东为例:

随便选择一个元素,可以看到是控件下的一个类

通过与H5类型的app对比:

 

 WebView  |  Android Developers

通过以上,就可以得知是否H5类型的app。

1、调试

确认是H5类型的app后,接下来就要进行调试。

 1.1、进入调试页面

科学上网前提下,chrome输入chrome://inspect/进入调试页面。如果app打开了调试权限,那么可以看到出现了调试选项。

当然,release的app是不会开启这个选项的。

1.2、开启app调试

WebView.setWebContentsDebuggingEnabled(true); //开启调试

使用frida hook android.webkit.WebView类下的setWebContentsDebuggingEnabled 方法,始终设置为true即可。(当然frida检测,root检测另说)。

js脚本:

Java.perform(function () {
    //实例化一个对象
    var WebView = Java.use('android.webkit.WebView');
    //重写WebView类的重载方法,因为setWebContentsDebuggingEnabled不是静态方法,所以需要一个对象来调用这个方法
    WebView.$init.overload('android.content.Context').implementation = function (a) {
        console.log("WebView.$init is called!1");
        var retval = this.$init(a);
        this.setWebContentsDebuggingEnabled(true);
        return retval;
    }
    WebView.$init.overload('android.content.Context', 'android.util.AttributeSet').implementation = function (a, b) {
        console.log("WebView.$init is called!2");
        var retval = this.$init(a, b);
        this.setWebContentsDebuggingEnabled(true);
        return retval;
    }
    WebView.$init.overload('android.content.Context', 'android.util.AttributeSet', 'int').implementation = function (a, b, c) {
        console.log("WebView.$init is called!3");
        var retval = this.$init(a, b, c);
        this.setWebContentsDebuggingEnabled(true);
        return retval;
    }
    //始终设置为true,打开调试
    WebView.setWebContentsDebuggingEnabled.implementation = function () {
        this.setWebContentsDebuggingEnabled(true);
        console.log("setWebContentsDebuggingEnabled is called!");
    }

});

// frida -U -f package_name -l .\hook.js --no-pause

以spawn方式打开app,然后再进入调试页面,点解inspect即可进入调试。 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值