Files
whois/mwhoisd.patch
Olaf Baumert 34c631a06d Initial commit: mwhois with SCION AS support and decimal AS conversion
Based on mwhois by Antonios A. Chariton
Modifications for SCION AS support by Olaf Baumert, Axpo Systems AG
2025-06-03 11:01:02 +00:00

33 lines
956 B
Diff

--- mwhoisd.original
+++ mwhoisd
@@ -54,7 +54,7 @@
if(len(qr.split(".")) == 1):
return False
zones = qr.split(".")
- ac = re.compile("^[a-z0-9\.-]+\n")
+ ac = re.compile(r"^[a-z0-9\.-]+\n")
for zone in zones:
if(zone == ""):
return False
@@ -83,7 +83,9 @@
query = con.recv(MAX_QUERY_SIZE)
if not query:
break
- log = log + query.replace("\r\n", "").replace("\n", "") + " - "
+ # Decode bytes to string
+ query_str = query.decode('utf-8', errors='ignore')
+ log = log + query_str.replace("\r\n", "").replace("\n", "") + " - "
query = sanitizeQuery(query)
rsp = "# +-----------------------------------+" + n
@@ -130,7 +132,8 @@
log = log + "Unrecognized" + n
rsp = rsp + n
rsp = rsp + "# Error. Unknown query type. Query is not IPv4, Domain or SCION AS" + n
- con.send(rsp)
+ # Encode string to bytes before sending
+ con.send(rsp.encode('utf-8'))
con.close()
if(LOGFILE!=""):
# Save to logs