Commit 6cc26f8b authored by Alexandre's avatar Alexandre
Browse files

New option --truncated-data to send mangled DNS query

parent 2301452c
......@@ -67,6 +67,8 @@ Possible options, besides `--dot`:
(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
* --no-display-results: do not output DNS response
* --truncated-data: send a mangled DNS query (equivalent to the
truncated test)
### Check
......@@ -40,6 +40,7 @@ debug = False
insecure = False
post = False
head = False
truncated_data = False
dnssec = False
edns = True
no_ecs = True
......@@ -131,6 +132,7 @@ def usage(msg=None):
--time Display the time elapsed for the query (only with
--truncated-data Mangle the DNS query, equivalent to the truncated test
--dnssec Request DNSSEC data (signatures)
--noedns Disable EDNS, default is to indicate EDNS support
--ecs Send ECS to authoritative servers, default is to
......@@ -833,7 +835,7 @@ def print_result(connection, request, prefix=None, display_err=True):
msg = msg.decode()
except (UnicodeDecodeError, AttributeError):
pass # Sometimes, msg can be binary, or Latin-1
print("HTTP error %i: %s" % (rcode, msg), file=sys.stderr)
print("HTTP error %i: %s" % (rcode, msg), file=sys.stderr)
if not dot:
print("%s HTTP error - %i: %s" % (server, rcode, msg))
......@@ -1031,7 +1033,7 @@ if not monitoring:
optlist, args = getopt.getopt (sys.argv[1:], "hvPkeV:r:f:d:t46",
["help", "verbose", "debug", "dot",
"head", "HEAD", "post", "POST",
"head", "HEAD", "post", "POST", "truncated-data",
"insecure", "vhost=", "multistreams",
"pipelining", "max-in-flight=", "key=",
"dnssec", "noedns", "ecs", "nosni",
......@@ -1054,6 +1056,8 @@ if not monitoring:
head = True
elif option == "--POST" or option == "--post" or option == "-P":
post = True
elif option == "--truncated-data":
truncated_data = True
elif option == "--vhost" or option == "-V":
vhostname = value
elif option == "--insecure" or option == "-k":
......@@ -1122,7 +1126,7 @@ if not monitoring:
if dot and (post or head):
usage("POST or HEAD makes non sense for DoT")
if post and head:
usage("POST or HEAD but not both")
......@@ -1307,7 +1311,7 @@ for connectTo in ip_set:
print("\nTest %i" % i)
if ifile is not None:
name, rtype = get_next_domain(input)
request = create_request(name, qtype=rtype, use_edns=edns, want_dnssec=dnssec, dot=dot)
request = create_request(name, qtype=rtype, use_edns=edns, want_dnssec=dnssec, dot=dot, trunc=truncated_data)
request.i = i
if not dot:
request.head = head
Markdown is supported
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