tessl install tessl/pypi-dnslib@0.9.0Simple library to encode/decode DNS wire-format packets
Agent Success
Agent success rate when using this tile
97%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.76x
Baseline
Agent success rate without this tile
55%
Build a DNS record processing utility that creates and manipulates DNS records for various common record types.
Your solution should provide functionality to:
Create DNS resource records for multiple record types including IPv4 addresses, IPv6 addresses, canonical names, pointer records, name servers, text records, mail exchanges, and zone authority information.
Parse DNS records from their textual zone file representation into structured objects.
Generate DNS records in zone file format (textual representation).
Create complete DNS response packets containing multiple resource records in the answer section.
The utility must support creating records for the following types:
Each record should include a domain name, time-to-live value, and the appropriate record-specific data.
The utility must be able to read DNS records written in standard zone file format and convert them into structured record objects that can be manipulated programmatically.
The utility should be able to construct complete DNS response packets that contain multiple resource records. The response should have:
@generates
def create_a_record(domain: str, ip_address: str, ttl: int):
"""Create an A (IPv4 address) record."""
pass
def create_aaaa_record(domain: str, ip_address: str, ttl: int):
"""Create an AAAA (IPv6 address) record."""
pass
def create_cname_record(domain: str, target: str, ttl: int):
"""Create a CNAME (canonical name) record."""
pass
def create_ptr_record(domain: str, target: str, ttl: int):
"""Create a PTR (pointer) record."""
pass
def create_ns_record(domain: str, nameserver: str, ttl: int):
"""Create an NS (name server) record."""
pass
def create_txt_record(domain: str, text: str, ttl: int):
"""Create a TXT (text) record."""
pass
def create_mx_record(domain: str, priority: int, mailserver: str, ttl: int):
"""Create an MX (mail exchange) record."""
pass
def create_soa_record(domain: str, mname: str, rname: str, serial: int,
refresh: int, retry: int, expire: int, minimum: int, ttl: int):
"""Create an SOA (start of authority) record."""
pass
def parse_zone_record(zone_line: str):
"""Parse a DNS record from zone file format."""
pass
def format_zone_record(record):
"""Format a DNS record as zone file text."""
pass
def create_dns_response(query_name: str, query_type: str, records: list):
"""Create a DNS response packet with the given records in the answer section."""
passProvides DNS protocol support for encoding, decoding, and manipulating DNS packets and resource records.