Hello community, here is the log from the commit of package dnsdiag for openSUSE:Factory checked in at 2020-01-20 22:51:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dnsdiag (Old) and /work/SRC/openSUSE:Factory/.dnsdiag.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dnsdiag" Mon Jan 20 22:51:45 2020 rev:3 rq:765613 version:1.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/dnsdiag/dnsdiag.changes 2019-08-27 10:28:52.027907789 +0200 +++ /work/SRC/openSUSE:Factory/.dnsdiag.new.26092/dnsdiag.changes 2020-01-20 22:52:22.943272832 +0100 @@ -1,0 +2,11 @@ +Sun Jan 19 16:06:15 UTC 2020 - Martin Hauke <[email protected]> + +- Update to version 1.7.0 + * Add JSON export + * Ignore unrelated ICMP messages + * Fix statistics calculation + * -c 0 for infinite ping + * Flush output messages + * Update sample public resolver data + +------------------------------------------------------------------- Old: ---- dnsdiag-1.6.4.tar.gz New: ---- dnsdiag-1.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dnsdiag.spec ++++++ --- /var/tmp/diff_new_pack.m3iZ6S/_old 2020-01-20 22:52:24.139273292 +0100 +++ /var/tmp/diff_new_pack.m3iZ6S/_new 2020-01-20 22:52:24.143273294 +0100 @@ -1,7 +1,7 @@ # # spec file for package dnsdiag # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2017, Martin Hauke <[email protected]> # # All modifications and additions to the file contributed by third parties @@ -19,7 +19,7 @@ %bcond_without test Name: dnsdiag -Version: 1.6.4 +Version: 1.7.0 Release: 0 Summary: DNS request auditing toolset License: BSD-3-Clause ++++++ dnsdiag-1.6.4.tar.gz -> dnsdiag-1.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/LICENSE new/dnsdiag-1.7.0/LICENSE --- old/dnsdiag-1.6.4/LICENSE 2016-02-03 08:31:58.000000000 +0100 +++ new/dnsdiag-1.7.0/LICENSE 2020-01-18 10:44:22.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2016, Babak Farrokhi +Copyright (c) 2020, Babak Farrokhi All rights reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/PKG-INFO new/dnsdiag-1.7.0/PKG-INFO --- old/dnsdiag-1.6.4/PKG-INFO 2018-04-03 14:38:55.000000000 +0200 +++ new/dnsdiag-1.7.0/PKG-INFO 2020-01-19 16:36:53.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: dnsdiag -Version: 1.6.4 +Version: 1.7.0 Summary: DNS Diagnostics and measurement tools (ping, traceroute) Home-page: https://dnsdiag.org/ Author: Babak Farrokhi @@ -12,13 +12,18 @@ you can measure your DNS response quality from delay and loss perspective as well as tracing the path your DNS query takes to get to DNS server. -Keywords: dns traceroute ping +Keywords: dns traceroute ping performance Platform: UNKNOWN Classifier: Topic :: System :: Networking Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Internet :: Name Service (DNS) Classifier: Development Status :: 5 - Production/Stable Classifier: Operating System :: OS Independent diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/README.md new/dnsdiag-1.7.0/README.md --- old/dnsdiag-1.6.4/README.md 2018-04-03 07:48:49.000000000 +0200 +++ new/dnsdiag-1.7.0/README.md 2019-11-02 13:38:19.000000000 +0100 @@ -1,4 +1,4 @@ -[](https://travis-ci.org/farrokhi/dnsdiag) [](https://pypi.python.org/pypi/dnsdiag/) []() []() [](https://github.com/farrokhi/dnsdiag/stargazers) +[](https://travis-ci.org/farrokhi/dnsdiag) [](https://pypi.python.org/pypi/dnsdiag/) []() [](https://app.fossa.io/projects/git%2Bgithub.com%2Ffarrokhi%2Fdnsdiag?ref=badge_shield) []() [](https://github.com/farrokhi/dnsdiag/stargazers) DNS Diagnostics and Performance Measurement Tools ================================================== @@ -127,3 +127,4 @@ dnsdiag is released under a 2 clause BSD license. +[](https://app.fossa.io/projects/git%2Bgithub.com%2Ffarrokhi%2Fdnsdiag?ref=badge_large) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/dnsdiag.egg-info/PKG-INFO new/dnsdiag-1.7.0/dnsdiag.egg-info/PKG-INFO --- old/dnsdiag-1.6.4/dnsdiag.egg-info/PKG-INFO 2018-04-03 14:38:55.000000000 +0200 +++ new/dnsdiag-1.7.0/dnsdiag.egg-info/PKG-INFO 2020-01-19 16:36:53.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: dnsdiag -Version: 1.6.4 +Version: 1.7.0 Summary: DNS Diagnostics and measurement tools (ping, traceroute) Home-page: https://dnsdiag.org/ Author: Babak Farrokhi @@ -12,13 +12,18 @@ you can measure your DNS response quality from delay and loss perspective as well as tracing the path your DNS query takes to get to DNS server. -Keywords: dns traceroute ping +Keywords: dns traceroute ping performance Platform: UNKNOWN Classifier: Topic :: System :: Networking Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Internet :: Name Service (DNS) Classifier: Development Status :: 5 - Production/Stable Classifier: Operating System :: OS Independent diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/dnsdiag.egg-info/requires.txt new/dnsdiag-1.7.0/dnsdiag.egg-info/requires.txt --- old/dnsdiag-1.6.4/dnsdiag.egg-info/requires.txt 2018-04-03 14:38:55.000000000 +0200 +++ new/dnsdiag-1.7.0/dnsdiag.egg-info/requires.txt 2020-01-19 16:36:53.000000000 +0100 @@ -1,2 +1,2 @@ -dnspython>=1.15.0 +dnspython>=1.16.0 cymruwhois>=1.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/dnseval.py new/dnsdiag-1.7.0/dnseval.py --- old/dnsdiag-1.6.4/dnseval.py 2018-04-03 14:31:21.000000000 +0200 +++ new/dnsdiag-1.7.0/dnseval.py 2020-01-18 10:59:18.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (c) 2016, Babak Farrokhi +# Copyright (c) 2020, Babak Farrokhi # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,6 +29,8 @@ import getopt import ipaddress +import datetime +import json import signal import socket import sys @@ -42,7 +44,7 @@ __author__ = 'Babak Farrokhi ([email protected])' __license__ = 'BSD' -__version__ = "1.6.4" +__version__ = "1.7.0" __progname__ = os.path.basename(sys.argv[0]) shutdown = False @@ -229,6 +231,7 @@ waittime = 2 inputfilename = None fromfile = False + save_json = False use_tcp = False use_edns = True force_miss = False @@ -238,7 +241,7 @@ try: opts, args = getopt.getopt(sys.argv[1:], "hf:c:t:w:TevCm", - ["help", "file=", "count=", "type=", "wait=", "tcp", "edns", "verbose", "color", + ["help", "file=", "count=", "type=", "wait=", "json", "tcp", "edns", "verbose", "color", "force-miss"]) except getopt.GetoptError as err: print(err) @@ -265,6 +268,8 @@ dnsrecord = a elif o in ("-T", "--tcp"): use_tcp = True + elif o in ("-j", "--json"): + save_json = True elif o in ("-e", "--edns"): use_edns = False elif o in ("-C", "--color"): @@ -355,6 +360,22 @@ print("%s %-8.3f %-8.3f %-8.3f %-8.3f %s%%%-3d%s %-8s %21s" % ( resolver, r_avg, r_min, r_max, r_stddev, l_color, r_lost_percent, color.N, s_ttl, text_flags), flush=True) + if save_json: + dns_data = {} + dns_data['hostname'] = hostname + dns_data['timestamp'] = str(datetime.datetime.now()) + dns_data['r_min'] = r_min + dns_data['r_avg'] = r_avg + dns_data['resolver'] = resolver + dns_data['r_max'] = r_max + dns_data['r_lost_percent'] = r_lost_percent + dns_data['s_ttl'] = s_ttl + dns_data['text_flags'] = text_flags + outer_data = {} + outer_data['hostname'] = hostname + outer_data['data'] = dns_data + with open('results.json', 'a+') as outfile: + json.dump(outer_data, outfile) if verbose and hasattr(answers, 'response'): ans_index = 1 for answer in answers.response.answer: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/dnsping.py new/dnsdiag-1.7.0/dnsping.py --- old/dnsdiag-1.6.4/dnsping.py 2018-04-03 14:31:32.000000000 +0200 +++ new/dnsdiag-1.7.0/dnsping.py 2020-01-18 10:59:32.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (c) 2016, Babak Farrokhi +# Copyright (c) 2020, Babak Farrokhi # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,7 +40,7 @@ __author__ = 'Babak Farrokhi ([email protected])' __license__ = 'BSD' -__version__ = "1.6.4" +__version__ = "1.7.0" __progname__ = os.path.basename(sys.argv[0]) shutdown = False @@ -58,7 +58,7 @@ -6 --ipv6 Use IPv6 as default network protocol -P --srcport Query source port number (default: 0) -S --srcip Query source IP address (default: default interface address) - -c --count Number of requests to send (default: 10) + -c --count Number of requests to send (default: 10, 0 for infinity) -w --wait Maximum wait time for a reply (default: 2 seconds) -i --interval Time between each request (default: 1 seconds) -t --type DNS request record type (default: A) @@ -106,7 +106,7 @@ "port=", "srcip=", "tcp", "ipv4", "ipv6", "srcport=", "edns"]) except getopt.GetoptError as err: # print help information and exit: - print(err) # will print something like "option -a not recognized" + print(err, file=sys.stderr) # will print something like "option -a not recognized" usage() if args and len(args) == 1: @@ -118,7 +118,7 @@ if o in ("-h", "--help"): usage() elif o in ("-c", "--count"): - count = int(a) + count = abs(int(a)) elif o in ("-v", "--verbose"): verbose = True elif o in ("-s", "--server"): @@ -145,7 +145,7 @@ elif o in ("-P", "--srcport"): src_port = int(a) if src_port < 1024: - print("WARNING: Source ports below 1024 are only available to superuser") + print("WARNING: Source ports below 1024 are only available to superuser", flush=True) elif o in ("-S", "--srcip"): src_ip = a else: @@ -158,7 +158,7 @@ try: dnsserver = socket.getaddrinfo(dnsserver, port=None, family=af)[1][4][0] except OSError: - print('Error: cannot resolve hostname:', dnsserver) + print('Error: cannot resolve hostname:', dnsserver, file=sys.stderr, flush=True) sys.exit(1) resolver = dns.resolver.Resolver() @@ -174,11 +174,16 @@ response_time = [] i = 0 - print("%s DNS: %s:%d, hostname: %s, rdatatype: %s" % (__progname__, dnsserver, dst_port, hostname, dnsrecord)) + print("%s DNS: %s:%d, hostname: %s, rdatatype: %s" % (__progname__, dnsserver, dst_port, hostname, dnsrecord), + flush=True) - for i in range(count): - if shutdown: + while not shutdown: + + if 0 < count <= i: break + else: + i += 1 + try: stime = time.perf_counter() answers = resolver.query(hostname, dnsrecord, source_port=src_port, source=src_ip, tcp=use_tcp, @@ -186,23 +191,23 @@ etime = time.perf_counter() except dns.resolver.NoNameservers as e: if not quiet: - print("No response to dns request") + print("No response to dns request", file=sys.stderr, flush=True) if verbose: - print("error:", e) + print("error:", e, file=sys.stderr, flush=True) sys.exit(1) except dns.resolver.NXDOMAIN as e: if not quiet: - print("Hostname does not exist") + print("Hostname does not exist", file=sys.stderr, flush=True) if verbose: - print("Error:", e) + print("Error:", e, file=sys.stderr, flush=True) sys.exit(1) except dns.resolver.Timeout: if not quiet: - print("Request timeout") + print("Request timeout", flush=True) pass except dns.resolver.NoAnswer: if not quiet: - print("No answer") + print("No answer", flush=True) pass else: elapsed = answers.response.time * 1000 # convert to milliseconds @@ -210,16 +215,16 @@ if not quiet: print( "%d bytes from %s: seq=%-3d time=%.3f ms" % ( - len(str(answers.rrset)), dnsserver, i, elapsed)) + len(str(answers.rrset)), dnsserver, i, elapsed), flush=True) if verbose: - print(answers.rrset) - print("flags:", dns.flags.to_text(answers.response.flags)) + print(answers.rrset, flush=True) + print("flags:", dns.flags.to_text(answers.response.flags), flush=True) time_to_next = (stime + interval) - etime if time_to_next > 0: time.sleep(time_to_next) - r_sent = i + 1 + r_sent = i r_received = len(response_time) r_lost = r_sent - r_received r_lost_percent = (100 * r_lost) / r_sent @@ -237,9 +242,10 @@ r_avg = 0 r_stddev = 0 - print('\n--- %s dnsping statistics ---' % dnsserver) - print('%d requests transmitted, %d responses received, %.0f%% lost' % (r_sent, r_received, r_lost_percent)) - print('min=%.3f ms, avg=%.3f ms, max=%.3f ms, stddev=%.3f ms' % (r_min, r_avg, r_max, r_stddev)) + print('\n--- %s dnsping statistics ---' % dnsserver, flush=True) + print('%d requests transmitted, %d responses received, %.0f%% lost' % (r_sent, r_received, r_lost_percent), + flush=True) + print('min=%.3f ms, avg=%.3f ms, max=%.3f ms, stddev=%.3f ms' % (r_min, r_avg, r_max, r_stddev), flush=True) if __name__ == '__main__': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/dnstraceroute.py new/dnsdiag-1.7.0/dnstraceroute.py --- old/dnsdiag-1.6.4/dnstraceroute.py 2018-04-03 14:31:05.000000000 +0200 +++ new/dnsdiag-1.7.0/dnstraceroute.py 2020-01-18 10:59:43.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (c) 2016, Babak Farrokhi +# Copyright (c) 2020, Babak Farrokhi # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -44,7 +44,7 @@ # Global Variables __author__ = 'Babak Farrokhi ([email protected])' __license__ = 'BSD' -__version__ = "1.6.4" +__version__ = "1.7.0" _ttl = None quiet = False whois_cache = {} @@ -88,6 +88,7 @@ def whois_lookup(ip): + asn = None try: global whois_cache currenttime = time.time() @@ -100,9 +101,9 @@ c = cymruwhois.Client() asn = c.lookup(ip) whois_cache[ip] = (asn, currenttime) - return asn except Exception as e: - return e + pass + return asn def load_whois_cache(cachefile): @@ -246,6 +247,7 @@ use_edns = True color_mode = False + args = None try: opts, args = getopt.getopt(sys.argv[1:], "aqhc:s:S:t:w:p:nexC", ["help", "count=", "server=", "quiet", "type=", "wait=", "asn", "port", "expert", @@ -281,7 +283,7 @@ dest_port = int(a) elif o in ("-C", "--color"): color_mode = True - elif o in ("-n"): + elif o in "-n": should_resolve = False elif o in ("-a", "--asn"): as_lookup = True @@ -338,17 +340,21 @@ icmp_socket.settimeout(timeout) curr_addr = None - curr_host = None with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool: # dispatch dns lookup to another thread stime = time.perf_counter() thr = pool.submit(ping, resolver, hostname, dnsrecord, ttl, src_ip=src_ip, use_edns=use_edns) try: # expect ICMP response - _, curr_addr = icmp_socket.recvfrom(512) - curr_addr = curr_addr[0] + packet, curr_addr = icmp_socket.recvfrom(512) + if len(packet) > 51: + icmp_type = packet[20] + udp_port = packet[50] << 8 | packet[51] + if icmp_type == 11 and udp_port == dest_port: + curr_addr = curr_addr[0] + else: + curr_addr = None except socket.error: - etime = time.perf_counter() pass finally: etime = time.perf_counter() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/public-servers.txt new/dnsdiag-1.7.0/public-servers.txt --- old/dnsdiag-1.6.4/public-servers.txt 2018-04-03 07:48:49.000000000 +0200 +++ new/dnsdiag-1.7.0/public-servers.txt 2019-11-02 13:38:19.000000000 +0100 @@ -1,25 +1,42 @@ -8.8.8.8 -8.8.4.4 -2001:4860:4860::8888 -2001:4860:4860::8844 -9.9.9.9 -2620:fe::fe -1.1.1.1 +#Cloudflare 1.0.0.1 -2606:4700:4700::1111 +1.1.1.1 2606:4700:4700::1001 -4.2.2.1 -4.2.2.2 -4.2.2.3 -4.2.2.4 -4.2.2.5 -209.244.0.3 -209.244.0.4 +2606:4700:4700::1111 + +#SafeDNS 195.46.39.39 195.46.39.40 -216.146.35.35 -216.146.36.36 -208.67.222.222 + +#OpenDNS 208.67.220.220 +208.67.222.222 2620:0:ccc::2 2620:0:ccd::2 + +#DYN DNS +216.146.35.35 +216.146.36.36 + +#Level3 +209.244.0.3 +209.244.0.4 +4.2.2.1 +4.2.2.2 +4.2.2.3 +4.2.2.4 +4.2.2.5 + +#freenom world +80.80.80.80 +80.80.81.81 +#Google +8.8.4.4 +8.8.8.8 +2001:4860:4860::8844 +2001:4860:4860::8888 + +#PCH's Quad9 +9.9.9.9 +2620:fe::fe +149.112.112.112 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/public-v4.txt new/dnsdiag-1.7.0/public-v4.txt --- old/dnsdiag-1.6.4/public-v4.txt 2018-04-03 07:48:49.000000000 +0200 +++ new/dnsdiag-1.7.0/public-v4.txt 2019-11-02 13:38:19.000000000 +0100 @@ -1,18 +1,36 @@ -8.8.8.8 -8.8.4.4 -9.9.9.9 -1.1.1.1 +#Cloudflare 1.0.0.1 +1.1.1.1 + +#SafeDNS +195.46.39.39 +195.46.39.40 + +#OpenDNS +208.67.220.220 +208.67.222.222 + +#DYN DNS +216.146.35.35 +216.146.36.36 + +#Level3 +209.244.0.3 +209.244.0.4 4.2.2.1 4.2.2.2 4.2.2.3 4.2.2.4 4.2.2.5 -209.244.0.3 -209.244.0.4 -195.46.39.39 -195.46.39.40 -216.146.35.35 -216.146.36.36 -208.67.222.222 -208.67.220.220 + +#freenom world +80.80.80.80 +80.80.81.81 + +#Google +8.8.4.4 +8.8.8.8 + +#PCH's Quad9 +9.9.9.9 +149.112.112.112 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dnsdiag-1.6.4/setup.py new/dnsdiag-1.7.0/setup.py --- old/dnsdiag-1.6.4/setup.py 2018-04-03 14:31:15.000000000 +0200 +++ new/dnsdiag-1.7.0/setup.py 2020-01-18 11:01:06.000000000 +0100 @@ -2,17 +2,22 @@ setup( name="dnsdiag", - version="1.6.4", + version="1.7.0", packages=find_packages(), scripts=["dnseval.py", "dnsping.py", "dnstraceroute.py"], - install_requires=['dnspython>=1.15.0', 'cymruwhois>=1.6'], + install_requires=['dnspython>=1.16.0', 'cymruwhois>=1.6'], classifiers=[ "Topic :: System :: Networking", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: Name Service (DNS)", "Development Status :: 5 - Production/Stable", "Operating System :: OS Independent", @@ -28,7 +33,7 @@ as well as tracing the path your DNS query takes to get to DNS server. """, license="BSD", - keywords="dns traceroute ping", + keywords="dns traceroute ping performance", url="https://dnsdiag.org/", entry_points={ 'console_scripts': [
