From 24ba6f739de8c5ca478bebd039e5e9dca405531e Mon Sep 17 00:00:00 2001 From: EUcancER Date: Wed, 18 Apr 2012 23:15:53 +0200 Subject: Reaktor: add consolidate tool combines the results of gxfr and dnsmap into irc-style output --- Reaktor/repos/consolidate_dns/index | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 Reaktor/repos/consolidate_dns/index (limited to 'Reaktor/repos/consolidate_dns') 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 -- cgit v1.2.3 From 017bf7c08c3dc09993e5727b1dc631912c02c4c5 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 19 Apr 2012 00:18:08 +0200 Subject: add bxfr support --- Reaktor/repos/consolidate_dns/index | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Reaktor/repos/consolidate_dns') diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index index 2908b9e7..6ff51f85 100755 --- a/Reaktor/repos/consolidate_dns/index +++ b/Reaktor/repos/consolidate_dns/index @@ -10,6 +10,8 @@ DNSMAP = "../dnsmap/dnsmap" silent=open("/dev/null","w") gxfr_enabled = False GXFR = "../gxfr/gxfr.py" +bxfr_enabled = False +BXFR = "../gxfr/gxfr.py" domains = {} try: DOMAIN=sys.argv[1] @@ -27,6 +29,11 @@ if os.path.isfile(GXFR): print (" gxfr.py enabled") else: print (" gxfr.py not available or not supported") +if os.path.isfile(BXFR): + bxfr_enabled=True + print (" bxfr.py enabled") +else: + print (" bxfr.py not available or not supported") if dnsmap_enabled: @@ -50,6 +57,16 @@ if gxfr_enabled: domains[row[0]] = row[1:] print ("...finished with [%d] domains" %reader.line_num) os.unlink(gxfr_tmp) +if bxfr_enabled: + bxfr_tmp = tempfile.NamedTemporaryFile(delete=False).name + print ("Starting bxfr, this may take some time") + p = Popen(["/usr/bin/python",BXFR,DOMAIN,"-q","5","--csv",bxfr_tmp],stdout=silent,stderr=silent) + p.wait() + reader = csv.reader(open(bxfr_tmp)) + for row in reader: + domains[row[0]] = row[1:] + print ("...finished with [%d] domains" %reader.line_num) + os.unlink(bxfr_tmp) print "found %d subdomain(s)" % len(domains) num = 1 -- cgit v1.2.3 From 104872004270ec066b64bd2d2b218b6669d55a15 Mon Sep 17 00:00:00 2001 From: EUcancER Date: Mon, 23 Apr 2012 13:37:16 +0200 Subject: remove dnsmap in favor of dnsrecon --- Reaktor/repos/consolidate_dns/index | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'Reaktor/repos/consolidate_dns') diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index index 6ff51f85..7336f211 100755 --- a/Reaktor/repos/consolidate_dns/index +++ b/Reaktor/repos/consolidate_dns/index @@ -5,8 +5,9 @@ import csv import sys import tempfile os.chdir (os.path.dirname (os.path.realpath (sys.argv[0]))) -dnsmap_enabled = False -DNSMAP = "../dnsmap/dnsmap" +dnsrecon_enabled = False +DNSRECON = "../dnsrecon/dnsrecon.py" +dnsrecon_wordlist="../dnsrecon/namelist.txt" silent=open("/dev/null","w") gxfr_enabled = False GXFR = "../gxfr/gxfr.py" @@ -16,14 +17,14 @@ domains = {} try: DOMAIN=sys.argv[1] except: - print "Usage: %s [hostname]" + print ("Usage: %s [hostname]") sys.exit(1) print("checking for back end") -if os.path.isfile(DNSMAP) : - dnsmap_enabled=True - print (" dnsmap enabled") +if os.path.isfile(DNSRECON) : + dnsrecon_enabled=True + print (" dnsrecon enabled") else: - print (" dnsmap not available") + print (" dnsrecon not available or not supported") if os.path.isfile(GXFR): gxfr_enabled=True print (" gxfr.py enabled") @@ -36,16 +37,19 @@ else: print (" bxfr.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) +if dnsrecon_enabled: + dnsrecon_tmp = tempfile.NamedTemporaryFile(delete=False).name + print ("Starting dnsrecon, this may take some time") + p = Popen([DNSRECON,"-d",DOMAIN,"--csv",dnsrecon_tmp,'-D',dnsrecon_wordlist,"-t","brt,srv,axfr"],stdout=silent,stderr=silent) p.wait() - reader = csv.reader(open(dnsmap_tmp)) + reader = csv.reader(open(dnsrecon_tmp)) for row in reader: - domains[row[0]] = row[1:] + if row[1] in domains: + domains[row[1]] += row[2:] + else: + domains[row[1]] = row[2:] print ("...finished with [%d] domains" %reader.line_num) - os.unlink(dnsmap_tmp) + os.unlink(dnsrecon_tmp) if gxfr_enabled: gxfr_tmp = tempfile.NamedTemporaryFile(delete=False).name -- cgit v1.2.3 From 07282f7c4c729323aeb9f3deda1bfbd191dafb8a Mon Sep 17 00:00:00 2001 From: EUcancER Date: Wed, 2 May 2012 13:24:47 +0200 Subject: Reaktor: replace dnsrecon for dnsmap update init script add supervisor config --- Reaktor/repos/consolidate_dns/index | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Reaktor/repos/consolidate_dns') diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index index 7336f211..c66e54bf 100755 --- a/Reaktor/repos/consolidate_dns/index +++ b/Reaktor/repos/consolidate_dns/index @@ -44,10 +44,7 @@ if dnsrecon_enabled: p.wait() reader = csv.reader(open(dnsrecon_tmp)) for row in reader: - if row[1] in domains: - domains[row[1]] += row[2:] - else: - domains[row[1]] = row[2:] + domains[row[1]] += row[2:] print ("...finished with [%d] domains" %reader.line_num) os.unlink(dnsrecon_tmp) @@ -58,7 +55,7 @@ if gxfr_enabled: p.wait() reader = csv.reader(open(gxfr_tmp)) for row in reader: - domains[row[0]] = row[1:] + domains[row[0]] += row[1:] print ("...finished with [%d] domains" %reader.line_num) os.unlink(gxfr_tmp) if bxfr_enabled: @@ -68,7 +65,7 @@ if bxfr_enabled: p.wait() reader = csv.reader(open(bxfr_tmp)) for row in reader: - domains[row[0]] = row[1:] + domains[row[0]] += row[1:] print ("...finished with [%d] domains" %reader.line_num) os.unlink(bxfr_tmp) -- cgit v1.2.3 From 6969db3c771a621c5aabf796a8a057fcebdc59bf Mon Sep 17 00:00:00 2001 From: EUcancER Date: Wed, 2 May 2012 15:10:40 +0200 Subject: fix bug in consolidate_dns --- Reaktor/repos/consolidate_dns/index | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Reaktor/repos/consolidate_dns') diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index index c66e54bf..71a51c6a 100755 --- a/Reaktor/repos/consolidate_dns/index +++ b/Reaktor/repos/consolidate_dns/index @@ -44,6 +44,8 @@ if dnsrecon_enabled: p.wait() reader = csv.reader(open(dnsrecon_tmp)) for row in reader: + if not row[1] in domains: + domains[row[1]] = [] domains[row[1]] += row[2:] print ("...finished with [%d] domains" %reader.line_num) os.unlink(dnsrecon_tmp) @@ -55,7 +57,9 @@ if gxfr_enabled: p.wait() reader = csv.reader(open(gxfr_tmp)) for row in reader: - domains[row[0]] += row[1:] + if not row[0] in domains: + domains[row[0]] = [] + domains[row[0]] += row[1:] print ("...finished with [%d] domains" %reader.line_num) os.unlink(gxfr_tmp) if bxfr_enabled: @@ -65,6 +69,8 @@ if bxfr_enabled: p.wait() reader = csv.reader(open(bxfr_tmp)) for row in reader: + if not row[0] in domains: + domains[row[0]] = [] domains[row[0]] += row[1:] print ("...finished with [%d] domains" %reader.line_num) os.unlink(bxfr_tmp) -- cgit v1.2.3 From f41bc10acdd99e1a2e644db5206419119008b4f2 Mon Sep 17 00:00:00 2001 From: EUcancER Date: Wed, 2 May 2012 16:14:33 +0200 Subject: Reaktor:dns fix bug gxfr -> bxfr add --skip to dnsrecon --- Reaktor/repos/consolidate_dns/index | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Reaktor/repos/consolidate_dns') diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index index 71a51c6a..605e6b2f 100755 --- a/Reaktor/repos/consolidate_dns/index +++ b/Reaktor/repos/consolidate_dns/index @@ -4,15 +4,17 @@ from subprocess import Popen import csv import sys import tempfile + + os.chdir (os.path.dirname (os.path.realpath (sys.argv[0]))) dnsrecon_enabled = False DNSRECON = "../dnsrecon/dnsrecon.py" -dnsrecon_wordlist="../dnsrecon/namelist.txt" +dnsrecon_wordlist="namelist.txt" silent=open("/dev/null","w") gxfr_enabled = False GXFR = "../gxfr/gxfr.py" bxfr_enabled = False -BXFR = "../gxfr/gxfr.py" +BXFR = "../bxfr/bxfr.py" domains = {} try: DOMAIN=sys.argv[1] @@ -40,7 +42,7 @@ else: if dnsrecon_enabled: dnsrecon_tmp = tempfile.NamedTemporaryFile(delete=False).name print ("Starting dnsrecon, this may take some time") - p = Popen([DNSRECON,"-d",DOMAIN,"--csv",dnsrecon_tmp,'-D',dnsrecon_wordlist,"-t","brt,srv,axfr"],stdout=silent,stderr=silent) + p = Popen([DNSRECON,"-d",DOMAIN,"--csv",dnsrecon_tmp,'-D',dnsrecon_wordlist,"-t","brt,srv,axfr","--skip"],stdout=silent,stderr=silent) p.wait() reader = csv.reader(open(dnsrecon_tmp)) for row in reader: @@ -53,7 +55,7 @@ if dnsrecon_enabled: 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 = Popen(["/usr/bin/python",GXFR,DOMAIN,"-q","3","--csv",gxfr_tmp],stdout=silent,stderr=silent) p.wait() reader = csv.reader(open(gxfr_tmp)) for row in reader: @@ -65,7 +67,7 @@ if gxfr_enabled: if bxfr_enabled: bxfr_tmp = tempfile.NamedTemporaryFile(delete=False).name print ("Starting bxfr, this may take some time") - p = Popen(["/usr/bin/python",BXFR,DOMAIN,"-q","5","--csv",bxfr_tmp],stdout=silent,stderr=silent) + p = Popen(["/usr/bin/python",BXFR,DOMAIN,"-q","3","--csv",bxfr_tmp],stdout=silent,stderr=silent) p.wait() reader = csv.reader(open(bxfr_tmp)) for row in reader: -- cgit v1.2.3 From 24aad38c684c0a8bdd166aeb2bb8bbbeac22c61e Mon Sep 17 00:00:00 2001 From: EUcancER Date: Wed, 2 May 2012 16:20:33 +0200 Subject: Reaktor:make ip lists unique --- Reaktor/repos/consolidate_dns/index | 1 + 1 file changed, 1 insertion(+) (limited to 'Reaktor/repos/consolidate_dns') diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index index 605e6b2f..1a0dd81e 100755 --- a/Reaktor/repos/consolidate_dns/index +++ b/Reaktor/repos/consolidate_dns/index @@ -80,5 +80,6 @@ if bxfr_enabled: print "found %d subdomain(s)" % len(domains) num = 1 for dom in domains: + domains[dom] = set(domains[dom]) print "[%d/%d]" % (num,len(domains)),dom,":",", ".join(domains[dom]) num = num + 1 -- cgit v1.2.3