1 1.1 christos # Copyright (C) Internet Systems Consortium, Inc. ("ISC") 2 1.1 christos # 3 1.1.1.5 christos # SPDX-License-Identifier: MPL-2.0 4 1.1.1.5 christos # 5 1.1 christos # This Source Code Form is subject to the terms of the Mozilla Public 6 1.1.1.5 christos # License, v. 2.0. If a copy of the MPL was not distributed with this 7 1.1.1.4 christos # file, you can obtain one at https://mozilla.org/MPL/2.0/. 8 1.1 christos # 9 1.1 christos # See the COPYRIGHT file distributed with this work for additional 10 1.1 christos # information regarding copyright ownership. 11 1.1 christos 12 1.1.1.2 christos import sys 13 1.1.1.2 christos 14 1.1 christos try: 15 1.1 christos import yaml 16 1.1.1.2 christos except (ModuleNotFoundError, ImportError): 17 1.1 christos print("No python yaml module, skipping") 18 1.1.1.2 christos sys.exit(1) 19 1.1 christos 20 1.1 christos import subprocess 21 1.1 christos import pprint 22 1.1 christos 23 1.1.1.2 christos DNSTAP_READ = sys.argv[1] 24 1.1.1.2 christos DATAFILE = sys.argv[2] 25 1.1.1.5 christos ARGS = [DNSTAP_READ, "-y", DATAFILE] 26 1.1 christos 27 1.1.1.2 christos with subprocess.Popen(ARGS, stdout=subprocess.PIPE) as f: 28 1.1.1.3 christos for y in yaml.load_all(f.stdout, Loader=yaml.SafeLoader): 29 1.1.1.3 christos pprint.pprint(y) 30