Skip to content

How to Create a Module

R̭̮̗̯̳̯̜̳̱̰̮͍̯̯̲̝̥̔ͯ͆̆͌̈͌̽͒̿ͯͤ͂̚ͅͅė̥̜̗͉̦̰͈̺̟̻̦̔ͬͧ̍ͣ̉̚d̦̦̯̩̠̗͔̜̼̬̏ͫ̌̓́ͦ̆̋̅ͯ̌͆͂͑̊̑̄̊T̖̱͕̬̬͈̹̏̆ͮ̽́ͫ̎oor edited this page May 31, 2017 · 3 revisions

Template Script

`

# This module requires katana framework 
# https://github.com/PowerScript/KatanaFramework

# :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: #
# Katana Core import                  #
from core.KatanaFramework import *    #
# :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: #

# LIBRARIES

# END LIBRARIES

# INFORMATION MODULE
def init():
	init.Author             ="Anon"
	init.Version            ="1.0"
	init.Description        ="My module descriptor."
	init.CodeName           ="Category/Name"
	init.DateCreation       ="Day/Mount/Year"     
	init.LastModification   ="Day/Mount/Year"
	init.References         =None
	init.License            =KTF_LINCENSE
	init.var                ={}

	# DEFAULT OPTIONS MODULE
	init.options = {
		# NAME       VALUE                RQ     DESCRIPTION
		'parameter1':["127.0.0.1"       ,True  ,'ShortDescription'],
		'parameter2':["8070"            ,True  ,'ShortDescription']
	}
	return init
# END INFORMATION MODULE

# CODE MODULE    ############################################################################################
def main(run):
	
	print init.var['parameter1'] + init.var['parameter2']

# END CODE MODULE ############################################################################################

`

to create a new module follow the begin steps:

  1. Copy the template into a empy file named with .py extention
  2. Edit the information session with your data where
  • Author is Author Name(me).
  • CodeName is the category name followed of / and after the codename Example: web/web.status
  • DateCreation Current Data
  • LastModification is Last Modification module
  • References is Links or emails. Example: "[email protected]" #Use quotation marks
  • License is Licence link. Example: "www.example.org/License" #Use quotation marks
  • var is reserved, no modify
  1. Set the options as follows parameter-name : default value ,Required , Short Description Example:

    'parameter1':["8070" ,True ,'ShortDescription']

by default parameter you can use any variable defined here.

  1. Coded you module use the init.var['parameter-name']. Example: print init.var['parameter1']

if you need use libraries, you must add the library session also you can use APIs.

  1. Import the module use ktf.ktf --import-module path_the_filename.py
Clone this wiki locally