Cybersecurity DNS
Inspect a supplied DNS record without making a network request.
How it works
DNS maps names to records such as addresses and mail destinations. A response is not an authorisation grant, and a familiar name may resolve differently over time. TTL describes caching behaviour, not how long a domain is safe. The offline record below separates the queried name, record type and answer so each can be reviewed independently.
Run the code
Save the complete source as dns.py in a separate learning folder, then run python dns.py. The reviewed runtime is Python 3.12.14 with the standard library; no third-party packages are required. These are local examples, not browser playground programs. Apache, MySQL and PHP are not needed.
Example
record = {"name": "catalog.example.invalid", "type": "A", "answer": "192.0.2.24", "ttl": 120}
assert record["type"] == "A"
assert record["ttl"] > 0
print(record["name"], record["answer"], record["ttl"])
Expected result
catalog.example.invalid 192.0.2.24 120
The example uses a reserved documentation address and an invalid teaching domain. It examines a fixture rather than resolving the name. Real DNS security also involves resolver trust, caching, domain ownership and, where used, validation; a dictionary inspection does not test those mechanisms.
Technical reference: OWASP Cheat Sheet Series. Check the guidance for your actual platform and deployment.