Skip to content

Module Development

Anastasios Stasinopoulos edited this page May 31, 2015 · 3 revisions

In order to increase the capabilities of the commix tool and/or to adapt it to our needs, we can easily develop and import our own modules!

Lets suppose we want to add a new module, which is a python script named as new_module.py and that it prints out the awesome message: "Hello world,from the new module!".

For our example the module contains only one main() function, which prints the message "Hello world,from the new module!".

def main():
  print "Hello world from the new module!"
  # More cool stuffz here!
  (...code...)

The desired module has to be placed in the modules directory /src/core/modules/.

Then, after we have created the module we desired, we import it inside the load_modules() function of the module_handler.py script (1).

After the aforementioned steps, the module name new_module and the function which will be called first, in our case the main() function, should be defined inside the load_modules() function of the module_handler.py script (2).

def load_modules(url,http_request_method):
    (...code...)
    from src.core.modules import new_module # <-- (1) Import your module here!!
    new_module.main() # <-- (2) Load your module here!!
    (...code...)