-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathgen_subdomains
executable file
·34 lines (29 loc) · 1.42 KB
/
gen_subdomains
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import os
import sys
import argparse
if __name__ == '__main__':
desc = 'Generate wordlists for DNS brute forcing.'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('-w', '--wordlist',
nargs='?',
type=argparse.FileType('r'),
action='store',
help='a list of words to use for brute force attack (default: %s/wordlists/dns/hostnames.txt)' % os.path. dirname(os.path.realpath(__file__)),
metavar='FILE',
default="%s/wordlists/dns/hostnames.txt" % os.path.dirname(os.path.realpath(__file__)))
parser.add_argument('file',
nargs='?',
type=argparse.FileType('r'),
action='store',
help='file containing a list of hostnames split by a newline, otherwise read from STDIN',
metavar='FILE',
default=sys.stdin)
args = parser.parse_args()
wordlist = [line.strip().lower() for line in args.wordlist if len(line)>0 and line[0] != '#']
domains = [line.strip().lower() for line in args.file if len(line)>0 and line[0] != '#']
for domain in domains:
for word in wordlist:
if not word.strip():
continue
print('{}.{}'.format(word.strip(), domain.strip()))