Esempio n. 1
0
            utility.print_message(FAIL, msg)
            utility.write_log(30, msg)
            continue

        # Create report header.
        report.create_report_header(fqdn_list[idx], port_list[idx])

        # Check encoding.
        test_url = ''
        if int(port_list[idx]) in [80, 443]:
            test_url = protocol_list[idx] + '://' + fqdn_list[idx] + path_list[
                idx]
        else:
            test_url = protocol_list[idx] + '://' + fqdn_list[
                idx] + ':' + port_list[idx] + path_list[idx]
        _, server_header, res_header, res_body, encoding = utility.send_request(
            'GET', test_url)

        # Check cloud service.
        cloud_type = 'Unknown'
        if opt_cloud:
            cloud_type = cloud_checker.get_cloud_service(fqdn_list[idx])

        # Search Censys.
        if opt_censys:
            date = utility.get_current_date('%Y%m%d%H%M%S%f')[:-3]
            print_date = utility.transform_date_string(
                utility.transform_date_object(date[:-3], '%Y%m%d%H%M%S'))
            server_info, cert_info = censys.search_censys(
                utility.forward_lookup(fqdn_list[idx]), fqdn_list[idx])
            report.create_censys_report(fqdn_list[idx], port_list[idx],
                                        server_info, cert_info, print_date)
Esempio n. 2
0
                    parsed = None
                    try:
                        parsed = util.parse_url(target_url)
                    except Exception as e:
                        utility.print_exception(
                            e, 'Parsed error : {}'.format(target_url))
                        utility.write_log(
                            30, 'Parsed error : {}'.format(target_url))
                        continue

                    # Get HTTP response (header + body).
                    date = utility.get_current_date('%Y%m%d%H%M%S%f')[:-3]
                    print_date = utility.transform_date_string(
                        utility.transform_date_object(date[:-3],
                                                      '%Y%m%d%H%M%S'))
                    _, server_header, res_header, res_body = utility.send_request(
                        'GET', target_url)

                    # Write log.
                    log_name = protocol_list[idx] + '_' + fqdn_list[
                        idx] + '_' + str(port_list[idx]) + '_' + date + '.log'
                    log_path_fqdn = os.path.join(
                        log_path, fqdn_list[idx] + '_' + str(port_list[idx]) +
                        '_' + path_list[idx].replace('/', ''))
                    if os.path.exists(log_path_fqdn) is False:
                        os.mkdir(log_path_fqdn)
                    log_file = os.path.join(log_path_fqdn, log_name)
                    with codecs.open(log_file, 'w', 'utf-8') as fout:
                        fout.write(target_url + '\n\n' + res_header + res_body)

                    # Check product name/version using signature.
                    product_list = version_checker.get_product_name(