Skip to content

Commit cbeabbd

Browse files
author
Seth Hall
authored
Merge pull request #8 from jbaggs/master
Add 6th level TLDs.
2 parents 9a77e99 + 9539cd1 commit cbeabbd

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

scripts/main.zeek

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const tld_extraction_suffixes: table[count] of pattern = {
7676
[5] = /\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+$/,
7777
[6] = /\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+$/,
7878
[7] = /\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+$/,
79+
[8] = /\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+$/,
7980
};
8081

8182
function zone_by_depth(domain: string, depth: count): string
@@ -93,7 +94,9 @@ function zone_by_depth(domain: string, depth: count): string
9394
function effective_tld(domain: string): string
9495
{
9596
local depth=1;
96-
if ( effective_tlds_5th_level in domain )
97+
if ( effective_tlds_6th_level in domain )
98+
depth=6;
99+
else if ( effective_tlds_5th_level in domain )
97100
depth=5;
98101
else if ( effective_tlds_4th_level in domain )
99102
depth=4;
@@ -107,7 +110,9 @@ function effective_tld(domain: string): string
107110
function effective_domain(domain: string): string
108111
{
109112
local depth=2;
110-
if ( effective_tlds_5th_level in domain )
113+
if ( effective_tlds_6th_level in domain )
114+
depth=7;
115+
else if ( effective_tlds_5th_level in domain )
111116
depth=6;
112117
else if ( effective_tlds_4th_level in domain )
113118
depth=5;
@@ -121,7 +126,9 @@ function effective_domain(domain: string): string
121126
function effective_subdomain(domain: string): string
122127
{
123128
local depth=3;
124-
if ( effective_tlds_5th_level in domain )
129+
if ( effective_tlds_6th_level in domain )
130+
depth=8;
131+
else if ( effective_tlds_5th_level in domain )
125132
depth=7;
126133
else if ( effective_tlds_4th_level in domain )
127134
depth=6;

scripts/tld-data.zeek

Lines changed: 11 additions & 6 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)