def cors_check(url, headers=None):
    # 0: 'DEBUG', 1: 'INFO', 2: 'WARNING', 3: 'ALERT', 4: 'disable log'
    log = Log(None, print_level=4)
    cfg = {"logger": log, "headers": headers}

    cors_check = CORSCheck(url, cfg)
    #msg = cors_check.check_all_in_parallel()
    msg = cors_check.check_one_by_one()
    return msg
Exemple #2
0
def scan(cfg):
    while not cfg["queue"].empty():
        try:
            item = cfg["queue"].get(timeout=1.0)
            cors_check = CORSCheck(item, cfg)
            cors_check.check_one_by_one()
        except Exception, e:
            print e
            break
def scan(cfg, log):
    global results

    while not cfg["queue"].empty():
        try:
            item = cfg["queue"].get(timeout=1.0)
            cors_check = CORSCheck(item, cfg)
            msg = cors_check.check_one_by_one()

            # Keeping results to be written to file only if needed
            if log.filename and msg:
                c.acquire()
                results.append(msg)
                c.release()
        except Exception as e:
            print(e)
            break