function replace_str() {
var pt_strstr = Module.findExportByName(
"libc.so"
,
'strstr'
);
var pt_strcmp = Module.findExportByName(
"libc.so"
,
'strcmp'
);
Interceptor.attach(pt_strstr, {
onEnter: function (args) {
var str1 = args[
0
].readCString();
var str2 = args[
1
].readCString();
if
(str2.indexOf(
"tmp"
) !== -
1
||
str2.indexOf(
"frida"
) !== -
1
||
str2.indexOf(
"gum-js-loop"
) !== -
1
||
str2.indexOf(
"gmain"
) !== -
1
||
str2.indexOf(
"gdbus"
) !== -
1
||
str2.indexOf(
"pool-frida"
) !== -
1
||
str2.indexOf(
"linjector"
) !== -
1
) {
this
.hook =
true
;
}
}, onLeave: function (retval) {
if
(
this
.hook) {
retval.replace(
0
);
}
}
});
Interceptor.attach(pt_strcmp, {
onEnter: function (args) {
var str1 = args[
0
].readCString();
var str2 = args[
1
].readCString();
if
(str2.indexOf(
"tmp"
) !== -
1
||
str2.indexOf(
"frida"
) !== -
1
||
str2.indexOf(
"gum-js-loop"
) !== -
1
||
str2.indexOf(
"gmain"
) !== -
1
||
str2.indexOf(
"gdbus"
) !== -
1
||
str2.indexOf(
"pool-frida"
) !== -
1
||
str2.indexOf(
"linjector"
) !== -
1
) {
this
.hook =
true
;
}
}, onLeave: function (retval) {
if
(
this
.hook) {
retval.replace(
0
);
}
}
})
}
replace_str();