Exemple #1
0
def setMultipleTarget():
    #urlFile
    if not conf.urlFile:
        target_urls = []
        if conf.url:
            if conf.url.endswith('/24'):
                try:
                    socket.inet_aton(conf.url.split('/')[0])
                    base_addr = conf.url[:conf.url.rfind('.') + 1]
                    target_urls = [
                        '{}{}'.format(base_addr, i)
                        for i in xrange(1, 255 + 1)
                    ]
                except socket.error:
                    errMsg = 'only id address acceptable'
                    log.error(errMsg)
            else:
                target_urls = conf.url.split(',')

            for url in target_urls:
                if url:
                    kb.targets.put((url))
        else:
            errMsg = 'the url needs to be set'
            log.error(errMsg)
        return
    if paths.ZEROSCAN_TARGET_PATH in conf.urlFile:
        conf.urlFile = safeExpandUser(conf.urlFile)
        infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
        log.process(infoMsg)
    else:
        conf.urlFile = paths.ZEROSCAN_TARGET_PATH + '/' + conf.urlFile
        conf.urlFile = safeExpandUser(conf.urlFile)
        infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
        log.process(infoMsg)

    if not os.path.isfile(conf.urlFile):
        errMsg = "the specified file does not exist"
        raise ZEROScanFilePathException(errMsg)
    for line in getFileItems(conf.urlFile):
        kb.targets.put(line.strip())
Exemple #2
0
def setMultipleTarget():
    #urlFile
    if not conf.urlFile:
        target_urls = []
        if conf.url:
            if conf.url.endswith('/24'):
                try:
                    socket.inet_aton(conf.url.split('/')[0])
                    base_addr = conf.url[:conf.url.rfind('.') + 1]
                    target_urls = ['{}{}'.format(base_addr, i)
                                    for i in xrange(1, 255 + 1)]
                except socket.error:
                    errMsg = 'only id address acceptable'
                    log.error(errMsg)
            else:
                target_urls = conf.url.split(',')

            for url in target_urls:
                if url:
                    kb.targets.put((url))
        else:
            errMsg = 'the url needs to be set'
            log.error(errMsg)
        return
    if paths.ZEROSCAN_TARGET_PATH in conf.urlFile:
        conf.urlFile = safeExpandUser(conf.urlFile)
        infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
        log.process(infoMsg)
    else:
        conf.urlFile = paths.ZEROSCAN_TARGET_PATH +'/'+ conf.urlFile
        conf.urlFile = safeExpandUser(conf.urlFile)
        infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
        log.process(infoMsg)

    if not os.path.isfile(conf.urlFile):
        errMsg = "the specified file does not exist"
        raise ZEROScanFilePathException(errMsg)
    for line in getFileItems(conf.urlFile):
        kb.targets.put(line.strip())
Exemple #3
0
def setMultipleTarget():
    if conf.requires or conf.requiresFreeze:
        return

    if not conf.urlFile:
        for pocname, pocInstance in kb.registeredPocs.items():
            target_urls = []
            if conf.url.endswith('/24'):
                try:
                    socket.inet_aton(conf.url.split('/')[0])
                    base_addr = conf.url[:conf.url.rfind('.') + 1]
                    target_urls = [
                        '{}{}'.format(base_addr, i)
                        for i in xrange(1, 255 + 1)
                    ]
                except socket.error:
                    errMsg = 'only id address acceptable'
                    logger.log(CUSTOM_LOGGING.ERROR, errMsg)
            else:
                target_urls = conf.url.split(',')

            for url in target_urls:
                if url:
                    kb.targets.put((url, pocInstance, pocname))

        return

    conf.urlFile = safeExpandUser(conf.urlFile)
    infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
    logger.log(CUSTOM_LOGGING.SYSINFO, infoMsg)

    if not os.path.isfile(conf.urlFile):
        errMsg = "the specified file does not exist"
        raise PeneworkFilePathException(errMsg)

    for line in getFileItems(conf.urlFile):
        for pocname, poc in kb.registeredPocs.items():
            if not isinstance(poc, dict):
                kb.targets.put((line.strip(), copy.copy(poc), pocname))
            else:
                kb.targets.put((line.strip(), poc, pocname))
Exemple #4
0
def setMultipleTarget():

    if not conf.urlFile:
        for pocname, pocInstance in kb.registeredPocs.items():
            kb.targets.put((conf.url, pocInstance, pocname))
        return

    conf.urlFile = safeExpandUser(conf.urlFile)
    infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
    logger.log(CUSTOM_LOGGING.SYSINFO, infoMsg)

    if not os.path.isfile(conf.urlFile):
        errMsg = "the specified file does not exist"
        raise PocsuiteFilePathException(errMsg)

    for line in getFileItems(conf.urlFile):
        for pocname, poc in kb.registeredPocs.items():
            if not isinstance(poc, dict):
                kb.targets.put((line.strip(), copy.copy(poc), pocname))
            else:
                kb.targets.put((line.strip(), poc, pocname))
Exemple #5
0
def setMultipleTarget():

    if not conf.urlFile:
        for pocname, pocInstance in kb.registeredPocs.items():
            kb.targets.put((conf.url, pocInstance, pocname))
        return

    conf.urlFile = safeExpandUser(conf.urlFile)
    infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
    logger.log(CUSTOM_LOGGING.SYSINFO, infoMsg)

    if not os.path.isfile(conf.urlFile):
        errMsg = "the specified file does not exist"
        raise PocsuiteFilePathException(errMsg)

    for line in getFileItems(conf.urlFile):
        for pocname, poc in kb.registeredPocs.items():
            if not isinstance(poc, dict):
                kb.targets.put((line.strip(), copy.copy(poc), pocname))
            else:
                kb.targets.put((line.strip(), poc, pocname))
Exemple #6
0
def setMultipleTarget():
    if conf.requires or conf.requiresFreeze:
        return

    if not conf.urlFile:
        for pocname, pocInstance in kb.registeredPocs.items():
            target_urls = []
            if conf.url.endswith('/24'):
                try:
                    socket.inet_aton(conf.url.split('/')[0])
                    base_addr = conf.url[:conf.url.rfind('.') + 1]
                    target_urls = ['{}{}'.format(base_addr, i)
                                   for i in xrange(1, 255 + 1)]
                except socket.error:
                    errMsg = 'only id address acceptable'
                    logger.log(CUSTOM_LOGGING.ERROR, errMsg)
            else:
                target_urls = conf.url.split(',')

            for url in target_urls:
                if url:
                    kb.targets.put((url, pocInstance, pocname))

        return

    conf.urlFile = safeExpandUser(conf.urlFile)
    infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
    logger.log(CUSTOM_LOGGING.SYSINFO, infoMsg)

    if not os.path.isfile(conf.urlFile):
        errMsg = "the specified file does not exist"
        raise PeneworkFilePathException(errMsg)

    for line in getFileItems(conf.urlFile):
        for pocname, poc in kb.registeredPocs.items():
            if not isinstance(poc, dict):
                kb.targets.put((line.strip(), copy.copy(poc), pocname))
            else:
                kb.targets.put((line.strip(), poc, pocname))