summaryrefslogtreecommitdiffstats
path: root/Reaktor
diff options
context:
space:
mode:
authorEUcancER <root@euer.krebsco.de>2012-04-18 23:15:53 +0200
committerEUcancER <root@euer.krebsco.de>2012-04-18 23:15:53 +0200
commit24ba6f739de8c5ca478bebd039e5e9dca405531e (patch)
tree1e24616007ee2b1f28742fe364b07c55c7ff5931 /Reaktor
parent3c52c7895c28e7f63e27680bd7ef533b93ec37ba (diff)
Reaktor: add consolidate
tool combines the results of gxfr and dnsmap into irc-style output
Diffstat (limited to 'Reaktor')
-rwxr-xr-xReaktor/repos/consolidate_dns/index58
1 files changed, 58 insertions, 0 deletions
diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index
new file mode 100755
index 00000000..2908b9e7
--- /dev/null
+++ b/Reaktor/repos/consolidate_dns/index
@@ -0,0 +1,58 @@
+#!/usr/bin/python -u
+import os
+from subprocess import Popen
+import csv
+import sys
+import tempfile
+os.chdir (os.path.dirname (os.path.realpath (sys.argv[0])))
+dnsmap_enabled = False
+DNSMAP = "../dnsmap/dnsmap"
+silent=open("/dev/null","w")
+gxfr_enabled = False
+GXFR = "../gxfr/gxfr.py"
+domains = {}
+try:
+ DOMAIN=sys.argv[1]
+except:
+ print "Usage: %s [hostname]"
+ sys.exit(1)
+print("checking for back end")
+if os.path.isfile(DNSMAP) :
+ dnsmap_enabled=True
+ print (" dnsmap enabled")
+else:
+ print (" dnsmap not available")
+if os.path.isfile(GXFR):
+ gxfr_enabled=True
+ print (" gxfr.py enabled")
+else:
+ print (" gxfr.py not available or not supported")
+
+
+if dnsmap_enabled:
+ dnsmap_tmp = tempfile.NamedTemporaryFile(delete=False).name
+ print ("Starting DNSMAP, this may take some time")
+ p = Popen([DNSMAP,DOMAIN,"-c",dnsmap_tmp],stdout=silent,stderr=silent)
+ p.wait()
+ reader = csv.reader(open(dnsmap_tmp))
+ for row in reader:
+ domains[row[0]] = row[1:]
+ print ("...finished with [%d] domains" %reader.line_num)
+ os.unlink(dnsmap_tmp)
+
+if gxfr_enabled:
+ gxfr_tmp = tempfile.NamedTemporaryFile(delete=False).name
+ print ("Starting gxfr, this may take some time")
+ p = Popen(["/usr/bin/python",GXFR,DOMAIN,"-q","5","--csv",gxfr_tmp],stdout=silent,stderr=silent)
+ p.wait()
+ reader = csv.reader(open(gxfr_tmp))
+ for row in reader:
+ domains[row[0]] = row[1:]
+ print ("...finished with [%d] domains" %reader.line_num)
+ os.unlink(gxfr_tmp)
+
+print "found %d subdomain(s)" % len(domains)
+num = 1
+for dom in domains:
+ print "[%d/%d]" % (num,len(domains)),dom,":",", ".join(domains[dom])
+ num = num + 1