statzone

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

commit 0983d96324ecdf918a72efa63341c74f7b16c738
parent 090640970d6085c7931594da49c9f6ba239dfbac
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat,  5 Jan 2019 23:01:22 +0100

Count unique domain names and unique IDN occurences.

Diffstat:
Msrc/statzone.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/statzone.c b/src/statzone.c @@ -41,6 +41,7 @@ int8_t getoptFlag; char *intputFile; char *domain; +char *previousDomain = ""; struct my_struct { char *domain; @@ -153,6 +154,13 @@ main(int argc, char *argv[]) { if (!strcmp(token_lc, "ns")) { results.ns++; + + if (strncmp(domain, previousDomain, strlen(domain))) { + results.domains++; + previousDomain = strdup(domain); + if (!strncmp(domain, "xn--", 4)) + results.idn++; + } } token = strtok(NULL, " \t"); @@ -162,6 +170,9 @@ main(int argc, char *argv[]) { results.processedLines++; } + /* Don't count origin */ + results.domains--; + /* Stopping timer */ clock_gettime(CLOCK_MONOTONIC, &end);