From 52bd067225c1e12ecf7156e5707161ed7df8e8c4 Mon Sep 17 00:00:00 2001 From: oes Date: Tue, 12 Mar 2002 01:42:50 +0000 Subject: [PATCH] Introduced modular filters --- actionlist.h | 5 +- filters.c | 74 +++++++----- ijb.action | 30 ++++- jcc.c | 10 +- loaders.c | 93 +++++++++++---- project.h | 71 ++++++++---- re_filterfile | 205 +++++++++++++++++++++------------ templates/edit-actions-for-url | 35 ++++-- 8 files changed, 364 insertions(+), 159 deletions(-) diff --git a/actionlist.h b/actionlist.h index 056ccf98..577c9825 100644 --- a/actionlist.h +++ b/actionlist.h @@ -39,6 +39,9 @@ * * Revisions : * $Log: actionlist.h,v $ + * Revision 1.10 2002/03/08 18:19:14 jongfoster + * Adding +image-blocker{pattern} option to edit interface + * * Revision 1.9 2001/11/22 21:58:41 jongfoster * Adding action +no-cookies-keep * @@ -86,7 +89,7 @@ DEFINE_CGI_PARAM_RADIO ("deanimate-gifs", ACTION_DEANIMATE, ACTION_STRI DEFINE_CGI_PARAM_RADIO ("deanimate-gifs", ACTION_DEANIMATE, ACTION_STRING_DEANIMATE, "last", 1) DEFINE_ACTION_BOOL ("downgrade", ACTION_DOWNGRADE) DEFINE_ACTION_BOOL ("fast-redirects", ACTION_FAST_REDIRECTS) -DEFINE_ACTION_BOOL ("filter", ACTION_FILTER) +DEFINE_ACTION_MULTI ("filter", ACTION_MULTI_FILTER) DEFINE_ACTION_BOOL ("hide-forwarded", ACTION_HIDE_FORWARDED) DEFINE_ACTION_STRING ("hide-from", ACTION_HIDE_FROM, ACTION_STRING_FROM) DEFINE_CGI_PARAM_RADIO ("hide-from", ACTION_HIDE_FROM, ACTION_STRING_FROM, "block", 1) diff --git a/filters.c b/filters.c index b703e1de..256b0c9d 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.44 2002/03/07 03:49:31 oes Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.45 2002/03/08 16:47:50 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -38,6 +38,9 @@ const char filters_rcs[] = "$Id: filters.c,v 1.44 2002/03/07 03:49:31 oes Exp $" * * Revisions : * $Log: filters.c,v $ + * Revision 1.45 2002/03/08 16:47:50 oes + * Added choice beween GIF and PNG built-in images + * * Revision 1.44 2002/03/07 03:49:31 oes * - Fixed compiler warnings etc * - Changed built-in images from GIF to PNG @@ -1188,16 +1191,17 @@ int is_untrusted_url(struct client_state *csp) * * Function : pcrs_filter_response * - * Description : Apply all the pcrs jobs from the joblist (re_filterfile) - * to the text buffer that's been accumulated in - * csp->iob->buf and set csp->content_length to the modified - * size and raise the CSP_FLAG_MODIFIED flag if appropriate. + * Description : Ecexute all text substitutions from all applying + * +filter actions on the text buffer that's been accumulated + * in csp->iob->buf. If this changes the contents, set + * csp->content_length to the modified size and raise the + * CSP_FLAG_MODIFIED flag. * * Parameters : * 1 : csp = Current client state (buffers, headers, etc...) * * Returns : a pointer to the (newly allocated) modified buffer. - * or NULL in case something went wrong + * or NULL if there were no hits or something went wrong * *********************************************************************/ char *pcrs_filter_response(struct client_state *csp) @@ -1210,14 +1214,23 @@ char *pcrs_filter_response(struct client_state *csp) struct file_list *fl; struct re_filterfile_spec *b; + struct list_entry *filtername; - /* Sanity first */ + /* + * Sanity first + */ if (csp->iob->cur >= csp->iob->eod) { return(NULL); } size = csp->iob->eod - csp->iob->cur; + if ( ( NULL == (fl = csp->rlist) ) || ( NULL == fl->f) ) + { + log_error(LOG_LEVEL_ERROR, "Unable to get current state of regexp filtering."); + return(NULL); + } + /* * If the body has a "chunked" transfer-encoding, * get rid of it first, adjusting size and iob->eod @@ -1233,31 +1246,40 @@ char *pcrs_filter_response(struct client_state *csp) csp->flags |= CSP_FLAG_MODIFIED; } - if ( ( NULL == (fl = csp->rlist) ) || ( NULL == (b = fl->f) ) ) + /* + * For all applying +filter actions, look if a filter by that + * name exists and if yes, execute it's pcrs_joblist on the + * buffer. + */ + for (b = fl->f; b; b = b->next) { - log_error(LOG_LEVEL_ERROR, "Unable to get current state of regexp filtering."); - return(NULL); - } + for (filtername = csp->action->multi[ACTION_MULTI_FILTER]->first; + filtername ; filtername = filtername->next) + { + if (strcmp(b->filtername, filtername->str) == 0) + { + if ( NULL == b->joblist ) + { + log_error(LOG_LEVEL_RE_FILTER, "Filter %s has empty joblist. Nothing to do.", b->filtername); + return(NULL); + } - if ( NULL == b->joblist ) - { - log_error(LOG_LEVEL_RE_FILTER, "Empty joblist. Nothing to do."); - return(NULL); - } + log_error(LOG_LEVEL_RE_FILTER, "re_filtering %s%s (size %d) with filter %s...", + csp->http->hostport, csp->http->path, size, b->filtername); - log_error(LOG_LEVEL_RE_FILTER, "re_filtering %s%s (size %d) ...", - csp->http->hostport, csp->http->path, size); + /* Apply all jobs from the joblist */ + for (job = b->joblist; NULL != job; job = job->next) + { + hits += pcrs_execute(job, old, size, &new, &size); + if (old != csp->iob->cur) free(old); + old=new; + } - /* Apply all jobs from the joblist */ - for (job = b->joblist; NULL != job; job = job->next) - { - hits += pcrs_execute(job, old, size, &new, &size); - if (old != csp->iob->cur) free(old); - old=new; + log_error(LOG_LEVEL_RE_FILTER, " ...produced %d hits (new size %d).", hits, size); + } + } } - log_error(LOG_LEVEL_RE_FILTER, " produced %d hits (new size %d).", hits, size); - /* * If there were no hits, destroy our copy and let * chat() use the original in csp->iob diff --git a/ijb.action b/ijb.action index 3adb6599..77d2740b 100644 --- a/ijb.action +++ b/ijb.action @@ -3,7 +3,7 @@ # # For information, see http://ijbswa.sourceforge.net/ # -# $Id: ijb.action,v 1.6 2002/03/08 17:25:52 oes Exp $ +# $Id: ijb.action,v 1.7 2002/03/08 18:01:48 morcego Exp $ # ############################################################################# # Syntax @@ -179,9 +179,23 @@ # request and send a local redirect back to your browser without # contacting the remote site. # -# +filter -# Filter the website through the re_filterfile -# FIXME: The syntax should be +filter{filename} +# +filter{name} +# Filter the website through one or more regular expression filters. +# Repeat for multiple filters. +# +# Filters predefined in the supplied re_filterfile include: +# +# html-annoyances: Get rid of particularly annoying HTML abuse +# js-annoyances: Get rid of particularly annoying JavaScript abuse +# no-poups: Kill all popups in JS and HTML +# frameset-borders: Give frames a border +# webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking) +# no-refresh: Automatic refresh sucks on auto-dialup lines +# fun: Text replacements for subversive browsing fun! +# nimda: Remove (virus) Nimda code. +# banners-by-size: Kill banners by size +# crude-parental: Kill all web pages that contain the words "sex" or "warez" +# # # +hide-forwarded # Block any existing X-Forwarded-for header, and do not add a new one. @@ -317,7 +331,6 @@ +no-cookies = +no-cookies-set +no-cookies-read -no-cookies = -no-cookies-set -no-cookies-read +imageblock = +block +image -+filter-all = +filter +no-compression # Fragile sites should have the minimum changes fragile = -block -deanimate-gifs -fast-redirects -filter -hide-referer -no-cookies -no-popups @@ -325,6 +338,11 @@ fragile = -block -deanimate-gifs -fast-redirects -filter -hide-referer -no-c # Shops should be allowed to set persistent cookies shop = -filter -no-cookies -no-cookies-keep +# Your favourite blend of filters: +# +myfilters = +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}\ + +filter{webbugs} +filter{nimda} +filter{banners-by-size} + #... etc. Customize to your heart's content. ############################################################################# @@ -336,7 +354,7 @@ shop = -filter -no-cookies -no-cookies-keep -deanimate-gifs \ -downgrade \ +fast-redirects \ -+filter \ +myfilters \ +no-compression \ +no-cookies-keep \ +hide-forwarded \ diff --git a/jcc.c b/jcc.c index 88db8b7f..0997ef86 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.79 2002/03/09 20:03:52 jongfoster Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.80 2002/03/11 22:07:05 david__schmidt Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,12 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.79 2002/03/09 20:03:52 jongfoster Exp $"; * * Revisions : * $Log: jcc.c,v $ + * Revision 1.80 2002/03/11 22:07:05 david__schmidt + * OS/2 port maintenance: + * - Fixed EMX build - it had decayed a little + * - Fixed inexplicable crash during FD_ZERO - must be due to a bad macro. + * substituted a memset for now. + * * Revision 1.79 2002/03/09 20:03:52 jongfoster * - Making various functions return int rather than size_t. * (Undoing a recent change). Since size_t is unsigned on @@ -944,7 +950,7 @@ static void chat(struct client_state *csp) #endif /* def FEATURE_KILL_POPUPS */ pcrs_filter = (csp->rlist != NULL) && /* There are expressions to be used */ - ((csp->action->flags & ACTION_FILTER) != 0); + (!list_is_empty(csp->action->multi[ACTION_MULTI_FILTER])); gif_deanimate = ((csp->action->flags & ACTION_DEANIMATE) != 0); diff --git a/loaders.c b/loaders.c index 585ab75c..70361585 100644 --- a/loaders.c +++ b/loaders.c @@ -1,4 +1,4 @@ -const char loaders_rcs[] = "$Id: loaders.c,v 1.39 2002/03/07 03:46:17 oes Exp $"; +const char loaders_rcs[] = "$Id: loaders.c,v 1.40 2002/03/08 17:46:04 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loaders.c,v $ @@ -35,6 +35,9 @@ const char loaders_rcs[] = "$Id: loaders.c,v 1.39 2002/03/07 03:46:17 oes Exp $" * * Revisions : * $Log: loaders.c,v $ + * Revision 1.40 2002/03/08 17:46:04 jongfoster + * Fixing int/size_t warnings + * * Revision 1.39 2002/03/07 03:46:17 oes * Fixed compiler warnings * @@ -1091,7 +1094,8 @@ load_trustfile_error: * * Function : unload_re_filterfile * - * Description : Unload the re_filter list. + * Description : Unload the re_filter list by freeing all chained + * re_filterfile specs and their data. * * Parameters : * 1 : f = the data structure associated with the filterfile. @@ -1101,27 +1105,31 @@ load_trustfile_error: *********************************************************************/ static void unload_re_filterfile(void *f) { - struct re_filterfile_spec *b = (struct re_filterfile_spec *)f; + struct re_filterfile_spec *a, *b = (struct re_filterfile_spec *)f; - if (b == NULL) + while (b != NULL) { - return; - } + a = b->next; - destroy_list(b->patterns); - pcrs_free_joblist(b->joblist); - freez(b); + destroy_list(b->patterns); + pcrs_free_joblist(b->joblist); + freez(b); + + b = a; + } return; } + /********************************************************************* * * Function : load_re_filterfile * - * Description : Load the re_filterfile. Each non-comment, non-empty - * line is instantly added to the joblist, which is - * a chained list of pcrs_job structs. + * Description : Load the re_filterfile. + * Generate a chained list of re_filterfile_spec's from + * the "FILTER: " blocks, compiling all their substitutions + * into chained lists of pcrs_job structs. * * Parameters : * 1 : csp = Current client state (buffers, headers, etc...) @@ -1133,7 +1141,7 @@ int load_re_filterfile(struct client_state *csp) { FILE *fp; - struct re_filterfile_spec *bl; + struct re_filterfile_spec *bl, *new_bl; struct file_list *fs; char buf[BUFFER_SIZE]; @@ -1141,9 +1149,11 @@ int load_re_filterfile(struct client_state *csp) unsigned long linenum = 0; pcrs_job *dummy; + /* + * No need to reload if unchanged + */ if (!check_file_changed(current_re_filterfile, csp->config->re_filterfile, &fs)) { - /* No need to load */ if (csp) { csp->rlist = current_re_filterfile; @@ -1155,46 +1165,87 @@ int load_re_filterfile(struct client_state *csp) goto load_re_filterfile_error; } + /* + * Allocate the first re_filterfile_spec struct + */ fs->f = bl = (struct re_filterfile_spec *)zalloc(sizeof(*bl)); if (bl == NULL) { goto load_re_filterfile_error; } - /* Open the file or fail */ + /* + * Initialize the name in case there are + * expressions before the first block header + */ + bl->filtername = "default"; + + /* + * Open the file or fail + */ if ((fp = fopen(csp->config->re_filterfile, "r")) == NULL) { goto load_re_filterfile_error; } - /* Read line by line */ + /* + * Read line by line + */ while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL) { - enlist( bl->patterns, buf ); + /* + * If this is the head of a new filter block, make it a + * re_filterfile spec of its own and chain it to the list: + */ + if (strncmp(buf, "FILTER:", 7) == 0) + { + new_bl = (struct re_filterfile_spec *)zalloc(sizeof(*bl)); + if (new_bl == NULL) + { + goto load_re_filterfile_error; + } + else + { + new_bl->filtername = strdup(chomp(buf + 7)); + bl->next = new_bl; + bl = new_bl; + } + continue; + } + + /* + * Else, save the expression, make it a pcrs_job + * and chain it into the current filter's joblist + */ + enlist(bl->patterns, buf); - /* We have a meaningful line -> make it a job */ if ((dummy = pcrs_compile_command(buf, &error)) == NULL) { log_error(LOG_LEVEL_RE_FILTER, - "Adding re_filter job %s failed with error %d.", buf, error); + "Adding re_filter job %s to filter %s failed with error %d.", buf, bl->filtername, error); continue; } else { dummy->next = bl->joblist; bl->joblist = dummy; - log_error(LOG_LEVEL_RE_FILTER, "Adding re_filter job %s succeeded.", buf); + log_error(LOG_LEVEL_RE_FILTER, "Adding re_filter job %s to filter %s succeeded.", buf, bl->filtername); } } fclose(fp); - /* the old one is now obsolete */ + /* + * Schedule the now-obsolete old data for unloading + */ if ( NULL != current_re_filterfile ) { current_re_filterfile->unloader = unload_re_filterfile; } + /* + * Chain this file into the global list of loaded files + */ fs->next = files->next; files->next = fs; current_re_filterfile = fs; diff --git a/project.h b/project.h index aed21f05..86252656 100644 --- a/project.h +++ b/project.h @@ -1,6 +1,6 @@ #ifndef PROJECT_H_INCLUDED #define PROJECT_H_INCLUDED -#define PROJECT_H_VERSION "$Id: project.h,v 1.53 2002/03/08 16:48:55 oes Exp $" +#define PROJECT_H_VERSION "$Id: project.h,v 1.54 2002/03/09 20:03:52 jongfoster Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/project.h,v $ @@ -36,6 +36,30 @@ * * Revisions : * $Log: project.h,v $ + * Revision 1.54 2002/03/09 20:03:52 jongfoster + * - Making various functions return int rather than size_t. + * (Undoing a recent change). Since size_t is unsigned on + * Windows, functions like read_socket that return -1 on + * error cannot return a size_t. + * + * THIS WAS A MAJOR BUG - it caused frequent, unpredictable + * crashes, and also frequently caused JB to jump to 100% + * CPU and stay there. (Because it thought it had just + * read ((unsigned)-1) == 4Gb of data...) + * + * - The signature of write_socket has changed, it now simply + * returns success=0/failure=nonzero. + * + * - Trying to get rid of a few warnings --with-debug on + * Windows, I've introduced a new type "jb_socket". This is + * used for the socket file descriptors. On Windows, this + * is SOCKET (a typedef for unsigned). Everywhere else, it's + * an int. The error value can't be -1 any more, so it's + * now JB_INVALID_SOCKET (which is -1 on UNIX, and in + * Windows it maps to the #define INVALID_SOCKET.) + * + * - The signature of bind_port has changed. + * * Revision 1.53 2002/03/08 16:48:55 oes * Added FEATURE_NO_GIFS and BUILTIN_IMAGE_MIMETYPE * @@ -622,20 +646,19 @@ struct iob #define ACTION_DEANIMATE 0x00000002UL #define ACTION_DOWNGRADE 0x00000004UL #define ACTION_FAST_REDIRECTS 0x00000008UL -#define ACTION_FILTER 0x00000010UL -#define ACTION_HIDE_FORWARDED 0x00000020UL -#define ACTION_HIDE_FROM 0x00000040UL -#define ACTION_HIDE_REFERER 0x00000080UL /* sic - follow HTTP, not English */ -#define ACTION_HIDE_USER_AGENT 0x00000100UL -#define ACTION_IMAGE 0x00000200UL -#define ACTION_IMAGE_BLOCKER 0x00000400UL -#define ACTION_NO_COMPRESSION 0x00000800UL -#define ACTION_NO_COOKIE_KEEP 0x00001000UL -#define ACTION_NO_COOKIE_READ 0x00002000UL -#define ACTION_NO_COOKIE_SET 0x00004000UL -#define ACTION_NO_POPUPS 0x00008000UL -#define ACTION_VANILLA_WAFER 0x00010000UL -#define ACTION_LIMIT_CONNECT 0x00020000UL +#define ACTION_HIDE_FORWARDED 0x00000010UL +#define ACTION_HIDE_FROM 0x00000020UL +#define ACTION_HIDE_REFERER 0x00000040UL /* sic - follow HTTP, not English */ +#define ACTION_HIDE_USER_AGENT 0x00000080UL +#define ACTION_IMAGE 0x00000100UL +#define ACTION_IMAGE_BLOCKER 0x00000200UL +#define ACTION_NO_COMPRESSION 0x00000400UL +#define ACTION_NO_COOKIE_KEEP 0x00000800UL +#define ACTION_NO_COOKIE_READ 0x00001000UL +#define ACTION_NO_COOKIE_SET 0x00002000UL +#define ACTION_NO_POPUPS 0x00004000UL +#define ACTION_VANILLA_WAFER 0x00008000UL +#define ACTION_LIMIT_CONNECT 0x00010000UL #define ACTION_STRING_DEANIMATE 0 #define ACTION_STRING_FROM 1 @@ -647,7 +670,9 @@ struct iob #define ACTION_MULTI_ADD_HEADER 0 #define ACTION_MULTI_WAFER 1 -#define ACTION_MULTI_COUNT 2 +#define ACTION_MULTI_FILTER 2 +#define ACTION_MULTI_COUNT 3 + /* * This structure contains a list of actions to apply to a URL. @@ -896,12 +921,18 @@ struct forward_spec #define FORWARD_SPEC_INITIALIZER { { URL_SPEC_INITIALIZER }, 0, NULL, 0, NULL, 0, NULL } +/* + * This struct represents one filter (one block) from + * the re_filterfile. If there is more than one filter + * in the file, the file will be represented by a + * chained list of re_filterfile specs. + */ struct re_filterfile_spec { - char *username; - char *filtername; - struct list patterns[1]; - pcrs_job *joblist; + char *filtername; /* Name from FILTER: statement in re_filterfile (or "default") */ + struct list patterns[1]; /* The patterns from the re_filterfile */ + pcrs_job *joblist; /* The resulting compiled pcrs_jobs */ + struct re_filterfile_spec *next; /* The pointer for chaining */ }; #ifdef FEATURE_ACL diff --git a/re_filterfile b/re_filterfile index 92402203..29cb9224 100644 --- a/re_filterfile +++ b/re_filterfile @@ -27,6 +27,9 @@ # # Revisions : # $Log: re_filterfile,v $ +# Revision 1.19 2002/03/10 19:49:24 oes +# Added expression to kill referer tracking in JavaScripts +# # Revision 1.18 2002/03/08 17:14:12 oes # PNG -> image in comments # @@ -73,13 +76,22 @@ # # # -# ********************************************************************/ + +################################################################################# +# +# Syntax: +# +# Filters start with a line "FILTER: name". They are then referrable +# from the actionsfile with +filter{name} +# +# Inside the filters, write one Perl-Style substitution per line. +# +# For Details see the pcrs manpage contained in this distribution. +# (and the perlre, perlop and pcre manpages) # -# Syntax: One Perl-Style substitution per line. -# For Details see the perlre, perlop and pcre manpages. # Note that you are free to choose the delimter as you see fit. # -# Note: In addidion to the Perl options egimosx, the following nonstandard +# Note2: In addidion to the Perl options gimsx, the following nonstandard # options are supported: # # 'U' turns the default to ungreedy matching. Add ? to quantifiers to @@ -88,85 +100,142 @@ # Use if you want to include text like '$&' in your substitute without # quoting. # +################################################################################# + -# ********************************************************************/ +################################################################################# # -# Kill OnUnload popups. Yummy. -# check it out on http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html +# html-annoyances: Get rid of particularly annoying HTML abuse # -# ********************************************************************/ -s/()/$1never$2/i +################################################################################# +FILTER: html-annoyances -# ********************************************************************/ +# New browser windows should be resizeable and have a location and status bar # -# Kill refresh tags. I like to refresh myself. Manually. -# check it out on http://www.airport-cgn.de/ and go to the arrivals page. +s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig +s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig +s/scrolling="?(no|0|Auto)"?/scrolling=1/ig +s/menubar="?(no|0)"?/menubar=1/ig + +# The tag was a crime! # -# ********************************************************************/ -# only if content value isn't 0..1 -# FIXME: second line like first line for content value -s/]*http-equiv[^>]*refresh.*([0-9]+[0-9]|"[2-9]);URL=([^>]*?)"?>//i -s/]*http-equiv="?page-enter"?[^>]*content=[^>]*>//i +s*|**ig + +# Is this evil? +# +#s/framespacing="?(no|0)"?//ig +#s/margin(height|width)=[0-9]*//gi -# ********************************************************************/ + +################################################################################# # -# If I allow popups, I want them to be resizeable and have a location -# and status bar: check it out on http://www.airport-cgn.de/ and go to -# the arrivals page. +# js-annoyances: Get rid of particularly annoying JavaScript abuse # -# ********************************************************************/ -# s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig -# s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig -# s/scrolling="?(no|0|Auto)"?/scrolling=1/ig -# s/menubar="?(no|0)"?/menubar=1/ig #s/framespacing="?(no|0)"?//ig -# #s/margin(height|width)=[0-9]*//gi +################################################################################# +FILTER: js-annoyances -# ********************************************************************/ +# JS cookies, like found on privacy.net: # -# Remove frameborder=0 and border=0 from framesets +s|(document\.cookie)([ \t\r\n]*=)|documenZapCooky$2|g + +# Get rid of Javascript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm # -# ********************************************************************/ +s|()|$1"Not Your Business!"$2|Usg + +# The status bar is for displaying link targets, not pointless blahblah +# +s/status='.*?';*//ig + +# Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html +# +s/()/$1never$2/iU + + +################################################################################## +# +# no-poups: Kill all popups in JS and HTML +# +################################################################################# +FILTER: no-poups + +s/window\.open\(/1;''\.concat\(/ig # JavaScript +s/target=['"]?_blank['"]?/target_who/g # HTML + + +################################################################################# +# +# frameset-borders: Give frames a border +# +################################################################################# +FILTER: frameset-borders + s/(]+?)border=['"]?(no|0)['"]?/$1/ig s/(]+?)frameborder=['"]?(no|0)['"]?/$1/ig -# ********************************************************************/ + +################################################################################# # -# The status bar is for displaying link targets, not pointless descriptions. -# Again, check it out on http://www.airport-cgn.de/ +# webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking) # -# ********************************************************************/ -s/status='.*?';*//ig +################################################################################# +FILTER: webbugs -# ********************************************************************/ +s/]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1(\D[^>]*?)?>//sig + + +################################################################################# # -# Get rid of Javascript cookies, like found on privacy.net: +# no-refresh: Automatic refresh sucks on auto-dialup lines # -# ********************************************************************/ +################################################################################# +FILTER: no-refresh + +# FIXME: second line like first line for content value +# +s/]*http-equiv[^>]*refresh.*([0-9]+[0-9]|"[2-9]);URL=([^>]*?)"?>//i +s/]*http-equiv="?page-enter"?[^>]*content=[^>]*>//i + + +################################################################################# +# +# fun: Text replacements for subversive browsing fun! +# +################################################################################# +FILTER: fun + +s/microsoft(?!.com)/MicroSuck/ig + +# Buzzword Bingo: +# +s/industry-leading|cutting-edge|award-winning/BINGO!/ig -s|(document\.cookie)([ \t\r\n]*=)|documenZapCooky$2|g -# ********************************************************************/ +################################################################################# # -# Get rid of Javascript referrer tracking: (http://www.randomoddness.com/untitled.htm) +# nimda: Remove Nimda (virus) code # -# ********************************************************************/ +################################################################################# +FILTER: nimda + +s%%

Internet JUNKBUSTER WARNING: This Server is infected with Nimda!%g -s|()|$1"NotYourBusiness!"$2|Usg -# ********************************************************************/ +################################################################################# # -# Kill *all* popups a la popup.c. (But for *all* sites, so I wouldn't do that.) +# banners-by-size: Kill banners by size # -# JavaScript: s/window\.open\(/1;''\.concat\(/ig -# HTML : s/target=['"]?_blank['"]?/target_who/g +################################################################################# +# +# Standard banner sizes taken from http://www.iab.net/iab_banner_standards/bannersizes.html # -# Kill banners by size: -# (Sizes from http://www.iab.net/iab_banner_standards/bannersizes.html) # Note: Use http://ijbswa.sourceforge.net/config/send-banner?type=trans for a transparent 1x1 image # Use http://ijbswa.sourceforge.net/config/send-banner?type=logo for the logo image # Use http://ijbswa.sourceforge.net/config/send-banner?type=logo for a grey/white pattern image # Use http://ijbswa.sourceforge.net/config/send-banner?type=auto to auto-select. -# ********************************************************************/ +# +################################################################################# +FILTER: banners-by-size + s|]*?(width=['"]?468\D)[^>]*(height=['"]?60[^>]*?)>||sig s|]*?(width=['"]?234\D)[^>]*(height=['"]?60[^>]*?)>||sig s|]*?(width=['"]?88\D)[^>]*(height=['"]?31[^>]*?)>||sig @@ -182,39 +251,23 @@ s|]*?(width=['"]?250\D)[^>]*(height=['"]?250[^>]*?)>|]*?(width=['"]?240\D)[^>]*(height=['"]?400[^>]*?)>||sig s|]*?(width=['"]?336\D)[^>]*(height=['"]?280[^>]*?)>||sig -# Where is that from? +# One more. (Where is 200x50 from?) +# s|]*?(width=['"]?200\D)[^>]*(height=['"]?50[^>]*?)>||sig -# ********************************************************************/ -# -# Squish WebBugs: -# -# ********************************************************************/ -s/]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1(\D[^>]*?)?>//sig -# ********************************************************************/ -# -# Fun stuff +################################################################################# # -# ********************************************************************/ -#s/microsoft(?!.com)/MicroSuck/ig - -# ********************************************************************/ +# crude-parental: Crude parental filtering? (Use along with a suitable blocklist). +# Shows how to deny access to whole page based on a keyword. # -# Crude parental filtering? (Use along with a suitable blocklist). -# Shows how to deny access to whole page based on a keyword. +################################################################################# # # (Note: Middlesex, Sussex and Essex are counties in the UK, not rude words) # (Note #2: Is 'sex' a rude word?!) # -#s%^.*(?Blocked

Blocked due to possible adult content. Please see this site.

%is -#s+^.*warez.*$+No Warez

You're not searching for illegal stuff, are you?

+is - -# ********************************************************************/ -# -# Remove Nimda code. -# -# ********************************************************************/ -s%%

Internet JUNKBUSTER WARNING: This Server is infected with Nimda!%g - +################################################################################# +FILTER: crude-parental +s%^.*(?Blocked

Blocked due to possible adult content. Please see this site.

%is +s+^.*warez.*$+No Warez

You're not searching for illegal stuff, are you?

+is diff --git a/templates/edit-actions-for-url b/templates/edit-actions-for-url index 222fb361..eb69443b 100644 --- a/templates/edit-actions-for-url +++ b/templates/edit-actions-for-url @@ -32,6 +32,9 @@ # # Revisions : # $Log: edit-actions-for-url,v $ +# Revision 1.11 2002/03/08 18:19:14 jongfoster +# Adding +image-blocker{pattern} option to edit interface +# # Revision 1.10 2002/03/03 10:29:12 swa # point users to the right feedback forms, # not necessarily the developer list. @@ -221,6 +224,18 @@ function show_deanimate_opts(tf) target.style.display = (tf ? "" : "none"); } +function show_filter_opts(tf) +{ + if (document.getElementById) { + target = document.getElementById("filter_opts"); + } else if (document.all) { + target = document.filter_opts; + } else { + return; + } + target.style.display = (tf ? "" : "none"); +} + function show_hide_from_opts(tf) { if (document.getElementById) { @@ -443,16 +458,22 @@ href="http://sourceforge.net/mail/?group_id=11118">mailing lists. +filter - Filter the website through the re_filterfile + Filter the website through one or more regular expression filters. + name="filter" id="filter_y" value="Y" @filter-y@ + onclick="show_filter_opts(true)"> + name="filter" id="filter_n" value="N" @filter-n@ + onclick="show_filter_opts(false)"> + name="filter" id="filter_x" value="X" @filter-x@ + onclick="show_filter_opts(false)"> + + +   + Editing the settings for this option, or turning + it on if it was off, is not yet supported using this web-based + editor. +hide-forwarded -- 2.39.2