DNS Redirector
 Return to FAQ List


FAQ 106: Use regular expressions in BlockedKeywordsFile

Category: BlockedIP function


DNS Redirector v7 allows for regular expressions (also referred to as regex or regexp) in any keyword list.

All keyword lists need to have at least one non-regex keyword present; that's at least 1 line not starting with ^

A helpful site for understanding regex is: www.regular-expressions.info

Examples

   Using the regex...
^adimg\d
   would block domains like...
adimg1.example.com
adimg2.example.com
adimg3.example.com
   which is more efficient than using plain keywords for each ad server you wish to block.

   Using the regex...
^.*\.cn$
   would block any domains ending in China's county code: .cn
   which is more efficient then using plain keywords for each .cn site you wish to block.

Recommendation

You can greatly improve network security by using regex statements in DNS Redirector to block the following...

- Vanity TLD's since there's lots of fraud in this namespace
Note: IANA maintains a list of all TLDs, additional explanation found here, this includes vanity TLDs (like .work or .youtube)
Or see the new TLDs.
Also statistics on fraud here and here.

- IDN's that are not relevant to your business
For example:  ^(.*\.)?xn--.*  (to block all)
Also note:  ^.*\.bycc2ii\.net$  (for Thailand, but this is not an ICANN-sanctioned IDN encoding method)

- IDN ccTLD or ccIDN's that are not relevant to your business
For example:  ^.*\.xn--fiqs8s$  and:  ^.*\.xn--fiqz9s$  (for China)
Or use:  ^.*\.xn--.*$  (to block all)

- GeoTLD's that are not relevant to your business

- ccTLD's that are not relevant to your business
Note: Remove or comment out (by placing ; at the start of a line) your own country code and any others you want accessible.

- There are no English words with triple letters and domains aiding or embedding badware sometimes contain 3 concurrent letters
Note: 3 letters may adversely block some acronyms, but you can always whitelist any domains you do want to visit, or consider 4 letters
Note: Exclude "www" because many websites still start with www. or "xxx" because this is already in the porn keywords list.

 [ See a sample blocked file here: example-blocked-custom.txt ]
...the contents can be pasted into your blocked.txt file, or if using updater.exe to your blocked-custom.txt file.



Related articles
FAQ 112  Use regular expressions in AllowedKeywordsFile
FAQ 114  Advert block list does not include some ccTLD's

 
DNS Redirector | Legal Information | 2003-2017