+def get_ips_by_dns_lookup(target, port=None):
+ this function takes the passed target and optional port and does a dns
+ lookup. it returns the ips that it finds to the caller.
+ :param target: the URI that you'd like to get the ip address(es) for
+ :param port: which port do you want to do the lookup against?
+ :returns ips: all of the discovered ips for the target
+ :rtype ips: list of strings
+ return list(map(lambda x: x[4][0], socket.getaddrinfo('{}.'.format(target),port,type=socket.SOCK_STREAM)))
+if __name__=="__main__":
+ parser = argparse.ArgumentParser(prog="Find all ips of a given domain")
+ parser.add_argument('-d', '--d', help='Domain', required=True)
+ parser.add_argument('-p', '--p', help='Port', required=False, default=80)
+ args = parser.parse_args()
+ ips = get_ips_by_dns_lookup(target=args.d, port=args.p)