Exemplo n.º 1
0
def download(config, server, scan_name, x, protocol):
    query_client = WebinspectQueryClient(host=server, protocol=protocol)
    try:
        search_results = query_client.get_scan_by_name(scan_name)
        if len(search_results) == 0:
            Logger.console.info(
                "No scans matching the name {} where found on this host".
                format(scan_name))
        elif len(search_results) == 1:
            scan_id = search_results[0]['ID']
            Logger.console.info(
                "Scan matching the name {} found.\nDownloading scan {} ...".
                format(scan_name, scan_id))
            query_client.export_scan_results(scan_id, scan_name, x)
        else:
            Logger.console.info(
                "Multiple scans matching the name {} found.".format(scan_name))
            Logger.console.info("{0:80} {1:40} {2:10}".format(
                'Scan Name', 'Scan ID', 'Scan Status'))
            Logger.console.info("{0:80} {1:40} {2:10}\n".format(
                '-' * 80, '-' * 40, '-' * 10))
            for result in search_results:
                Logger.console.info("{0:80} {1:40} {2:10}".format(
                    result['Name'], result['ID'], result['Status']))
    except:
        Logger.console.info("Unable to complete command 'webinspect download'")
Exemplo n.º 2
0
def webinspect_list(config, server, scan_name, protocol):
    query_client = WebinspectQueryClient(host=server, protocol=protocol)
    try:
        if scan_name:
            results = query_client.get_scan_by_name(scan_name)
            if len(results):
                Logger.console.info("Scans matching the name {} found.".format(scan_name))
                Logger.console.info("{0:80} {1:40} {2:10}".format('Scan Name', 'Scan ID', 'Scan Status'))
                Logger.console.info("{0:80} {1:40} {2:10}\n".format('-' * 80, '-' * 40, '-' * 10))
                for match in results:
                    Logger.console.info(
                        "{0:80} {1:40} {2:10}".format(match['Name'], match['ID'], match['Status']))
            else:
                Logger.console.info("No scans matching the name {} were found.".format(scan_name))
        else:
            query_client.list_scans()
    except:
        Logger.console.info("Unable to complete command 'webinspect list'")