Skip to content
Snippets Groups Projects
Commit 3f9f218e authored by Maximilian Wilhelm's avatar Maximilian Wilhelm
Browse files

Strip away an infra.ffpb or srv.infra.ffpb suffix when resolving IP.

parent bd021174
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,7 @@ class MsgHandler(SocketServer.BaseRequestHandler):
def resolve_name(self, ipaddr):
"""
Resolves the host name of the given IP address
and strips away the suffix (.infra)?.ffpb
and strips away the suffix ((.srv)?.infra)?.ffpb
"""
if ipaddr.startswith("127."):
......@@ -76,7 +76,7 @@ class MsgHandler(SocketServer.BaseRequestHandler):
try:
addr = dns.reversename.from_address(ipaddr)
return re.sub("(.infra)?.ffpb.", "", str(ffpb_resolver.query(addr, "PTR")[0]))
return re.sub("((.srv)?.infra)?.ffpb.", "", str(ffpb_resolver.query(addr, "PTR")[0]))
except dns.resolver.NXDOMAIN:
return ipaddr
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment