-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDomain2IPs_pDNS.py
executable file
·37 lines (30 loc) · 1022 Bytes
/
Domain2IPs_pDNS.py
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
35
36
37
#!/usr/bin/python
# Domain2IPs_pDNS.py
# Author: Keith Gilbert - www.digital4rensics.com - @digital4rensics
# Version: 1.1
# Date: November, 2012
# This script will retrieve IPs associated with a given domain
# from the ISC pDNS service. IPs will be added as entities to the graph.
# The script requires copying the ISC provided script from https://www.farsightsecurity.com/Services/DNSDB/
# and specifying your api key in the isc-dnsdb-query.conf file.
from MaltegoTransform import *
import sys
import subprocess
badDomain = sys.argv[1] + "/A"
xform = MaltegoTransform()
out = subprocess.Popen(["/bin/bash", "isc-dnsdb-query.sh", "rrset", badDomain], shell=False, stdout=subprocess.PIPE)
results, err = out.communicate()
entries = results.splitlines()
for line in entries:
if line.startswith(';'):
pass
else:
if len(line) == 0:
pass
else:
IP = line.split()[3]
if IP == "127.0.0.1" or IP == "0.0.0.0":
pass
else:
entity = xform.addEntity("maltego.IPv4Address", IP)
xform.returnOutput()