forked from bigsnarfdude/pythonNetworkProgrammingN00B
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdnsGrinder.py
More file actions
24 lines (18 loc) · 692 Bytes
/
dnsGrinder.py
File metadata and controls
24 lines (18 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
'''
Program takes a file of dns names and grinds out the values
'''
import socket
import string
import random
digits = string.lowercase + string.uppercase + string.digits
gen_random_hosts_8_char_long = (''.join(random.sample(digits, 8)) for _ in range(1000000))
host_dns_list = ['homer','www','www1','test','www2']
domain = 'example.com'
targets = [ host + '.' + domain for host in host_dns_list ]
grinder_targets = [ host + '.' + domain for host in gen_random_hosts_8_char_long ]
for host in targets:
try:
print host, socket.gethostbyname(host)
except socket.error, msg:
print '%s : %s' % (host, msg)