def registerPocFromFile(): """ @function import方式导入Poc文件, import Poc的时候自动rigister了 """ for path in kb.pocFiles: if path.endswith(".py"): if not isOldVersionPoc(path): registerPyPoc(path) else: warnMsg = "%s is old version poc" % path logger.log(CUSTOM_LOGGING.WARNING, warnMsg) elif path.endswith(".json"): registerJsonPoc(path)
def registerPocFromDict(): """ @function import方式导入Poc文件, import Poc的时候自动rigister了 """ if conf.requires: return for pocname, poc in kb.pocs.items(): pocDict = {pocname: poc} if pocname.endswith(".py"): if not isOldVersionPoc(poc): registerPyPoc(pocDict) else: warnMsg = "%s is old version poc" % pocname logger.log(CUSTOM_LOGGING.WARNING, warnMsg) elif poc.endswith(".json"): registerJsonPoc(pocDict) else: if conf.isPycFile: registerPyPoc(pocDict) else: warnMsg = "invalid PoC %s" % pocDict["pocname"] logger.log(CUSTOM_LOGGING.WARNING, warnMsg)