def registerPoc(self): pocString = multipleReplace(self.pocString, POC_IMPORTDICT) _, self.moduleName = filepathParser(self.pocName) try: importer = StringImporter(self.moduleName, pocString) importer.load_module(self.moduleName) except ImportError, ex: pass # TODO
def registerPoc(self): pocString = multipleReplace(self.pocString, POC_IMPORTDICT) _, self.moduleName = filepathParser(self.pocName) try: importer = StringImporter(self.moduleName, pocString) importer.load_module(self.moduleName) except ImportError, ex: logger.log(CUSTOM_LOGGING.ERROR, ex)
def registerPyPoc(pocDict): pocname = pocDict.keys()[0] _, moduleName = filepathParser(pocname) try: importer = StringImporter(moduleName, pocDict[pocname]) importer.load_module(moduleName) except ImportError, ex: errMsg = "%s register failed \"%s\"" % (moduleName, str(ex)) logger.log(CUSTOM_LOGGING.ERROR, errMsg)
def do_search(self, args): graph = PrettyTable(["pocId", "PocName"]) graph.align["PocName"] = "m" graph.padding_width = 1 for k, v in kb.unloadedList.iteritems(): if str(args) in v: graph.add_row([k, filepathParser(v)[1]]) print graph pass
def registerPoc(self): pocString = multipleReplace(self.pocString, POC_IMPORTDICT) _, fileName = filepathParser(self.pocName) self.moduleName = "%s%s" % (fileName, hashlib.md5( self.target).hexdigest()[:8]) try: importer = StringImporter(self.moduleName, pocString) importer.load_module(self.moduleName) except ImportError, ex: logger.log(CUSTOM_LOGGING.ERROR, ex)
def avaliable(): graph = PrettyTable(["pocId", "avaliablePocName", "Folder"]) graph.align["PocsName"] = "m" graph.padding_width = 1 for k, v in kb.unloadedList.iteritems(): path, name = filepathParser(v) graph.add_row([k, name, os.path.relpath(path, paths.POCSUITE_ROOT_PATH)]) print graph print
def _init(self): super(self.__class__, self).__init__() conf.isPycFile = False conf.httpHeaders = HTTP_DEFAULT_HEADER try: kb.registeredPocs except Exception: kb.registeredPocs = {} # _setHTTPtimeout timeout = float(TASK_TIMEOUT) socket.setdefaulttimeout(timeout) # registerPoc pocString = multipleReplace(self.pocString, POC_IMPORTDICT) _, self.moduleName = filepathParser(self.pocName) try: importer = StringImporter(self.moduleName, pocString) importer.load_module(self.moduleName) except ImportError, ex: logger.error(ex)