Closed Azult closed 4 years ago
Hey @Azult, I thought that the code you posted was just an example. That's why I asked to open a PR.
Your change is very interesting but with the current implementation it is no longer possibile to insert more than one filter (e.g. com.app, com.test)
Is it possible to keep multiple filters support? Does the code below make sense?
filter_array.forEach(function (f) {
//f.trim() is needed to remove possibile spaces after the comma
if (className.search(filter.trim()) > -1 ) {
loaded_classes.push(className)
}
});
Actually, since we can use regex, we don't need to split it to multiple filters, since you can already do it using regex.
For instance, you want to hook all the classes with 4 letters but you also want to hook 'com.google.cyber' class. You can use the following regex:
(?:^[a-z]{4})|(?:com\.google\.cyber)
You can test it in regex101.com.
I understand that it is maybe more intuitive to use regular filter, but regex can do it all and more. This is a lot more sophisticated filtering, especially when the code is obfuscated, you would want to hook a pool of classes since you don't always know what classes are involved.
Also the 'trim' method is bad for regex since it strips characters used in regex such as \
.
So basically, the solution you proposed can work but it can break the regex sometimes due to the trim escaping.
Hope I could explain myself :)
Yes, I totally agree with you that it is a very useful feature.
What about keeping the current "startsWith" as default and add a toggle to filter via regex? At the end it is needed only inside the modal view that let you insert filters.
A toggle option would be perfect!
Thanks!
Hey @Azult are you planning to add the feature? If no please let me know, I'll try to find the time to work on this.
Hi, Sorry for the misunderstanding. I will try to finish it this weekend.
Hi,
As you asked. Hope you find it useful.