CERT-Polska / karton-yaramatcher

File and analysis artifacts yara matcher for Karton framework
https://github.com/CERT-Polska/karton
BSD 3-Clause "New" or "Revised" License
5 stars 9 forks source link

Allow to extend class and reuse original main #23

Closed psrok1 closed 11 months ago

psrok1 commented 11 months ago

Right now, custom class extension like:

from karton.yaramatcher import YaraMatcher

class CustomYaraMatcher(YaraMatcher):
    identity = 'karton.customyaramatcher'
    filters = [
        *YaraMatcher.filters,
        {"type": "sample", "stage": "recognized"}
    ]

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

if __name__ == "__main__":
    CustomYaraMatcher.main()

doesn't work because main instantiates YaraMatcher class directly instead of using cls