forked from PowerScript/KatanaFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ktf.run
64 lines (57 loc) · 2.38 KB
/
ktf.run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
#HEAD#########################################################
#
# Katana Framework | ktf.run
# this file run modules diretly.
#
#
# Last Modified: 15/05/2016
#
#########################################################HEAD#
from core.Function import KatanaCheckActionShowModules,KatanaCheckActionUseModule,KatanaCheckActionExefunction
from core.Function import KatanaCheckActionShowOptions,LoadBuffer,ShowFullOptions,Executefunction
from core.Function import KatanaCheckActionGetInfo,ShowInformationModule,KatanaCheckActionShowMOptions
from core.Function import ShowOptions,KatanaCheckActionSetValue,UpdateValue,runModule
from core.Function import KatanaCheckActionisBack,KatanaCheckActionGlobalCommands
from core.Default import *
from core.Design import *
from core import Errors
import xml.etree.ElementTree as ET
import importlib
import argparse
LoadBuffer()
CLASS_BANNER=DESIGN()
CLASS_BANNER.ktfrun()
tree = ET.parse('core/modules.xml')
root = tree.getroot()
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--module", help=" Script module to run.")
args = parser.parse_args()
if __name__=="__main__":
for modules in root.findall('module'):
if args.module == modules.get('name'):
category = modules.find('category').text
filename = modules.find('filename').text
ModuleToStart = importlib.import_module("modules."+category+"."+filename)
init=ModuleToStart.init()
while True:
try:
actions=raw_input(Prompt(init.CodeName))
if KatanaCheckActionShowOptions(actions) :ShowOptions(init)
elif KatanaCheckActionShowMOptions(actions) :ShowFullOptions(init)
elif KatanaCheckActionExefunction(actions) :Executefunction(actions)
elif KatanaCheckActionSetValue(actions) :init=UpdateValue(actions,init)
elif KatanaCheckActionGetInfo(actions) :ShowInformationModule(init)
elif runModule(actions):
for Namevalue in init.options:
init.var.update({Namevalue:init.options[Namevalue][0]})
try:
for Namevalue in init.extra:
init.var.update({Namevalue:init.extra[Namevalue][0]})
except:Nothing=False
ModuleToStart.main(True)
elif KatanaCheckActionisBack(actions) :printAlert(6,"This Commands just work in console mode.")
else :
if actions != "":KatanaCheckActionGlobalCommands(actions)
except:Errors.Errors()
ModuleNotFound(args.module)