Skip to content

Instantly share code, notes, and snippets.

@micahvandeusen
Last active July 31, 2020 03:07
Show Gist options
  • Save micahvandeusen/0e1d8cb270e406d603f29f5dc2660d79 to your computer and use it in GitHub Desktop.
Save micahvandeusen/0e1d8cb270e406d603f29f5dc2660d79 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import requests, sys, re, argparse
parser = argparse.ArgumentParser()
parser.add_argument('domain', help='Domain to query.')
parser.add_argument('type', choices=['subdomain', 'ip'], help='Return IPs or subdomains.')
args = parser.parse_args()
data = requests.get('https://dns.bufferover.run/dns?q=.'+args.domain).json()
fdns = data['FDNS_A']
rdns = data['RDNS']
dns = fdns + rdns
subs = set([i.split(',')[1] for i in dns])
ips = set([i.split(',')[0] for i in dns if not re.search('[a-zA-Z]', i.split(',')[0])])
if args.type == 'subdomain':
print(*subs, sep='\n')
if args.type == 'ip':
print(*ips, sep='\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment