Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
DNS testing tools
Remoh
Commits
3f197e0d
Commit
3f197e0d
authored
Mar 20, 2020
by
Alexandre
Browse files
Returns a Request object in do_test
parent
35e1483e
Changes
1
Hide whitespace changes
Inline
Side-by-side
homer.py
View file @
3f197e0d
...
...
@@ -268,15 +268,14 @@ class Connection:
self
.
family
=
0
def
do_test
(
self
,
qname
,
qtype
=
rtype
):
# Routine doing one actual test. Returns a tuple, first member is a
# result (boolean indicating success for DoT, HTTP status code for
# DoH), second member is a DNS message (or a string if there is an
# error), third member is the size of the DNS message (or None if no
# proper response).
# Routine doing one actual test. Returns a Request object
pass
def
print_result
(
self
,
r
code
,
msg
,
size
):
def
print_result
(
self
,
r
equest
):
ok
=
True
rcode
=
request
.
rcode
msg
=
request
.
response
size
=
request
.
response_size
if
(
self
.
dot
and
rcode
)
or
(
not
self
.
dot
and
rcode
==
200
):
if
not
monitoring
:
print
(
msg
)
...
...
@@ -380,7 +379,7 @@ class ConnectionDoT(Connection):
request
=
RequestDoT
(
qname
,
qtype
,
want_dnssec
=
dnssec
,
use_edns
=
edns
)
self
.
send_and_receive
(
request
)
request
.
check_response
()
return
(
request
.
rcode
,
request
.
response
,
request
.
response_size
)
return
request
class
ConnectionDoH
(
Connection
):
...
...
@@ -483,7 +482,7 @@ class ConnectionDoH(Connection):
request
.
post
=
post
self
.
send_and_receive
(
request
)
request
.
check_response
()
return
(
request
.
rcode
,
request
.
response
,
request
.
response_size
)
return
request
def
get_next_domain
(
input_file
):
...
...
@@ -657,12 +656,12 @@ for i in range (0, tests):
if
ifile
is
not
None
:
name
,
rtype
=
get_next_domain
(
input
)
try
:
(
rcode
,
msg
,
size
)
=
conn
.
do_test
(
name
,
rtype
)
request
=
conn
.
do_test
(
name
,
rtype
)
except
(
OpenSSL
.
SSL
.
Error
,
CustomException
)
as
e
:
ok
=
False
error
(
e
)
break
if
not
conn
.
print_result
(
r
code
,
msg
,
size
):
if
not
conn
.
print_result
(
r
equest
):
ok
=
False
if
tests
>
1
and
i
==
0
:
start2
=
time
.
time
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment