ahocorasick: improve matching with subdomains (#2331)
The basic idea is to have the following logic: * pattern "DOMAIN" matches the domain itself (i.e exact match) *and* any subdomains (i.e. "ANYTHING.DOMAIN") * pattern "DOMAIN." matches *also* any strings for which is a prefix [please, note that this kind of match is handy but it is quite dangerous...] * pattern "-DOMAIN" matches *also* any strings for which is a postfix Examples: * pattern "wikipedia.it": * "wikipiedia.it" -> OK * "foo.wikipedia.it -> OK * "foowikipedia.it -> NO MATCH * "wikipedia.it.com -> NO MATCH * pattern "wikipedia.": * "wikipedia.it" -> OK * "foo.wikipedia.it -> OK * "foowikipedia.it -> NO MATCH * "wikipedia.it.com -> OK * pattern "-wikipedia.it": * "wikipedia.it" -> NO MATCH * "foo.wikipedia.it -> NO MATCH * "0001-wikipedia.it -> OK * "foo.0001-wikipedia.it -> OK Bottom line: * exact match * prefix with "." (always, implicit) * prefix with "-" (only if esplicitly set) * postfix with "." (only if esplicitly set) That means that the patterns cannot start with '.' anymore. Close #2330
This commit is contained in:
@@ -8,14 +8,14 @@ Confidence DPI : 32 (flows)
|
||||
Num dissector calls: 1050 (30.88 diss/flow)
|
||||
LRU cache ookla: 0/0/0 (insert/search/found)
|
||||
LRU cache bittorrent: 0/6/0 (insert/search/found)
|
||||
LRU cache zoom: 7/0/0 (insert/search/found)
|
||||
LRU cache zoom: 8/0/0 (insert/search/found)
|
||||
LRU cache stun: 6/0/0 (insert/search/found)
|
||||
LRU cache tls_cert: 0/2/0 (insert/search/found)
|
||||
LRU cache tls_cert: 0/0/0 (insert/search/found)
|
||||
LRU cache mining: 0/2/0 (insert/search/found)
|
||||
LRU cache msteams: 0/0/0 (insert/search/found)
|
||||
LRU cache stun_zoom: 3/0/0 (insert/search/found)
|
||||
Automa host: 25/20 (search/found)
|
||||
Automa domain: 24/0 (search/found)
|
||||
Automa host: 24/20 (search/found)
|
||||
Automa domain: 23/0 (search/found)
|
||||
Automa tls cert: 0/0 (search/found)
|
||||
Automa risk mask: 7/0 (search/found)
|
||||
Automa common alpns: 10/10 (search/found)
|
||||
|
||||
Reference in New Issue
Block a user