function Tracepid() {
console.warn(
"............."
)
var fgetsPtr
=
Module.findExportByName(
"libc.so"
,
"fgets"
);
var fgets
=
new NativeFunction(fgetsPtr,
'pointer'
, [
'pointer'
,
'int'
,
'pointer'
]);
Interceptor.replace(fgetsPtr, new NativeCallback(function (
buffer
, size, fp) {
var retval
=
fgets(
buffer
, size, fp);
var bufstr
=
Memory.readUtf8String(
buffer
);
if
(bufstr.indexOf(
"TracerPid:"
) >
-
1
) {
Memory.writeUtf8String(
buffer
,
"TracerPid:\t0"
);
}
return
retval;
},
'pointer'
, [
'pointer'
,
'int'
,
'pointer'
]));
var killptr
=
Module.findExportByName(
"libc.so"
,
"kill"
);
var kill
=
new NativeFunction(fgetsPtr,
'int'
, [
'int'
,
'int'
]);
Interceptor.replace(killptr, new NativeCallback(function (pid,sig) {
console.log(
"kill"
)
return
0
;
},
'int'
, [
'int'
,
'int'
]));
}