其他分享
首页 > 其他分享> > Frida打印堆栈模板

Frida打印堆栈模板

作者:互联网

//调用方法
function printStack() {
    Java.perform(function () {
        var Exception = Java.use("java.lang.Exception");
        var ins = Exception.$new("Exception");
        var straces = ins.getStackTrace();
        if (straces != undefined && straces != null) {
            var strace = straces.toString();
            var replaceStr = strace.replace(/,/g, "\r\n");
            console.log("=============================Stack strat=======================");
            console.log(replaceStr);
            console.log("=============================Stack end=======================\r\n");
            Exception.$dispose();
        }
    });
}
//以下为使用方法
Java.perform(function x() {
	var my_class = Java.use("xxx");
	my_class.a.overload().implementation = function () {
		printStack();
		var ret_value = this.a(x);
	    return ret_value;
	}

标签:function,Exception,Java,log,var,straces,堆栈,Frida,模板
来源: https://www.cnblogs.com/pythonywy/p/16359059.html