MCPcopy
hub / github.com/Xyntax/POC-T / loadModule

Function loadModule

lib/controller/loader.py:18–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def loadModule():
19 _name = conf.MODULE_NAME
20 msg = 'Load custom script: %s' % _name
21 logger.success(msg)
22
23 fp, pathname, description = imp.find_module(os.path.splitext(_name)[0], [paths.SCRIPT_PATH])
24 try:
25 th.module_obj = imp.load_module("_", fp, pathname, description)
26 for each in ESSENTIAL_MODULE_METHODS:
27 if not hasattr(th.module_obj, each):
28 errorMsg = "Can't find essential method:'%s()' in current script,Please modify your script/PoC."
29 sys.exit(logger.error(errorMsg))
30 except ImportError, e:
31 errorMsg = "Your current scipt [%s.py] caused this exception\n%s\n%s" \
32 % (_name, '[Error Msg]: ' + str(e), 'Maybe you can download this module from pip or easy_install')
33 sys.exit(logger.error(errorMsg))
34
35
36def loadPayloads():

Callers 1

mainFunction · 0.90

Calls 2

successMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected