分得清log,warning,error的输出等级么? -----箴言-----
1. 内容简介:
在Frida命令行可以调用(执行)js脚本文件,从而达到hook目的,本节介绍这种方式。
2. 例子:
js代码如下:
#输出字符到控制台,并且区分是log,warning,error
function hello_printf() {
Java.perform(function () {
console.log("");
console.log("hello world-log");
console.warn("hello python-warn");
console.error("hello frida-error");
});
}
setImmediate(hello_printf,0); //执行hello_printf函数
代码说明:
console是控制台输出函数;
setImmediate用于执行给定的function。当从控制台进行hook时,会掉到这个function。
运行方法:
先保证com.test.myglibtestapp在运行状态;
然后,运行frida -U com.test.myglibtestapp -l hello_printf.js命令,如下:
aaaaa:test_code user1$ frida -U com.test.myglibtestapp -l hello_printf.js
____
/ _ | Frida 14.1.2 - A world-class dynamic instrumentation toolkit
| (_| |
> _ | Commands:
/_/ |_| help -> Displays the help system
. . . . object? -> Display information about 'object'
. . . . exit/quit -> Exit
. . . .
. . . . More info at https://www.frida.re/docs/home/
Attaching...
//输出内容
hello world-log
hello python-warn
hello frida-error
[Android Emulator 5554::com.bangcle.myglibtestapp]->
从输出结果来看,成功调用了js脚本,并且将结果输出到了控制台;进行了log,warning,error的区分。
喜欢该文章,随时点个赞呗 :)。