Beispiel #1
0
def ssllabs_task(scan_id, site_id):

    logger.info("Counting websec bugs for site %s" % site_id)

    try:

        scan = scans.find_one({"_id": ObjectId(scan_id)})
        if not scan:
            logger.error("Cannot load scan %s" % scan_id)
            return

        site = find_site(scan, site_id)
        if not site:
            logger.error("Cannot find site in scan")
            return

        r = final_response(site["responses"]["http"], site["responses"]["https"])
        if is_https(r):

            url = urlparse.urlparse(site["url"])
            logger.info("Going to check %s with ssllabs" % url.hostname)

            try:
                results = ssllabs.assess_site(url.hostname)
                scans.update(
                    {"_id": ObjectId(scan_id), "sites._id": ObjectId(site_id)}, {"$set": {"sites.$.ssllabs": results}}
                )
            except Exception as e:
                logger.exception("Error while talking to ssllabs")

    except Exception as e:

        logger.exception("Error while running ssllabs_task")
def cipherscan_task(scan_id, site_id):

    logger.debug("Running cipherscan against site %s" % site_id)

    try:

        scan = scans.find_one({"_id": ObjectId(scan_id)})
        if not scan:
            logger.error("Cannot load scan %s" % scan_id)
            return

        site = find_site(scan, site_id)
        if not site:
            logger.error("Cannot find site in scan")
            return

        if site.get("error"):
            logger.debug("site has an error, skipping tests")
            return

        r = final_response(site["responses"]["http"], site["responses"]["https"])
        if is_https(r):

            url = urlparse.urlparse(site["url"])
            logger.debug("Going to check %s with cipherscan" % url.hostname)

            try:
                results = cipherscan_analyze(url.hostname, path="/home/sarentz/Projects/cipherscan")
                scans.update({"_id": ObjectId(scan_id), "sites._id": ObjectId(site_id)},
                             {"$set": {"sites.$.cipherscan": results}})
            except Exception as e:
                logger.exception("Error while running cipherscan")

    except Exception as e:

        logger.exception("Error while running ssllabs_task")
def ssllabs_task(scan_id, site_id):

    logger.debug("Counting websec bugs for site %s" % site_id)

    try:

        scan = scans.find_one({"_id": ObjectId(scan_id)})
        if not scan:
            logger.error("Cannot load scan %s" % scan_id)
            return

        site = find_site(scan, site_id)
        if not site:
            logger.error("Cannot find site in scan")
            return

        if site.get("error"):
            logger.debug("site has an error, skipping tests")
            return

        r = final_response(site["responses"]["http"], site["responses"]["https"])
        if is_https(r):

            url = urlparse.urlparse(site["url"])
            logger.debug("Going to check %s with ssllabs" % url.hostname)

            try:
                results = ssllabs.assess_site(url.hostname)
                scans.update({"_id": ObjectId(scan_id), "sites._id": ObjectId(site_id)},
                             {"$set": {"sites.$.ssllabs": results}})
            except Exception as e:
                logger.exception("Error while talking to ssllabs")

    except Exception as e:

        logger.exception("Error while running ssllabs_task")