samedi 5 juin 2021

design pattern for unlimited number of conditions

I wonder what design pattern I can use to replace unlimited number of conditions. A good example for that would be LinPEAS.sh.

If you don't understand my question, a more straightforward question : How to make tool like LinPEASE.sh in oop way that lets many users add their own logic . (I just bring this tool as an example because it has many many if conditions, and the amount of conditions in it grow over time) https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS

I thought to make a template method called Condition. And then make an array for all of the instances of these classes and call all the classes. The thing is that sometimes the result of one condition class can be depend on other class.

Aucun commentaire:

Enregistrer un commentaire