Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fakedns.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def __init__(self, query, txt_record):
self.length = chr(len(txt_record) + 1).encode()
# Must be two bytes. This is the better, more python-3 way to calculate length. Swap to this later.
if len(self.length) < 2:
self.length = b"\x00" + self.length
self.length = b"\x00" + self.length
# Then, we have to add the TXT record length field! We utilize the
# length field for this since it is already in the right spot
self.length += chr(len(txt_record)).encode()
Expand Down Expand Up @@ -599,7 +599,7 @@ def match(self, query, addr):

response = CASE[query.type](query, response_data)

print(">> Matched Request - " + query.domain.decode())
print(f'>> Matched Request - {query.domain.decode()} ({TYPE[query.type]})')
return response.make_packet()

# if we got here, we didn't match.
Expand All @@ -616,7 +616,7 @@ def match(self, query, addr):
s.sendto(query.data, addr)
data = s.recv(1024)
s.close()
print("Unmatched Request " + query.domain.decode())
print(f'Unmatched Request {query.domain.decode()} ({TYPE[query.type]})')
return data
except socket.error as e:
# We shouldn't wind up here but if we do, don't drop the request
Expand Down