ungleich-game/archive/check-cli.py
2019-05-26 21:19:58 +02:00

44 lines
1.2 KiB
Python

#!/usr/bin/env python
import check
import argparse
import logging
logging.basicConfig()
log = logging.getLogger(None)
def do_checks():
checks = []
checks.append(check.DNSCheck("www.ungleich.ch"))
checks.append(check.DNSCheck("www.ungleich.ch", expected_result="2a0a:e5c0:0:2:400:b3ff:fe39:795c"))
checks.append(check.DNSCheck("www.ungleich.ch", rr_type="A", expected_result="185.203.112.17"))
for num_server in range(1,6):
server="d{}.ungleich.ch".format(num_server)
checks.append(check.DNSCheck("www.ungleich.ch", server=server))
checks.append(check.DFCheck(server))
for c in checks:
print("{} {}".format(c, c.check()))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='checks')
parser.add_argument('--debug', help='Enable debug logging', action='store_true')
parser.add_argument('--verbose', help='Enable verbose logging', action='store_true')
args = parser.parse_args()
if args.debug:
log.setLevel(logging.DEBUG)
print("dbg")
elif args.verbose:
log.setLevel(logging.INFO)
else:
log.setLevel(logging.WARNING)
do_checks()