old_contents: #!/usr/bin/python3
  # Created by Jay Townsend
  
  import dns.name
  import dns.message
  import dns.query
  import dns.flags
  import dns.rdatatype
  import dns.exception
  import argparse
  
  
  parser = argparse.ArgumentParser(description='A script to get DNS information for a domain')
  parser.add_argument('-d', '--domain', help='Domain to lookup', required=True)
  parser.add_argument('-t', '--type', help='Record type to lookup', default='a')
  parser.add_argument('-n', '--name-server',
                      help='Name server to use for the lookup, default is Googles', default='8.8.8.8')
  
  args = parser.parse_args()
  ADDITIONAL_RDCLASS = 65535
  
  domain = dns.name.from_text(args.domain)
  if not domain.is_absolute():
      domain = domain.concatenate(dns.name.root)
  try:
      request = dns.message.make_query(domain, dns.rdatatype.ANY)
      request.flags |= dns.flags.AD
      request.find_rrset(request.additional, dns.name.root, ADDITIONAL_RDCLASS,
                         dns.rdatatype.OPT, create=True, force_unique=True)
      response = dns.query.tcp(request, args.name_server)
  
      if 'see draft-jabley-dnsop-refuse-any' in response.answer[0].to_text().lower():
          request = dns.message.make_query(domain, args.type)
          request.flags |= dns.flags.AD
          request.find_rrset(request.additional, dns.name.root, ADDITIONAL_RDCLASS,
                             dns.rdatatype.OPT, create=True, force_unique=True)
          response = dns.query.tcp(request, args.name_server)
          for answer in response.answer:
              print(answer)
              print('\nThis DNS server does not support the ANY request, defaulting to an A record')
              print('This can be changed with the -t or --type argument\n')
      else:
          for answer in response.answer:
              print(answer)
  
          for additional in response.additional:
              print(additional)
  
          for authority in response.authority:
              print(authority)
  except dns.exception.Timeout:
      print('A timeout has occurred, make sure you can reach the target DNS Server(s)')
  
  
new_contents: #!/usr/bin/python3
  # Created by Jay Townsend
  # TODO add zone transfer feature
  
  import dns.name
  import dns.message
  import dns.query
  import dns.flags
  import dns.rdatatype
  import dns.exception
  import argparse
  
  
  parser = argparse.ArgumentParser(description='A script to get DNS information for a domain')
  parser.add_argument('-d', '--domain', help='Domain to lookup', required=True)
  parser.add_argument('-t', '--type', help='Record type to lookup', default='a')
  parser.add_argument('-n', '--name-server',
                      help='Name server to use for the lookup, default is Googles', default='8.8.8.8')
  
  args = parser.parse_args()
  ADDITIONAL_RDCLASS = 65535
  
  domain = dns.name.from_text(args.domain)
  if not domain.is_absolute():
      domain = domain.concatenate(dns.name.root)
  try:
      request = dns.message.make_query(domain, dns.rdatatype.ANY)
      request.flags |= dns.flags.AD
      request.find_rrset(request.additional, dns.name.root, ADDITIONAL_RDCLASS,
                         dns.rdatatype.OPT, create=True, force_unique=True)
      response = dns.query.tcp(request, args.name_server)
  
      if 'see draft-jabley-dnsop-refuse-any' in response.answer[0].to_text().lower():
          request = dns.message.make_query(domain, args.type)
          request.flags |= dns.flags.AD
          request.find_rrset(request.additional, dns.name.root, ADDITIONAL_RDCLASS,
                             dns.rdatatype.OPT, create=True, force_unique=True)
          response = dns.query.tcp(request, args.name_server)
          for answer in response.answer:
              print(answer)
              print('\nThis DNS server does not support the ANY request, defaulting to an A record')
              print('This can be changed with the -t or --type argument\n')
      else:
          for answer in response.answer:
              print(answer)
  
          for additional in response.additional:
              print(additional)
  
          for authority in response.authority:
              print(authority)
  except dns.exception.Timeout:
      print('A timeout has occurred, make sure you can reach the target DNS Server(s)')
  
  
subject: Add todo