Skip to content

IV. Creating Mutator Modules

s0lst1c3 edited this page Nov 16, 2020 · 1 revision

DropEngine supports the use of Mutator modules to transform variable, function, and class names found within generated payloads. Below is a template for creating a Mutator module. Mutator modules contain a transform() method that is called on every symbol within the payload. The symbol is accepted as a position argument, some sort of mutation logic occurs, and then the mutated symbol is returned at the end of the function. To create your own mutator method, just add code to the transform() method and change the module's metadata.

class MMutator(Mutator):

    def __init__(self):

        if config.debug:
            print('calling MMutator.__init__()')

        super().__init__()

        self.name = 'mutator_null'
        self.mtype = 'mutator'
        self.author = '@s0lst1c3'
        self.description = 'Null mutator - leaves function names exactly the same.'

        self.compatible_interfaces = '*'

    def transform(self, x):

        # mutation code goes here (goal is to map the value of x to something else)

        return x