diff --git a/README.md b/README.md index 9773638..6f0cdc7 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ * [`Log SQLite query`](#log-sqlite-query) * [`Reveal manually registered native symbols`](#reveal-native-methods) * [`Log method arguments`](#log-method-arguments) +* [`Intercept entire module`](#intercept-entire-module) @@ -1248,8 +1249,36 @@ TODO
[⬆ Back to top](#table-of-contents) +#### Intercept Entire Module +To reduce UI related functions I ues the following steps: +1. Output log to a file using `-o /tmp/log1` +2. Copy MRU to excludesList using `$ sort /tmp/log1 | uniq -c | sort -rn | head -n20 | cut -d# -f2 | paste -sd "," -` + +```js +var mName = 'MyModule', excludeList = ['Alot', 'Of', 'UI', 'Related', 'Functions']; +Module.enumerateExportsSync(mName) + .filter(function(e) { + var fromTypeFunction = e.type == 'function';· + var notInExcludes = excludeList.indexOf(e.name) == -1; + return fromTypeFunction && notInExcludes; + }) + .forEach(function(e) { + Interceptor.attach(Module.findExportByName(mName, e.name), { + onEnter: function(args) { + console.log(mName + "#'" + e.name + "'"); + } + }) + }) +``` + +
+Output example +TODO +
+ +
[⬆ Back to top](#table-of-contents) #### TODOs - Add GIFs & examples - Add links to /scripts