Beispiel #1
0
                    help="The path of the directory containing DNS data files to analyze")
    parser.add_argument('summaries_file', type=str, nargs="?",
                    help="A file containing a dictionary of measurement_id : measurement_summary.  If ommitted, summaries are obtained from internet.")
    return parser.parse_args()


# Call the script by typing:
#	$ python explore_data.py filename [limit] [summaries_file]
# where filename is the name of a file containing a ripe atlas response
if __name__ == "__main__":
    args = parse_args()
    summaries_file = args.summaries_file
    csv_file = join(args.csv_path, CSV_FILE_NAME)
    data_path = args.data_path

    list_of_headings = DNS_Measurement.get_qtype_headings()
    Measurements.prep_csv_file(csv_file, list_of_headings)

    list_of_entries = listdir(data_path)
    list_of_files = [f for f in list_of_entries if isfile(join(data_path, f))]

    for this_file in list_of_files:
    	measurement_file = Measurement_File(this_file)
    	measurement_id = measurement_file.get_measurement_id_from_file()
    	if measurement_id == None:
            print(this_file + " appears to be empty.  Skipping.")
            continue
    	measurement_summary = measurement_file.get_measurement_summary_from_file(measurement_id, summaries_file)
    	measurement_type = measurement_file.get_measurement_type_from_summary(measurement_summary)

    	if measurement_type == 'dns':
Beispiel #2
0
                    help="The filename containing the data to print")
    parser.add_argument('limit', type=int, nargs="?",
                    help="The max number of measurements results to print.  If ommitted, all measurement results in the file will be printed.")
    parser.add_argument('summaries_file', type=str, nargs="?",
                    help="A file containing a dictionary of measurement_id : measurement_summary.  If ommitted, summaries are obtained from internet.")
    return parser.parse_args()

# Call the script by typing:
#	$ python explore_data.py filename [limit] [summaries_file]
# where filename is the name of a file containing a ripe atlas response
if __name__ == "__main__":
    args = parse_args()
    file_name = args.filename
    limit = args.limit
    summaries_file = args.summaries_file

    measurement_file = Measurement_File(file_name)
    
    measurement_id = measurement_file.get_measurement_id_from_file()
    measurement_summary = measurement_file.get_measurement_summary_from_file(measurement_id, summaries_file)
    measurement_type = measurement_file.get_measurement_type_from_summary(measurement_summary)
    if measurement_type == 'dns':
    	a_measurement = DNS_Measurement(file_name, measurement_id, measurement_summary, measurement_type)
    elif measurement_type == 'ping':
    	a_measurement = Ping_Measurement(file_name, measurement_id, measurement_summary, measurement_type)
    elif measurement_type == 'traceroute':
    	a_measurement = Traceroute_Measurement(file_name, measurement_id, measurement_summary, measurement_type)
    else:
    	a_measurement = Measurement(file_name, measurement_id, measurement_summary, measurement_type)
    a_measurement.print_nicely(limit)
    
Beispiel #3
0
        help=
        "A file containing a dictionary of measurement_id : measurement_summary.  If ommitted, summaries are obtained from internet."
    )
    return parser.parse_args()


# Call the script by typing:
#	$ python explore_data.py filename [limit] [summaries_file]
# where filename is the name of a file containing a ripe atlas response
if __name__ == "__main__":
    args = parse_args()
    summaries_file = args.summaries_file
    csv_file = join(args.csv_path, CSV_FILE_NAME)
    data_path = args.data_path

    list_of_headings = DNS_Measurement.get_qtype_headings()
    Measurements.prep_csv_file(csv_file, list_of_headings)

    list_of_entries = listdir(data_path)
    list_of_files = [f for f in list_of_entries if isfile(join(data_path, f))]

    for this_file in list_of_files:
        measurement_file = Measurement_File(this_file)
        measurement_id = measurement_file.get_measurement_id_from_file()
        if measurement_id == None:
            print(this_file + " appears to be empty.  Skipping.")
            continue
        measurement_summary = measurement_file.get_measurement_summary_from_file(
            measurement_id, summaries_file)
        measurement_type = measurement_file.get_measurement_type_from_summary(
            measurement_summary)