Commit 23cc6ea3 authored by Alexandre's avatar Alexandre

Rename project into Remoh

Due to possible legal issues with the use of «Homer» to refer to the
project and the tool, it has been decided to change the name into Remoh.
parent 0fe78e14
......@@ -12,13 +12,13 @@ echo "DoT"
for server in $(cat dot-servers.txt); do
echo ""
echo $server
./homer.py --check --dot $server $domain $type
./remoh.py --check --dot $server $domain $type
done
echo ""
echo "DoH"
for url in $(cat doh-servers.txt); do
echo ""
echo $url
./homer.py --check $url $domain $type
./remoh.py --check $url $domain $type
done
#!/usr/bin/env python3
# Homer is a DoH (DNS-over-HTTPS) and DoT (DNS-over-TLS) client. Its
# Remoh is a DoH (DNS-over-HTTPS) and DoT (DNS-over-TLS) client. Its
# main purpose is to test DoH and DoT resolvers. Reference site is
# <https://framagit.org/bortzmeyer/homer/> See author, documentation,
# etc, there, or in the README.md included with the distribution.
......@@ -22,7 +22,7 @@ except ImportError as e:
print(e)
sys.exit(1)
import homer
import remoh
# Values that can be changed from the command line
# "H:n:p:V:t:e:Pih46k:x"
......@@ -170,10 +170,10 @@ def parse_opts_monitoring(me, opts):
def run_default(name, connection, opts):
if connection.dot:
request = homer.RequestDOT(name, qtype=opts.rtype, use_edns=opts.edns,
request = remoh.RequestDOT(name, qtype=opts.rtype, use_edns=opts.edns,
want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
else:
request = homer.RequestDOH(name, qtype=opts.rtype, use_edns=opts.edns,
request = remoh.RequestDOH(name, qtype=opts.rtype, use_edns=opts.edns,
want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
request.to_wire()
......@@ -184,7 +184,7 @@ def run_default(name, connection, opts):
try:
connection.do_test(request)
except (OpenSSL.SSL.Error, homer.DOHException) as e:
except (OpenSSL.SSL.Error, remoh.DOHException) as e:
error(e)
return False
......@@ -202,7 +202,7 @@ if __name__ == '__main__':
# The provided host is indeed a valid IP
# TODO catch ValueError exception if the host is an url as in :
# ./check_doh -H https://doh.bortzmeyer.fr -n afnic.fr
if homer.is_valid_ip_address(opts.host)[0]:
if remoh.is_valid_ip_address(opts.host)[0]:
opts.connectTo = opts.host
ok = True
......@@ -212,12 +212,12 @@ if __name__ == '__main__':
extracheck = None
try:
if opts.dot:
conn = homer.ConnectionDOT(url, servername=extracheck, connect_to=opts.connectTo,
conn = remoh.ConnectionDOT(url, servername=extracheck, connect_to=opts.connectTo,
forceIPv4=opts.forceIPv4, forceIPv6=opts.forceIPv6,
insecure=opts.insecure,
sni=opts.sni, key=opts.key)
else:
conn = homer.ConnectionDOH(url, servername=extracheck, connect_to=opts.connectTo,
conn = remoh.ConnectionDOH(url, servername=extracheck, connect_to=opts.connectTo,
forceIPv4=opts.forceIPv4, forceIPv6=opts.forceIPv6,
insecure=opts.insecure)
except TimeoutError:
......@@ -228,7 +228,7 @@ if __name__ == '__main__':
error("\"%s\" not a name or an IP address" % url)
except socket.gaierror:
error("Could not resolve \"%s\"" % url)
except (homer.ConnectionException, homer.DOHException) as e:
except (remoh.ConnectionException, remoh.DOHException) as e:
error(e)
if conn.dot and not conn.success:
ok = False
......
#!/usr/bin/env python3
# Homer is a DoH (DNS-over-HTTPS) and DoT (DNS-over-TLS) client. Its
# Remoh is a DoH (DNS-over-HTTPS) and DoT (DNS-over-TLS) client. Its
# main purpose is to test DoH and DoT resolvers. Reference site is
# <https://framagit.org/bortzmeyer/homer/> See author, documentation,
# etc, there, or in the README.md included with the distribution.
......@@ -24,7 +24,7 @@ except ImportError as e:
print(e)
sys.exit(1)
import homer
import remoh
# Values that can be changed from the command line
class opts:
......@@ -171,13 +171,13 @@ def check_dot_two_requests(connection, opts):
if not connection.dot:
return True
r1 = homer.RequestDOT('framagit.org', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r2 = homer.RequestDOT('afnic.fr', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r1 = remoh.RequestDOT('framagit.org', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r2 = remoh.RequestDOT('afnic.fr', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
requests = []
requests.append(('Test 1', r1, homer.mandatory_levels["legal"]))
requests.append(('Test 1', r1, remoh.mandatory_levels["legal"]))
# RFC 7858 section 3.3, SHOULD accept several requests on one connection.
requests.append(('Test 2', r2, homer.mandatory_levels["necessary"]))
requests.append(('Test 2', r2, remoh.mandatory_levels["necessary"]))
return do_check(connection, requests, opts)
......@@ -186,21 +186,21 @@ def check_doh_methods(connection, opts):
if connection.dot:
return True
r1 = homer.RequestDOH('framagit.org', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r2 = homer.RequestDOH('afnic.fr', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r1 = remoh.RequestDOH('framagit.org', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r2 = remoh.RequestDOH('afnic.fr', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r2.post = True
r3 = homer.RequestDOH('www.rfc-editor.org', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r3 = remoh.RequestDOH('www.rfc-editor.org', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r3.head = True
requests = []
requests.append(('Test GET', r1, homer.mandatory_levels["legal"])) # RFC 8484, section 4.1
requests.append(('Test POST', r2, homer.mandatory_levels["legal"])) # RFC 8484, section 4.1
requests.append(('Test GET', r1, remoh.mandatory_levels["legal"])) # RFC 8484, section 4.1
requests.append(('Test POST', r2, remoh.mandatory_levels["legal"])) # RFC 8484, section 4.1
# HEAD method is not mentioned in RFC 8484 (see section 4.1), so just "nice to have".
requests.append(('Test HEAD', r3, homer.mandatory_levels["nicetohave"]))
requests.append(('Test HEAD', r3, remoh.mandatory_levels["nicetohave"]))
return do_check(connection, requests, opts)
def check_doh_header(connection, opts, level=homer.mandatory_levels["nicetohave"],
def check_doh_header(connection, opts, level=remoh.mandatory_levels["nicetohave"],
accept="application/dns-message", content_type="application/dns-message"):
# change the MIME value and see what happens
# based on the RFC only application/dns-message must be supported, any
......@@ -212,7 +212,7 @@ def check_doh_header(connection, opts, level=homer.mandatory_levels["nicetohave"
header = ["Accept: %s" % accept, "Content-type: %s" % content_type]
test_name = "Test Header MIME: %s " % ", ".join(h for h in header)
r1 = homer.RequestDOH('curl.haxx.se', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r1 = remoh.RequestDOH('curl.haxx.se', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
r1.post = True
requests = []
......@@ -252,7 +252,7 @@ def do_check(connection, requests, opts):
try:
connection.send_and_receive(bundle)
except (homer.ConnectionException, homer.DOHException) as e:
except (remoh.ConnectionException, remoh.DOHException) as e:
ok = False
print_check_result(test_name, ok, verbose=connection.verbose)
print(e, file=sys.stderr)
......@@ -266,7 +266,7 @@ def do_check(connection, requests, opts):
break
return ok
def check_truncated_query(connection, opts, level=homer.mandatory_levels["nicetohave"]):
def check_truncated_query(connection, opts, level=remoh.mandatory_levels["nicetohave"]):
# send truncated DNS request to the server and expect a HTTP return code
# either equal to 200 or in the 400 range
# in case the server answers with 200, look for a FORMERR error in the DNS
......@@ -281,9 +281,9 @@ def check_truncated_query(connection, opts, level=homer.mandatory_levels["niceto
test_name = 'Test truncated data'
if connection.dot:
request = homer.RequestDOT('example.com', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
request = remoh.RequestDOT('example.com', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
else:
request = homer.RequestDOH('example.com', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
request = remoh.RequestDOH('example.com', qtype=opts.rtype, use_edns=opts.edns, want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
request.post = True
request.trunc_data()
......@@ -307,7 +307,7 @@ def check_truncated_query(connection, opts, level=homer.mandatory_levels["niceto
# the RCODE set to FORMERR
# so response can not be parsed in this case
return True
except homer.DOHException as e:
except remoh.DOHException as e:
print(e, file=sys.stderr)
return False
......@@ -337,7 +337,7 @@ def run_check(connection):
ok = check_dot_two_requests(connection, opts)
else:
ok = check_doh_methods(connection, opts)
if not ok and opts.mandatory_level >= homer.mandatory_levels["nicetohave"]:
if not ok and opts.mandatory_level >= remoh.mandatory_levels["nicetohave"]:
return False
# TODO we miss the tests of pipelining and out-of-order for DoT and
......@@ -348,11 +348,11 @@ def run_check(connection):
# The DoH server is right to reject these (Example: 'HTTP
# error 415: only Content-Type: application/dns-message is
# supported')
ok = check_doh_header(connection, opts, level=homer.mandatory_levels["nocrash"], accept="text/html") and ok
ok = check_doh_header(connection, opts, level=homer.mandatory_levels["nocrash"], content_type="text/html") and ok
ok = check_doh_header(connection, opts, level=remoh.mandatory_levels["nocrash"], accept="text/html") and ok
ok = check_doh_header(connection, opts, level=remoh.mandatory_levels["nocrash"], content_type="text/html") and ok
# test if a truncated query breaks anything
ok = check_truncated_query(connection, opts, level=homer.mandatory_levels["nocrash"]) and ok
ok = check_truncated_query(connection, opts, level=remoh.mandatory_levels["nocrash"]) and ok
return ok
......@@ -472,13 +472,13 @@ def parse_opts(opts):
if not opts.edns and not opts.no_ecs:
error_and_exit("ECS requires EDNS")
if opts.mandatory_level is not None and \
opts.mandatory_level not in homer.mandatory_levels.keys():
opts.mandatory_level not in remoh.mandatory_levels.keys():
error_and_exit("Unknown mandatory level \"%s\"" % opts.mandatory_level)
if opts.mandatory_level is not None and not opts.check:
error_and_exit("--mandatory-level only makes sense with --check")
if opts.mandatory_level is None:
opts.mandatory_level = "necessary"
opts.mandatory_level = homer.mandatory_levels[opts.mandatory_level]
opts.mandatory_level = remoh.mandatory_levels[opts.mandatory_level]
if opts.ifile is None and (len(args) != 2 and len(args) != 3):
error_and_exit("Wrong number of arguments")
if opts.ifile is not None and len(args) != 1:
......@@ -508,10 +508,10 @@ def run_default(name, connection, opts):
name, opts.rtype = get_next_domain(input)
if connection.dot:
request = homer.RequestDOT(name, qtype=opts.rtype, use_edns=opts.edns,
request = remoh.RequestDOT(name, qtype=opts.rtype, use_edns=opts.edns,
want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
else:
request = homer.RequestDOH(name, qtype=opts.rtype, use_edns=opts.edns,
request = remoh.RequestDOH(name, qtype=opts.rtype, use_edns=opts.edns,
want_dnssec=opts.dnssec, no_ecs=opts.no_ecs)
request.to_wire()
......@@ -528,7 +528,7 @@ def run_default(name, connection, opts):
else:
try:
connection.do_test(request) # perform the query
except (OpenSSL.SSL.Error, homer.ConnectionDOTException, homer.DOHException) as e:
except (OpenSSL.SSL.Error, remoh.ConnectionDOTException, remoh.DOHException) as e:
ok = False
error(e)
break
......@@ -545,12 +545,12 @@ def run_default(name, connection, opts):
done = 0
try:
current = connection.pipelining_init_pending(opts.max_in_flight)
except homer.ConnectionDOTException as e:
except remoh.ConnectionDOTException as e:
ok = False
error("%s, %i/%i requests never got a reply" % (e, opts.tests - connection.nbr_finished_queries, opts.tests))
else:
while done < opts.tests:
if time.time() > start + homer.MAX_DURATION: # if we send thousands of requests
if time.time() > start + remoh.MAX_DURATION: # if we send thousands of requests
# MAX_DURATION will be reached
# need to increase MAX_DURATION based
# on the number of queries
......@@ -561,7 +561,7 @@ def run_default(name, connection, opts):
break
id = connection.read_result(connection, connection.pending, display_results=opts.display_results)
if id is None: # Probably a timeout
time.sleep(homer.SLEEP_TIMEOUT)
time.sleep(remoh.SLEEP_TIMEOUT)
continue
done += 1
over, rank, request = connection.pending[id]
......@@ -570,7 +570,7 @@ def run_default(name, connection, opts):
if current < len(connection.all_requests):
try:
connection.pipelining_fill_pending(current)
except homer.ConnectionDOTException as e:
except remoh.ConnectionDOTException as e:
ok = False
error("%s, %i/%i requests never got a reply" % (e, opts.tests - connection.nbr_finished_queries, opts.tests))
break
......@@ -607,13 +607,13 @@ if not opts.check or opts.connectTo is not None:
ip_set = {opts.connectTo, }
else:
if opts.dot:
port = homer.PORT_DOT
if not homer.is_valid_hostname(url):
port = remoh.PORT_DOT
if not remoh.is_valid_hostname(url):
error_and_exit("DoT requires a host name or IP address, not \"%s\"" % url)
netloc = url
else:
port = homer.PORT_DOH
if not homer.is_valid_url(url):
port = remoh.PORT_DOH
if not remoh.is_valid_url(url):
error_and_exit("DoH requires a valid HTTPS URL, not \"%s\"" % url)
try:
url_parts = urllib.parse.urlparse(url) # A very poor validation, many
......@@ -647,12 +647,12 @@ for ip in ip_set:
print("(%d/%d) checking IP : %s" % (i, len(ip_set), ip))
try:
if opts.dot:
conn = homer.ConnectionDOT(url, servername=extracheck, connect_to=ip,
conn = remoh.ConnectionDOT(url, servername=extracheck, connect_to=ip,
forceIPv4=opts.forceIPv4, forceIPv6=opts.forceIPv6,
insecure=opts.insecure, verbose=opts.verbose, debug=opts.debug,
sni=opts.sni, key=opts.key, pipelining=opts.pipelining)
else:
conn = homer.ConnectionDOH(url, servername=extracheck, connect_to=ip,
conn = remoh.ConnectionDOH(url, servername=extracheck, connect_to=ip,
forceIPv4=opts.forceIPv4, forceIPv6=opts.forceIPv6,
insecure=opts.insecure, verbose=opts.verbose, debug=opts.debug,
multistreams=opts.multistreams)
......@@ -672,7 +672,7 @@ for ip in ip_set:
error("Could not resolve \"%s\"" % url)
ok = False
continue
except homer.ConnectionDOTException as e:
except remoh.ConnectionDOTException as e:
print(e, file=sys.stderr)
err = "Could not connect to \"%s\"" % url
if opts.connectTo is not None:
......@@ -682,7 +682,7 @@ for ip in ip_set:
error(err)
ok = False
continue
except (homer.ConnectionException, homer.DOHException) as e:
except (remoh.ConnectionException, remoh.DOHException) as e:
error(e)
ok = False
continue
......
......@@ -21,8 +21,8 @@ except ImportError as e:
print(e)
sys.exit(1)
import homer.utils
import homer.exceptions
import remoh.utils
import remoh.exceptions
class Connection:
......@@ -30,14 +30,14 @@ class Connection:
forceIPv4=False, forceIPv6=False, insecure=False,
verbose=False, debug=False, dot=False):
if dot and not homer.is_valid_hostname(server):
raise homer.ConnectionDOTException("DoT requires a host name or IP address, not \"%s\"" % server)
if dot and not remoh.is_valid_hostname(server):
raise remoh.ConnectionDOTException("DoT requires a host name or IP address, not \"%s\"" % server)
if not dot and not homer.is_valid_url(server):
raise homer.ConnectionDOHException("DoH requires a valid HTTPS URL, not \"%s\"" % server)
if not dot and not remoh.is_valid_url(server):
raise remoh.ConnectionDOHException("DoH requires a valid HTTPS URL, not \"%s\"" % server)
if forceIPv4 and forceIPv6:
raise homer.ConnectionException("Force IPv4 *or* IPv6 but not both")
raise remoh.ConnectionException("Force IPv4 *or* IPv6 but not both")
self.dot = dot
self.server = server
......@@ -107,11 +107,11 @@ class ConnectionDOT(Connection):
else:
addr = self.server # otherwise keep the server name
family = homer.get_addrfamily(addr, forceIPv4=self.forceIPv4, forceIPv6=self.forceIPv6)
addrinfo_list = socket.getaddrinfo(addr, homer.PORT_DOT, family)
family = remoh.get_addrfamily(addr, forceIPv4=self.forceIPv4, forceIPv6=self.forceIPv6)
addrinfo_list = socket.getaddrinfo(addr, remoh.PORT_DOT, family)
addrinfo_set = { (addrinfo[4], addrinfo[0]) for addrinfo in addrinfo_list }
signal.signal(signal.SIGALRM, homer.exceptions.timeout_connection)
signal.signal(signal.SIGALRM, remoh.exceptions.timeout_connection)
# contains a set of tuples ('ip address', 'error message')
errors = set()
......@@ -124,7 +124,7 @@ class ConnectionDOT(Connection):
# a string with all the errors
try:
self.establish_session(addrinfo[0], addrinfo[1])
except homer.ConnectionDOTException as e:
except remoh.ConnectionDOTException as e:
errors.add((addrinfo[0][0], str(e)))
if self.verbose and self.connect_to is None:
print(e, file=sys.stderr)
......@@ -134,7 +134,7 @@ class ConnectionDOT(Connection):
print("No other IP address")
# join all the errors into a single string
err = ', '.join( "%s: %s" % (e[0], e[1]) for e in errors)
raise homer.ConnectionDOTException(err)
raise remoh.ConnectionDOTException(err)
if self.verbose and self.connect_to is None:
print("Could not connect to %s" % addrinfo[0][0])
print("Trying another IP address")
......@@ -149,7 +149,7 @@ class ConnectionDOT(Connection):
self.hasher = hashlib.sha256()
# start the timer
signal.alarm(homer.TIMEOUT_CONN)
signal.alarm(remoh.TIMEOUT_CONN)
self.sock = socket.socket(sock_family, socket.SOCK_STREAM)
......@@ -170,27 +170,27 @@ class ConnectionDOT(Connection):
lambda conn, cert, errno, depth, preverify_ok: preverify_ok)
self.session = OpenSSL.SSL.Connection(self.context, self.sock)
if self.sni:
self.session.set_tlsext_host_name(homer.canonicalize(self.check_name_cert).encode())
self.session.set_tlsext_host_name(remoh.canonicalize(self.check_name_cert).encode())
try:
self.session.connect((addr))
self.session.do_handshake()
except homer.exceptions.TimeoutConnectionError:
except remoh.exceptions.TimeoutConnectionError:
self.state = 'CONN_TIMEOUT'
raise homer.ConnectionDOTException("Timeout")
raise remoh.ConnectionDOTException("Timeout")
except OSError:
self.state = 'CONN_FAILED'
raise homer.ConnectionDOTException("Cannot connect")
raise remoh.ConnectionDOTException("Cannot connect")
except OpenSSL.SSL.SysCallError as e:
self.state = e.args[1]
raise homer.ConnectionDOTException("OpenSSL error: %s" % e.args[1])
raise remoh.ConnectionDOTException("OpenSSL error: %s" % e.args[1])
except OpenSSL.SSL.ZeroReturnError:
# see #18
self.state = 'CONN_CLOSED'
raise homer.ConnectionDOTException("Error: The SSL connection has been closed (try with --nosni to avoid sending SNI ?)")
raise remoh.ConnectionDOTException("Error: The SSL connection has been closed (try with --nosni to avoid sending SNI ?)")
except OpenSSL.SSL.Error as e:
self.state = 'CONN_ERROR'
raise homer.ConnectionDOTException("OpenSSL error: %s" % ', '.join(err[0][2] for err in e.args))
raise remoh.ConnectionDOTException("OpenSSL error: %s" % ', '.join(err[0][2] for err in e.args))
# RFC 7858, section 4.2 and appendix A
self.cert = self.session.get_peer_certificate()
......@@ -208,18 +208,18 @@ class ConnectionDOT(Connection):
print("Public key is pin-sha256=\"%s\"" % key_string)
if not self.insecure:
if self.key is None:
valid = homer.validate_hostname(self.check_name_cert, self.cert)
valid = remoh.validate_hostname(self.check_name_cert, self.cert)
if not valid:
raise homer.ConnectionDOTException("Certificate error: \"%s\" is not in the certificate" % (self.check_name_cert))
raise remoh.ConnectionDOTException("Certificate error: \"%s\" is not in the certificate" % (self.check_name_cert))
else:
if key_string != self.key:
raise homer.ConnectionDOTException("Key error: expected \"%s\", got \"%s\"" % (self.key, key_string))
raise remoh.ConnectionDOTException("Key error: expected \"%s\", got \"%s\"" % (self.key, key_string))
# restore the timer
signal.alarm(0)
# and start a new timer when pipelining requests
if self.pipelining:
self.sock.settimeout(homer.TIMEOUT_READ)
self.sock.settimeout(remoh.TIMEOUT_READ)
return True
def end(self):
......@@ -229,16 +229,16 @@ class ConnectionDOT(Connection):
def send_data(self, data, dump=False):
if dump:
homer.dump_data(data, 'data sent')
remoh.dump_data(data, 'data sent')
length = len(data)
try:
self.session.send(length.to_bytes(2, byteorder='big') + data)
except OpenSSL.SSL.SysCallError as e:
self.state = e.args[1]
raise homer.ConnectionDOTException('OpenSSL error : %s' % self.state)
raise remoh.ConnectionDOTException('OpenSSL error : %s' % self.state)
except OpenSSL.SSL.ZeroReturnError:
self.state = 'CONN_CLOSED'
raise homer.ConnectionDOTException('The SSL connection has been closed')
raise remoh.ConnectionDOTException('The SSL connection has been closed')
def receive_data(self, dump=False):
try:
......@@ -248,11 +248,11 @@ class ConnectionDOT(Connection):
return (False, None, None)
except OpenSSL.SSL.ZeroReturnError:
self.state = 'CONN_CLOSED'
raise homer.ConnectionDOTException('The SSL connection has been closed')
raise remoh.ConnectionDOTException('The SSL connection has been closed')
size = int.from_bytes(buf, byteorder='big')
data = self.session.recv(size)
if dump:
homer.dump_data(data, 'data recv')
remoh.dump_data(data, 'data recv')
return (True, data, size)
def send_and_receive(self, request, dump=False):
......@@ -302,7 +302,7 @@ class ConnectionDOT(Connection):
response = dns.message.from_wire(data)
id = response.id
if id not in requests:
raise homer.PipeliningException("Received response for ID %s which is unexpected" % id)
raise remoh.PipeliningException("Received response for ID %s which is unexpected" % id)
over, rank, request = requests[id]
self.all_requests[rank]['response'] = (rcode, response, size)
requests[id] = (True, rank, request)
......@@ -354,7 +354,7 @@ def create_handle(connection):
if connection.forceIPv6:
handle.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V6)
if connection.connect_to is not None:
handle.setopt(pycurl.CONNECT_TO, ["::[%s]:%d" % (connection.connect_to, homer.PORT_DOH),])
handle.setopt(pycurl.CONNECT_TO, ["::[%s]:%d" % (connection.connect_to, remoh.PORT_DOH),])
handle.setopt(pycurl.HTTPHEADER,
["Accept: application/dns-message", "Content-type: application/dns-message"])
handle.reset_opt_default = reset_opt_default
......@@ -379,7 +379,7 @@ class ConnectionDOH(Connection):
# temporary tweak to check that the ip family is coherent with
# user choice on forced IP
if self.connect_to:
homer.check_ip_address(self.connect_to, forceIPv4=self.forceIPv4, forceIPv6=self.forceIPv6)
remoh.check_ip_address(self.connect_to, forceIPv4=self.forceIPv4, forceIPv6=self.forceIPv6)
if self.multistreams:
self.multi = self.create_multi()
......@@ -400,7 +400,7 @@ class ConnectionDOH(Connection):
# query the root NS because this should not impact the resover cache
if self.verbose:
print("Establishing multistreams connection...")
request = homer.RequestDOH('.', qtype='NS')
request = remoh.RequestDOH('.', qtype='NS')
request.to_wire()
self.multistreams_add_request(request)
self.perform_multi(silent=True, display_results=False, show_time=False)
......@@ -449,7 +449,7 @@ class ConnectionDOH(Connection):
handle.perform()
except pycurl.error as e:
self.state = e.args[1]
raise homer.DOHException(e.args[1])
raise remoh.DOHException(e.args[1])
def receive(self, handle):
self.nbr_finished_queries += 1
......
......@@ -8,7 +8,7 @@ except ImportError as e:
print(e)
sys.exit(1)
import homer
import remoh
class Request:
def __init__(self, qname, qtype='AAAA', use_edns=True, want_dnssec=False, no_ecs=True):
......@@ -43,7 +43,7 @@ class RequestDOT(Request):
def check_response(self, debug=False):
if self.response is None:
self.success = False
raise homer.RequestDOTException("No reply received")
raise remoh.RequestDOTException("No reply received")
if not self.rcode:
self.success = False
return False
......
......@@ -13,7 +13,7 @@ except ImportError as e:
print(e)
sys.exit(1)
import homer
import remoh
# Do not change these
re_host = re.compile(r'^([0-9a-z][0-9a-z-\.]*)|([0-9:]+)|([0-9\.])$')
......@@ -123,9 +123,9 @@ def get_addrfamily(addr, forceIPv4=False, forceIPv6=False):
# thoses checks between the IP family and the command line option
# might need to land somewhere else
if forceIPv4 and family == 6:
raise homer.FamilyException("You cannot force IPv4 with a litteral IPv6 address (%s)" % addr)
raise remoh.FamilyException("You cannot force IPv4 with a litteral IPv6 address (%s)" % addr)
elif forceIPv6 and family == 4:
raise homer.FamilyException("You cannot force IPv6 with a litteral IPv4 address (%s)" % addr)
raise remoh.FamilyException("You cannot force IPv6 with a litteral IPv4 address (%s)" % addr)
if forceIPv4 or family == 4:
family = socket.AF_INET
......
......@@ -19,7 +19,7 @@ tests:
###############################################################################
- name: 'Usage'
exe: './homer.py'
exe: './remoh.py'
args:
- '-h'
retcode: 0
......@@ -27,7 +27,7 @@ tests:
stdout: ''
- name: 'Unknown option'
exe: './homer.py'
exe: './remoh.py'
args:
- '--zzz'
retcode: 1
......@@ -37,19 +37,19 @@ tests:
# wrong number of options
- name: 'No arguments'
exe: './homer.py'
exe: './remoh.py'
retcode: 1
partstderr: 'Wrong number of arguments'