Last active
July 31, 2020 03:07
-
-
Save micahvandeusen/0e1d8cb270e406d603f29f5dc2660d79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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