Commit b50f9227 authored by Alexandre's avatar Alexandre
Browse files

Option --silent to remove response display (multistreams)

parent 9bf9dc22
......@@ -62,6 +62,7 @@ Possible options, besides `--dot`:
* --file INPUT_FILE: provide an input file with a list of domain name to query
(read the first line only, use --repeat N to read up to N lines of the file)
* --repeat N: repeat a test N times or read up to N lines of a file
* --silent: suppress response output (with --multistreams only)
### Check
......
......@@ -54,6 +54,7 @@ forceIPv6 = False
connectTo = None
multistreams = False
sync = False
silent = False
check = False
mandatory_level = None
check_additional = True
......@@ -566,7 +567,8 @@ class ConnectionDoH(Connection):
def read_result_handle(self, handle):
self.receive(handle)
handle.request.check_response()
print("Return code %s:\n%s\n" % (handle.request.rcode, handle.request.response))
if not silent:
print("Return code %s:\n%s\n" % (handle.request.rcode, handle.request.response))
def read_results(self):
for handle in self.all_handles:
......@@ -792,7 +794,8 @@ if not monitoring:
try:
optlist, args = getopt.getopt (sys.argv[1:], "hvPkeV:r:f:d:t46",
["help", "verbose", "dot", "head",
"insecure", "POST", "vhost=", "multistreams", "sync",
"insecure", "POST", "vhost=", "multistreams",
"sync", "silent",
"dnssec", "noedns", "ecs", "repeat=", "file=", "delay=",
"key=", "nosni",
"v4only", "v6only",
......@@ -817,6 +820,8 @@ if not monitoring:
multistreams = True
elif option == "--sync":
sync = True
elif option == "--silent":
silent = True
elif option == "--dnssec":
dnssec = True
elif option == "--nosni":
......@@ -874,6 +879,9 @@ if not monitoring:
if sync and not multistreams:
usage("--sync cannot be used without --multistreams")
sys.exit(1)
if silent and not multistreams:
usage("--silent cannot be used without --multistreams")
sys.exit(1)
if not edns and not no_ecs:
usage("ECS requires EDNS")
sys.exit(1)
......@@ -1034,7 +1042,7 @@ for connectTo in ip_set:
input = open(ifile)
if not check:
for i in range (0, tests):
if tests > 1:
if tests > 1 and (verbose or not silent):
print("\nTest %i" % i)
if ifile is not None:
name, rtype = get_next_domain(input)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment