-
Notifications
You must be signed in to change notification settings - Fork 72
Creating a Module
Daniel Lawson edited this page Jul 24, 2018
·
13 revisions
Armory's usefulness comes from being able to quickly code up a module for a tool and ingest the output for useful data. This data can then be inserted into the database, and used with other tools or reports. Right now, modules are based off of templates in included/ModuleTemplate.py. The two templates are as follows:
- ModuleTemplate: Basic template with almost nothing built in. This is what you would base any "out-of-the-box" modules.
- ToolTemplate: Template designed to allow one to easily create a multithreaded module for an arbitrary tool, and process the output.
As an example, we'll build a module for a tko-subs, a tool used to check various domains to see if they are vulnerable to hijacking. (The tool can be found here.
For the first step, we'll copy the skeleton for a tool template from the "SampleToolModule.py" file into a new "Tko-subs.py" file.
cd included/modules
cp SampleToolModule.py Tko-subs.py
At this point, the file Tko-subs.py contains the following code:
#!/usr/bin/python
from included.ModuleTemplate import ToolTemplate
class Module(ToolTemplate):
'''
This is a sample skeleton for building a module to run a tool.
'''
name = "SampleToolModule"
def set_options(self):
super(Module, self).set_options()
self.options.add_argument('-p', '--print_message', help="Message to print")
def get_targets(self, args):
'''
This module is used to build out a target list and output file list, depending on the arguments. Should return a
list in the format [(target, output), (target, output), etc, etc]
'''
return []
def build_cmd(self, args):
'''
Create the actual command that will be executed. Use {target} and {output} as placeholders.
'''
return ''
def process_output(self, cmds):
'''
Process the output generated by the earlier commands.
'''