Automatic Filter Generation

General TSS software questions and comments.

Moderators: Tyler, Scott, General Moderator

Post Reply
AlanM
Observer
Observer
Posts: 6
Joined: Thu Jul 09, 2015 7:03 am

Automatic Filter Generation

Post by AlanM »

Since it can at times be challenging to add filters that are precise, I've written a vbs script to help automate the process. I've attached a .zip file containing the script, sample input/output files, and some documentation. Use at your own enjoyment/risk.

The reason for the challenge is that a generic filter entry like this...

+example.us

...will [probably incorrectly] match things like:
http://flexample.us
http://google.com?whatever=example.us
http://example.usx

Tightening up the filter to prevent such incorrect matches requires some effort and complicates maintenance and readability of the URL.txt file.

This script takes a fairly simple-looking filter input (in a file called PreURL.txt) and creates an output file (PostURL.txt) with the expanded filters that can be used directly by PWB. For instance:

Suppose you want to allow PWB to accept URLs from any page in the domain 'example.com'
In PreURL.txt, this entry will appear thusly:

*example.com

After PreFilter.vbs runs, this one line will turn into the following in PostURL.txt:

+^(https?://example\.com/)
+^(https?://example\.com/?)$
+^(https?://[A-Za-z0-9\.\-]+\.example\.com/)
+^(https?://[A-Za-z0-9\.\-]+\.example\.com/?)$

If you find problems or have feature requests, I can supply very limited support on this thread.
Attachments
PreFilter-0.2.zip
PreFilter.vbs and documentation
(5.04 KiB) Downloaded 1469 times

Post Reply