#1752 - Added comments to ticket

This commit is contained in:
SunilSamra
2023-08-22 21:43:57 +01:00
parent 550b62f75d
commit c1ba3b0850
2 changed files with 4 additions and 7 deletions

View File

@@ -78,6 +78,5 @@ class DNSClient(BaseModel):
browser) browser)
:return: True if successful, False otherwise. :return: True if successful, False otherwise.
""" """
# check DNS packet (dns request, dns reply) here and see if it actually worked # check the DNS packet (dns request, dns reply) here and see if it actually worked
pass pass

View File

@@ -42,7 +42,7 @@ class DNSServer(BaseModel):
:return ip_address: The IP address of that domain name or None. :return ip_address: The IP address of that domain name or None.
""" """
if target_domain in self.dns_table: if target_domain in self.dns_table:
return self.dns_table[target_domain] self.dns_table[target_domain]
else: else:
return None return None
@@ -65,11 +65,9 @@ class DNSServer(BaseModel):
:param payload: The payload to send. :param payload: The payload to send.
:return: True if successful, False otherwise. :return: True if successful, False otherwise.
""" """
ip_addresses = list(self.dns_table.values()) # DNS packet will be sent from DNS Server to the DNS client
domain_names = list(self.dns_table.keys())
index_of_domain = ip_addresses.index(payload)
DNSPacket( DNSPacket(
dns_request=DNSRequest(domain_name_request=domain_names[index_of_domain]), dns_request=DNSRequest(domain_name_request=self.dns_table),
dns_reply=DNSReply(domain_name_ip_address=payload), dns_reply=DNSReply(domain_name_ip_address=payload),
) )