summaryrefslogtreecommitdiff
path: root/project2/proj2_s4498062/dns_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'project2/proj2_s4498062/dns_client.py')
-rwxr-xr-xproject2/proj2_s4498062/dns_client.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/project2/proj2_s4498062/dns_client.py b/project2/proj2_s4498062/dns_client.py
deleted file mode 100755
index ecc3f3d..0000000
--- a/project2/proj2_s4498062/dns_client.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python2
-""" Simple DNS client
-
-A simple example of a client using the DNS resolver.
-"""
-
-import dns.resolver
-
-
-def main():
- """Run the client"""
- # Parse arguments
- import argparse
- parser = argparse.ArgumentParser(description="DNS Client")
- parser.add_argument("hostname", help="hostname to resolve")
- parser.add_argument(
- "-c", "--caching", action="store_true",
- help="Enable caching")
- parser.add_argument(
- "-t", "--ttl", metavar="time", type=int, default=0,
- help="TTL value of cached entries")
- args = parser.parse_args()
-
- # Resolve hostname
- resolver = dns.resolver.Resolver(["localhost"], 15, args.caching, args.ttl)
- hostname, aliases, addresses = resolver.gethostbyname(args.hostname)
-
- # Print output
- print hostname
- print list(aliases)
- print list(addresses)
-
-if __name__ == "__main__":
- main()