Exemple #1
0
def loadPoc(pocFile):
    if pocFile.endswith(".pyc"):
        conf.isPycFile = True

    if conf.isPocString:
        poc = conf.pocFile
        if not conf.pocname:
            if conf.pocFile:
                conf.pocname = os.path.split(conf.pocFile)[1]
            else:
                errMsg = "Use pocString must provide pocname"
                logger.log(CUSTOM_LOGGING.ERROR, errMsg)
        pocname = conf.pocname
    else:
        pocname = os.path.split(pocFile)[1]
        poc = readFile(pocFile)

    if not conf.isPycFile:
        if not re.search(POC_REGISTER_REGEX, poc):
            warnMsg = "poc: %s register is missing" % pocname
            logger.log(CUSTOM_LOGGING.WARNING, warnMsg)
            className = getPocClassName(poc)
            poc += POC_REGISTER_STRING.format(className)

        retVal = multipleReplace(poc, POC_IMPORTDICT)
    else:
        retVal = poc
    return {pocname: retVal}
Exemple #2
0
def loadPoc(pocFile):
    if pocFile.endswith(".pyc"):
        conf.isPycFile = True

    if conf.isPocString:
        poc = conf.pocFile
        if not conf.pocname:
            if conf.pocFile:
                conf.pocname = os.path.split(conf.pocFile)[1]
            else:
                errMsg = "Use pocString must provide pocname"
                logger.log(CUSTOM_LOGGING.ERROR, errMsg)
        pocname = conf.pocname
    else:
        pocname = os.path.split(pocFile)[1]
        poc = readFile(pocFile)

    if not conf.isPycFile:
        if not re.search(POC_REGISTER_REGEX, poc):
            warnMsg = "poc: %s register is missing" % pocname
            logger.log(CUSTOM_LOGGING.WARNING, warnMsg)
            className = getPocClassName(poc)
            poc += POC_REGISTER_STRING.format(className)

        retVal = multipleReplace(poc, POC_IMPORTDICT)
    else:
        retVal = poc
    return {pocname: retVal}
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:
         pass  # TODO
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 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 #6
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 #7
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 #8
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 #9
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)