From 5f07a83832517504a8ff1afde5d3097c170920ca Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 24 Dec 2023 09:07:51 +0200 Subject: [PATCH] add IPv6 support for queryAddr pack --- server_entry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server_entry.py b/server_entry.py index 7a31dc0..e79afc8 100644 --- a/server_entry.py +++ b/server_entry.py @@ -1,5 +1,6 @@ from time import time from struct import pack +import ipaddress class ServerEntry: challenge2 = 0 @@ -67,8 +68,7 @@ class ServerEntry: self.addr = addr # Shortcuts for generating query self.queryAddr = b'' - for i in addr[0].split('.'): - self.queryAddr += pack('!B', int(i)) + self.queryAddr += ipaddress.ip_address(addr[0]).packed self.queryAddr += pack('!H', int(addr[1])) # Random number that server must return