| 16 | |
| 17 | |
| 18 | def 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 | |
| 36 | def loadPayloads(): |