statzone

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

commit c932bcc3d13fcc24aaf94d1911b12b7e44f9ad2b
parent d620ec06e549a466fe4ef46bf53dfa38d9442e7c
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed,  9 Jan 2019 21:54:21 +0100

Count unique name servers.

Diffstat:
Msrc/statzone.c | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/statzone.c b/src/statzone.c @@ -4,7 +4,7 @@ * https://www.statdns.com * * Created: 2012-02-13 - * Last Updated: 2019-01-06 + * Last Updated: 2019-01-09 * * StatZone is released under the BSD 2-Clause license * See LICENSE file for details. @@ -45,6 +45,7 @@ char *intputFile; char *domain; char *previousDomain = ""; +char *rdata; struct my_struct { char *domain; @@ -53,6 +54,8 @@ struct my_struct { struct my_struct *signedDomains = NULL; struct my_struct *ds; +struct my_struct *uniqueNS = NULL; +struct my_struct *ns; void displayUsage() { @@ -164,6 +167,16 @@ main(int argc, char *argv[]) { if (!strncmp(domain, "xn--", 4)) results.idn++; } + + rdata = strtok(NULL, "\n"); + + HASH_FIND_STR(uniqueNS, rdata, ns); + + if (!ns) { + ns = malloc(sizeof(struct my_struct)); + ns->domain = strdup(rdata); + HASH_ADD_STR(uniqueNS, domain, ns); + } } token = strtok(NULL, " \t"); @@ -191,6 +204,7 @@ main(int argc, char *argv[]) { fprintf(stderr, "%" PRIu64 " ; ", results.a); fprintf(stderr, "%" PRIu64 " ; ", results.aaaa); fprintf(stderr, "%" PRIu64 " ; ", results.ns); + fprintf(stderr, "%u ; ", HASH_COUNT(uniqueNS)); fprintf(stderr, "%" PRIu64 " ; ", results.ds); fprintf(stderr, "%u ; ", HASH_COUNT(signedDomains)); fprintf(stderr, "%" PRIu64 " ; ", results.idn);