statzone

DNS zone file analyzer targeted at TLD zones
Log | Files | Refs | README | LICENSE

commit feb60d8c22b09f0215ef98956cc6ebb6a499cfa6
parent 9eac3610cb332e5ff07054b3818ced3836e182f4
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Mon, 10 Aug 2015 22:52:39 +0200

Outputting name servers list + number of zones served for each name server

Diffstat:
MREADME.md | 2++
Mstatzone.go | 23++++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md @@ -32,6 +32,8 @@ Currently implemented features : - Counting IDNs domains - Counting domains +- Outputting name servers list + number of zones served for each name server + ## License StatZone is released under the BSD 3-Clause license. See `LICENSE` file for details. diff --git a/statzone.go b/statzone.go @@ -4,7 +4,7 @@ /* http://www.statdns.com */ /* */ /* Created: 2012/02/13 */ -/* Last Updated: 2015/08/09 */ +/* Last Updated: 2015/08/10 */ /* */ /* StatZone is released under the BSD 3-Clause license. */ /* See LICENSE file for details. */ @@ -18,6 +18,7 @@ import ( "fmt" "github.com/miekg/dns" "os" + "strconv" "strings" ) @@ -126,6 +127,26 @@ func main() { fmt.Println("IDNs : ", domains.idn) fmt.Println("NS : ", len(ns)) + fmt.Println("\n---[ Creating result files ]---------------------------------------------------\n") + + /* Creating name servers list + number of zones served */ + fmt.Println("Creating :", inputFile + ".csv") + outputFile, outputError := os.OpenFile(inputFile + ".csv", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) + if outputError != nil { + fmt.Printf("ERROR : Can't create output file.\n") + return + } + + defer outputFile.Close() + + outputWriter := bufio.NewWriter(outputFile) + + for item := range ns { + outputWriter.WriteString(strings.ToLower(strings.TrimRight(item, ".")) + ";" + strconv.Itoa(ns[item]) + "\n") + } + + outputWriter.Flush() + fmt.Println("\n---[ CSV values ]--------------------------------------------------------------\n") fmt.Println("IPv4 Glue ; IPv6 Glue ; NS ; Unique NS ; DS ; Signed ; IDNs ; Domains")