Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
 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)
Exemple #4
0
 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)
Exemple #5
0
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)
Exemple #6
0
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)
Exemple #7
0
    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
Exemple #8
0
    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
Exemple #9
0
 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)
Exemple #10
0
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
Exemple #11
0
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
Exemple #12
0
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)
Exemple #13
0
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)