intercept read/pread/readv from file descriptor
This commit is contained in:
parent
0fc76eafb3
commit
e151ca90fb
14
README.md
14
README.md
@ -266,8 +266,7 @@ var fds = {};
|
|||||||
Interceptor.attach(Module.findExportByName(null, 'open'), {
|
Interceptor.attach(Module.findExportByName(null, 'open'), {
|
||||||
onEnter: function (args) {
|
onEnter: function (args) {
|
||||||
var fname = args[0].readCString();
|
var fname = args[0].readCString();
|
||||||
if (fname.endsWith('.jar')) {
|
if (fname.endsWith('kdc')) {
|
||||||
console.log('open: ' + fname);
|
|
||||||
this.flag = true;
|
this.flag = true;
|
||||||
this.fname = fname;
|
this.fname = fname;
|
||||||
}
|
}
|
||||||
@ -275,19 +274,18 @@ Interceptor.attach(Module.findExportByName(null, 'open'), {
|
|||||||
onLeave: function (retval) {
|
onLeave: function (retval) {
|
||||||
if (this.flag) {
|
if (this.flag) {
|
||||||
fds[retval] = this.fname;
|
fds[retval] = this.fname;
|
||||||
console.warn(retval);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Interceptor.attach(Module.findExportByName(null, 'read'), {
|
['read', 'pread', 'readv'].forEach(fnc => {
|
||||||
|
Interceptor.attach(Module.findExportByName(null, fnc), {
|
||||||
onEnter: function (args) {
|
onEnter: function (args) {
|
||||||
var fd = args[0];
|
var fd = args[0];
|
||||||
if (fd in fds) {
|
if (fd in fds)
|
||||||
console.log('read: ' + fds[fd]);
|
console.log(`${fnc}: ${fds[fd]}\n\t${Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join('\n\t')}`);
|
||||||
console.warn(Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress).join('\n'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
Loading…
Reference in New Issue
Block a user