1 # ********************************************************************
3 # File : $Source: /cvsroot/ijbswa/current/default.filter,v $
5 # $Id: default.filter,v 1.32 2006/11/10 18:04:04 fabiankeil Exp $
7 # Purpose : Rules to process the content of web pages
9 # Copyright : Written by and Copyright (C) 2001 - 2006 the
10 # Privoxy team. http://www.privoxy.org/
12 # We value your feedback. However, to provide you with the best support,
15 # * Use the support forum to get help:
16 # http://sourceforge.net/tracker/?group_id=11118&atid=211118
17 # * Submit bugs only thru our bug forum:
18 # http://sourceforge.net/tracker/?group_id=11118&atid=111118
19 # Make sure that the bug has not already been submitted. Please try
20 # to verify that it is a Privoxy bug, and not a browser or site
21 # bug first. If you are using your own custom configuration, please
22 # try the stock configs to see if the problem is a configuration
23 # related bug. And if not using the latest development snapshot,
24 # please try the latest one. Or even better, CVS sources.
25 # * Submit feature requests only thru our feature request forum:
26 # http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse
28 # For any other issues, feel free to use the mailing lists:
29 # http://sourceforge.net/mail/?group_id=11118
31 # Anyone interested in actively participating in development and related
32 # discussions can join the appropriate mailing list here:
33 # http://sourceforge.net/mail/?group_id=11118. Archives are available
36 #################################################################################
40 # Filters start with a line "FILTER: name description". They are then referrable
41 # from the actionsfile with +filter{name}
43 # Inside the filters, write one Perl-Style substitution (job) per line.
44 # Jobs that precede the first FILTER: line are ignored.
46 # For Details see the pcrs manpage contained in this distribution.
47 # (and the perlre, perlop and pcre manpages)
49 # Note that you are free to choose the delimter as you see fit.
51 # Note2: In addidion to the Perl options gimsx, the following nonstandard
52 # options are supported:
54 # 'U' turns the default to ungreedy matching. Add ? to quantifiers to
55 # switch back to greedy.
56 # 'T' (trivial) prevents parsing for backreferences in the substitute.
57 # Use if you want to include text like '$&' in your substitute without
60 #################################################################################
63 #################################################################################
65 # js-annoyances: Get rid of particularly annoying JavaScript abuse
67 #################################################################################
68 FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse
70 # Note: Most of these jobs would be safer if restricted to a
71 # <script> context as in:
73 # s/(<script.*)nasty-item(?=.*<\/script>)/$1replacement/sigU
75 # but that would make them match only the first occurance of
76 # nasty-item in each <script>. We need nestable jobs!
78 # Get rid of Javascript referrer tracking.
79 # Test page: http://www.javascript-page.com/referrer.html
81 s|(?:\w+\.)+referrer|"Not Your Business!"|gisU
83 # The status bar is for displaying link targets, not pointless blahblah
85 s/(\W\s*)((this|window)\.(default)?status)\s*=\s*((['"]).*?(?<!\\)\6)/$1if(typeof(this.href) != 'undefined') $2 = $5 + ' URL: ' + this.href;else return false/ig
87 # Kill OnUnload popups. Yummy.
88 # Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
90 s/(<body\s+[^>]*)onunload/$1never/siU
91 s|(<script.*)window\.onunload(?=.*</script>)|$1never|sigU
93 # If we allow window.open, we want normal window features:
94 # Test: http://www.htmlgoodies.com/beyond/notitle.html
96 s/(open\s*\([^\)]+resizable=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
97 s/(open\s*\([^\)]+location=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
98 s/(open\s*\([^\)]+status=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
99 s/(open\s*\([^\)]+scroll(?:ing|bars)=)(["']?)(?:no|0)\2/$1$2auto$2/sigU
100 s/(open\s*\([^\)]+menubar=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
101 s/(open\s*\([^\)]+toolbar=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
102 s/(open\s*\([^\)]+directories=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
103 s/(open\s*\([^\)]+fullscreen=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
104 s/(open\s*\([^\)]+always(?:raised|lowered)=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
105 s/(open\s*\([^\)]+z-?lock=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
106 s/(open\s*\([^\)]+hotkeys=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
107 s/(open\s*\([^\)]+titlebar=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
108 s/(open\s*\([^\)]+always(?:raised|lowered)=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
111 #################################################################################
113 # js-events: Kill all JS event bindings and timers (Radically destructive! Only for extra nasty sites)
115 #################################################################################
116 FILTER: js-events Kill all JS event bindings and timers (Radically destructive! Only for extra nasty sites)
118 s/(on|event\.)((mouse(over|out|down|up|move))|(un)?load|contextmenu|selectstart)/never/ig
119 # Not events, but abused on the same type of sites:
120 s/(alert|confirm)\s*\(/concat(/ig
121 s/settimeout\(/concat(/ig
123 #################################################################################
125 # html-annoyances: Get rid of particularly annoying HTML abuse
127 #################################################################################
128 FILTER: html-annoyances Get rid of particularly annoying HTML abuse
130 # New browser windows (if allowed -- see no-popups filter below) should be
131 # resizeable and have a location and status bar
133 s/(<a\s+href[^>]+resizable=)(['"]?)(?:no|0)\2/$1$2yes$2/igU
134 s/(<a\s+href[^>]+location=)(['"]?)(?:no|0)\2/$1$2yes$2/igU
135 s/(<a\s+href[^>]+status=)(['"]?)(?:no|0)\2/$1$2yes1$2/igU
136 s/(<a\s+href[^>]+scrolling=)(['"]?)(?:no|0)\2/$1$2auto$2/igU
137 s/(<a\s+href[^>]+menubar=)(['"]?)(?:no|0)\2/$1$2yes$2/igU
139 # The <BLINK> and <MARQUEE> tags were crimes!
141 s-</?(blink|marquee).*>--sigU
144 #################################################################################
146 # content-cookies: Kill cookies that come in the HTML or JS content
148 #################################################################################
149 FILTER: content-cookies Kill cookies that come in the HTML or JS content
151 # JS cookies, except those used by antiadbuster.com to detect us:
153 s|(\w+\.)+cookie(?=[ \t\r\n]*=)(?!='aab)|ZappedCookie|ig
157 s|<meta\s+http-equiv=['"]?set-cookie.*>|<!-- ZappedCookie -->|igU
160 #################################################################################
162 # refresh-tags: Kill automatic refresh tags (for dial-on-demand setups)
164 #################################################################################
165 FILTER: refresh-tags Kill automatic refresh tags (for dial-on-demand setups)
167 # Note: Only deactivates refreshes with more than 9 seconds delay to
168 # preserve monster-stupid but common redirections via meta tags.
170 s/<meta\s+http-equiv\s*=\s*(['"]?)refresh\1\s+content\s*=\s*(['"]?)\d{2,}\s*(;\s*url\s*=\s*([^>\2]*))?\2/<link rev="x-refresh" href="$4"/iU
173 #################################################################################
175 # unsolicited-popups: Disable unsolicited pop-up windows
177 #################################################################################
178 FILTER: unsolicited-popups Disable only unsolicited pop-up windows
180 s+([^'"]\s*<head.*>)(?=\s*[^'"])+$1<script>function PrivoxyWindowOpen(){return(null);}</script>+isU
181 s+([^\w\s.]\s*)((window|this|parent)\.)?open\s*\(+$1PrivoxyWindowOpen(+ig
182 s+([^'"]\s*</html>)(?!\s*(\\n|'|"))+$1<script>function PrivoxyWindowOpen(a, b, c){return(window.open(a, b, c));}</script>+iU
185 ##################################################################################
187 # all-popups: Kill all popups in JavaScript and HTML
189 #################################################################################
190 FILTER: all-popups Kill all popups in JavaScript and HTML
192 s/((\W\s*)(window|this|parent)\.)open\s*\\?\(/$1concat(/ig # JavaScript
193 s/\starget\s*=\s*(['"]?)_?(blank|new)\1?/ notarget/ig # HTML
196 ##################################################################################
198 # img-reorder: Reorder attributes in <img> tags to make the banners-by-* filters more effective
200 #################################################################################
201 FILTER: img-reorder Reorder attributes in <img> tags to make the banners-by-* filters more effective
203 # In the first step src is moved to the start, then width is moved to the second
204 # place to guarantee an order of src, width, height.
205 # This makes banners-by-size more effective and allows both banners-by-size
206 # and banners-by-link to preserve the original image URL in the title attribute.
208 s|<img\s+?([^>]*) src\s*=\s*(['"])([^>\\\2]+)\2|<img src=$2$3$2 $1|siUg
209 s|<img\s+?([^>]*) src\s*=\s*([^'">\\\s]+)|<img src=$2 $1|sig
211 s|<img (src=(?:(['"])[^>\\\\2]*\2\|[^'">\\\s]+?))([^>]*)\s+width\s*=\s*(["']?)(\d+?)\4|<img $1 width=$4$5$4$3|siUg
214 #################################################################################
216 # banners-by-size: Kill banners by size
218 #################################################################################
220 # Standard banner sizes taken from http://www.iab.net/iab_banner_standards/bannersizes.html
222 # Note: Use http://config.privoxy.org/send-banner?type=trans for a transparent 1x1 image
223 # Use http://config.privoxy.org/send-banner?type=pattern for a grey/white pattern image
224 # Use http://config.privoxy.org/send-banner?type=auto to auto-select.
226 # Note2: Use img-reorder before this filter to ensure maximum matching success
228 #################################################################################
229 FILTER: banners-by-size Kill banners by size
232 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)88\4)[^>]*?(height=(['"]?)31\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
233 # 120*60, 120*90, 120*240, 120*600
234 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)120\4)[^>]*?(height=(['"]?)(?:600?|90|240)\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
236 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)125\4)[^>]*?(height=(['"]?)125\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
238 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)160\4)[^>]*?(height=(['"]?)600\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
240 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)180\4)[^>]*?(height=(['"]?)150\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
241 # 234*60, 468*60 (Most Banners!)
242 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)(?:234|468)\4)[^>]*?(height=(['"]?)60\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
244 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)240\4)[^>]*?(height=(['"]?)400\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
246 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)(?:250|300)\4)[^>]*?(height=(['"]?)250\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
248 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)336\4)[^>]*?(height=(['"]?)280\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
250 # Note: 200*50 was also proposed, but it probably causes too much collateral damage:
252 #s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)200\4)[^>]*?(height=(['"]?)50\6)[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed-$2-by-size$1 $3 $5>@sig
255 #################################################################################
257 # banners-by-link: Kill banners by their links to known clicktrackers (Experimental)
259 #################################################################################
260 FILTER: banners-by-link Kill banners by their links to known clicktrackers
262 # Common case with width and height attributes:
264 s@<a\s+href\s*=\s*(['"]?)([^>\1\s]*?(?:\
265 adclick # See www.dn.se \
266 | atwola\.com/(?:link|redir) # see www.cnn.com \
267 | /jump/ # redirs for doublecklick.net ads \
268 | tracker | counter # common \
269 | adlog\.pl # see sf.net \
270 )[^>\1\s]*)\1[^>]*>\s*<img\s+(?:src\s*=\s*(['"]?)([^>\\\3\s]+)\3)?[^>]*((?:width|height)\s*=\s*(['"]?)\d+?\6)[^>]*((?:width|height)\s*=\s*(['"]?)\d+?\8)[^>]*>\
271 @<img $5 $7 src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed $4 by link to $2$1>@sigx
273 # Rare case w/o explicit dimensions:
275 s@<a\s+href\s*=\s*(['"]?)([^>\1\s]*?(?:adclick|atwola\.com/(?:link|redir)|doubleclick\.net/jump/|tracker|counter|adlog\.pl)[^>\1\s]*)\1[^>]*>\s*<img\s+(?:src\s*=\s*(['"]?)([^>\\\3\s]+)\3)?[^>]*>@<img src=$1http://config.privoxy.org/send-banner?type=auto$1 border="0" title=$1Killed $4 by link to $2$1>@sig
278 ################################################################################
280 # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
282 #################################################################################
283 FILTER: webbugs Squish WebBugs (1x1 invisible GIFs used for user tracking)
285 s@<img[^>]*\s(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*\s(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*?>@@siUg
288 #################################################################################
290 # tiny-textforms: Extend those tiny textareas up to 40x80 and kill the hard wrap
292 #################################################################################
293 FILTER: tiny-textforms Extend those tiny textareas up to 40x80 and kill the hard wrap
295 s/(<textarea[^>]*?)(?:\s*(?:rows|cols)=(['"]?)\d+\2)+/$1 rows=$2\40$2 cols=$2\80$2/ig
296 s/(<textarea[^>]*?)wrap=(['"]?)hard\2/$1/ig
299 #################################################################################
301 # jumping-windows: Prevent windows from resizing and moving themselves
303 #################################################################################
304 FILTER: jumping-windows Prevent windows from resizing and moving themselves
306 s/(?<=[\W])(?:window|this|self)\.(?:move|resize)(?:to|by)\(/''.concat(/ig
308 #################################################################################
310 # frameset-borders: Give frames a border, make them resizable and scrollable
312 #################################################################################
313 FILTER: frameset-borders Give frames a border and make them resizable
315 s/(<frameset\s+[^>]*)framespacing=(['"]?)(no|0)\2/$1/igU
316 s/(<frameset\s+[^>]*)frameborder=(['"]?)(no|0)\2/$1/igU
317 s/(<frameset\s+[^>]*)border=(['"]?)(no|0)\2/$1/igU
318 s/(<frame\s+[^>]*)noresize/$1/igU
319 s/(<frame\s+[^>]*)frameborder=(['"]?)(no|0)\2/$1/igU
320 s/(<frame\s+[^>]*)scrolling=(['"]?)(no|0)\2/$1/igU
324 #################################################################################
326 # demoronizer: Correct Microsoft's abuse of standardized character sets, which
327 # leave the browser to (mis)-interpret unknown characters, with
328 # sometimes bizarre results on non-MS platforms.
330 # credit: ripped from the demoroniser.pl script by:
331 # John Walker -- January 1998, http://www.fourmilab.ch/webtools/demoroniser
333 #################################################################################
334 FILTER: demoronizer Fix MS's non-standard use of standard charsets
336 s/(&\#[0-2]\d\d)\s/$1; /g
337 # per Robert Lynch: http://slate.msn.com//?id=2067547, just a guess.
338 # Must come before x94 below.
339 s/\xE2\x80\x94/ -- /g
351 # Bullet type character.
355 #s-\x98-<sup>~</sup>-g
356 #s-\x99-<sup>TM</sup>-g
361 #################################################################################
363 # shockwave-flash: Kill embedded Shockwave Flash objects
364 # Note: Better just block "/.*\.swf$"!
366 #################################################################################
367 FILTER: shockwave-flash Kill embedded Shockwave Flash objects
369 s|<object [^>]*macromedia.*</object>|<!-- Squished Shockwave Object -->|sigU
370 s|<embed [^>]*(application/x-shockwave-flash\|\.swf).*>(.*</embed>)?|<!-- Squished Shockwave Flash Embed -->|sigU
373 #################################################################################
375 # quicktime-kioskmode: Make Quicktime movies saveable
377 #################################################################################
378 FILTER: quicktime-kioskmode Make Quicktime movies saveable
380 s/(<embed\s+[^>]*)kioskmode\s*=\s*(["']?)true\2/$1/ig
383 #################################################################################
385 # fun: Text replacements for subversive browsing fun!
387 #################################################################################
388 FILTER: fun Text replacements for subversive browsing fun!
392 s/microsoft(?!.[^\s])/MicroSuck/ig
394 # Buzzword Bingo (example for extended regex syntax)
396 s* (?:industry|world)[ -]leading \
398 | customer[ -]focused \
400 | award[ -]winning # Comments are OK, too! \
401 | high[ -]performance \
402 | solutions[ -]based \
406 *$0<sup><font color="red"><b>Bingo!</b></font></sup> \
411 s/(M|m)edien(?![^<]*>)/$1ädchen/Ug
413 #################################################################################
415 # crude-parental: Crude parental filtering? (Use along with a suitable blocklist).
416 # Shows how to deny access to whole page based on a keyword.
418 #################################################################################
419 FILTER: crude-parental Crude parental filtering (demo only)
421 # (Note: Middlesex, Sussex and Essex are counties in the UK, not rude words)
422 # (Note #2: Is 'sex' a rude word?!)
424 s%^.*(?<!middle)(?<!sus)(?<!es)sex.*$%<html><head><title>Blocked</title></head><body><h3>Blocked due to possible adult content. Please see <a href="http://dmoz.org/Kids_and_Teens/">this site</a>.</h3></body></html>%is
425 s+^.*warez.*$+<html><head><title>No Warez</title></head><body><h3>You're not searching for illegal stuff, are you?</h3></body></html>+is
428 #################################################################################
430 # IE-Exploits: Disable some known Internet Explorer bug exploits
432 #################################################################################
433 FILTER: ie-exploits Disable some known Internet Explorer bug exploits
435 # Note: This is basically a demo and waits for someone more interested in IE
436 # security (sic!) to take over.
438 # Cross-site-scripting:
440 s%f\("javascript:location.replace\('mk:@MSITStore:C:'\)"\);%alert\("This page looks like it tries to use a vulnerability described here:\n http://online.securityfocus.com/archive/1/298748/2002-11-02/2002-11-08/2"\);%siU
442 # Address bar spoofing (http://www.secunia.com/advisories/10395/):
444 s/(<a[^>]*href[^>]*)(?:\x01|\x02|\x03|%0[012])@/$1MALICIOUS-LINK@/ig
448 s%<script language="JavaScript">(window\.open|1;''\.concat)\("readme\.eml", null, "resizable=no,top=6000,left=6000"\)</script>%<br><font size="7"> WARNING: This Server is infected with <a href="http://www.cert.org/advisories/CA-2001-26.html">Nimda</a>!</font>%g
451 #################################################################################
454 # site-specifics: Cure for site-specific problems. Don't apply generally!
456 # Note: The fixes contained here are so specific to the problems of the
457 # particular web sites they are designed for that they would be a
458 # waste of CPU cycles (or even destructive!) on 99.9% of the web
459 # sites where they don't apply.
461 #################################################################################
462 FILTER: site-specifics Cure for site-specific problems. Don't apply generally!
464 # www.spiegel.de excludes X11 users from viewing Flash5 objects - shame.
465 # Apply to: www.spiegel.de/static/js/flash-plugin.js
467 s/indexOf\("x11"\)/indexOf("x13")/
469 # www.quelle-bausparkasse.de uses a very stupid redirect mechanism that
470 # relies on a webbug being present. Can we tolerate that? No!
471 # Apply to: www.quelle-bausparkasse.de/$
475 # groups.yahoo.com has splash pages that one needs to click through in
476 # order to access the actual messages. Let the browser do that. Thanks
477 # to Paul Jobson for this one:
479 s|<a href="(.+?)">(?:Continue to message\|Weiter zu Nachricht)</a>|<meta http-equiv="refresh" content="0; URL=$1">|ig
481 # monster.com has two very similar gimmicks:
483 s|<input type="hidden" name="REDIRECT" value="(.+?)">|<meta http-equiv="refresh" content="0; URL=$1">|i
485 s|<IMG SRC="http://media.monster.com/mm/usen/my/no_thanks_211x40.gif".+?>|<meta http-equiv="refresh" content="0; URL=http://my.monster.com/resume.asp">|i
487 # nytimes.com triggers popups through the onload handler of dummy images
488 # to fool popup-blockers.
490 s|(<img [^>]*)onload|$1never|sig
492 # Pre-check all the "Discard" buttons in GNU Mailman's web interface.
493 # (This saves a lot of mouse aiming practice when flushing spamtraps)
495 s|(<INPUT name="\d{2,4}" type="RADIO" value="0") CHECKED |$1|g
496 s|<INPUT name="\d{2,4}" type="RADIO" value="3" |$0 checked|g
498 #################################################################################
500 # no-ping: Removes non-standard ping attributes in <a> and <area> tags.
502 #################################################################################
503 FILTER: no-ping Removes non-standard ping attributes in <a> and <area> tags.
504 s@(<a(?:rea)?[^>]*?)\sping=(['"]?)([^"'>]+)\2([>\s]?)@\
505 <strong style="color:white; background-color:red;" title="Privoxy removed ping target '$3'">PING!</strong>\n$1$4@ig
507 #################################################################################
509 # google: CSS-based block for Google text ads. Also removes
510 # a width limitation and the toolbar advertisement.
512 #################################################################################
513 FILTER: google CSS-based block for Google text ads. Also removes a width limitation and the toolbar advertisement.
514 s@</head>@<style type="text/css">\n\
515 /* Style sheet inserted by Privoxy's google filter. */\n\
516 \#fbc, \#fbl, \#ra, .rhh {visibility: hidden !important;}\n\
517 \#tpa1,\#tpa2,\#tpa3,\#tpa4,\#tpa5,\#tpa5, \#spl, .ch, \#ads,\
518 \#toolbar, \#google_ads_frame{display: none !important;}\n\
519 .main_body, .j {width: 100%}\n</style>\n$0@
520 s@<div style=\"padding-top:11px;min-width:500px\">@<div id="main_body">@
521 s@(<table cellspacing=0 cellpadding=0 width=25% align=right bgcolor=\#ffffff border=0\
522 |</font></td></tr></tbody></table><table align=\"right\" bgcolor=\"\#ffffff\"\
523 |<table cellspacing=0 cellpadding=0 align=right bgcolor=\#ffffff border=0\
524 |<table style=\"clear:both\" align=right width=25% cellspacing=\"0\" cellpadding=\"0\"\
525 border=\"0\" bgcolor=\"\#ffffff\")@$0 id="ads"@
526 s@(<br clear=all><table)( border=0 cellpadding=9><tr><td)@$1 id="toolbar"$2@
528 #################################################################################
530 # yahoo: CSS-based block for Yahoo text ads. Also removes a width limitation.
532 #################################################################################
533 FILTER: yahoo CSS-based block for Yahoo text ads. Also removes a width limitation.
534 s@</head>@\n<style type="text/css">\n\
535 /* Style sheet inserted by Privoxy's yahoo filter. */\n\
536 \#symadbn, \#ymadbn, .yschbox, \#yschsec, .yschhd, \#yschanswr, .yschftad,\
537 .yschspn, .yschspns, \#ygrp-sponsored-links {display: none !important;}\n\
538 \#yschpri, \#yschweb {width: 100% !important; max-width: 100% !important;}\n\
539 \#yschqcon, \#yschtg {width: auto !important; /* No useless horizontal scrollbar please */}\n\
542 #################################################################################
544 # msn: CSS-based block for MSN text ads. Also removes tracking URLs
545 # and a width limitation.
547 #################################################################################
548 FILTER: msn CSS-based block for MSN text ads. Also removes tracking URLs and a width limitation.
549 s@</head>@<style type="text/css">\n\
550 /* Style sheet inserted by Privoxy's msn filter. */\n\
551 .msn_ads {display: none !important;}\n\
552 \#results, .flank, .results_area_flank, .results_area_stroke, .SearchSection .not\
553 {width: 99% /*!important*/; min-width: 99% !important;\
554 max-width: 100% !important; /* width:100% sometimes causes horizontal scrollbars */}\n\
555 /* Make continue links harder to miss */\n\
556 \#pagination_bottom a {padding: .3em .5em .3em .5em; border: 1px solid \#e6e6e6;}\n\
557 \#pagination_bottom li, \#pagination_bottom li .selected, li .nextPage \
558 {margin: 0 !important; cursor: auto; border: none; padding:.1em;}\n\
559 \#pagination_bottom li .prevPage {padding-right: 1.5em !important;}\n\
560 \#pagination_bottom li .selected {border: none;}\n\
561 .selected a {background-color: \#d2eaf6; border: 1px solid \#b7d8ee;}\n\
562 /* Remove "suggestions". They are next to worthless but partly overlap with the search results */\n\
563 .suggestion, \#nys_right {clear: both; display:none;}\n\
565 s@(<div[^>]*) id=(["']?)ads_[^\2]*\2@$1 class="msn_ads"@Uig
566 s@(<a[^>]*href=\")http://g.msn.com/.*\?(http://.*)(&&DI=.*)(\")@$1$2$4@Ug
567 s@(<a[^>]*)gping=\".*\"@$1 title="URL cleaned up by Privoxy's msn filter"@Ug
569 #################################################################################
571 # blogspot: Cleans up some Blogspot blogs. Read the fine print before using this.
573 # This filter also intentionally removes some navigation stuff and
574 # sets the page width to 100%. As a result, some rounded "corners" would
575 # appear to early or not at all and as fixing this would require a browser
576 # that understands background-size (CSS3), they are removed instead.
578 #################################################################################
579 FILTER: blogspot Cleans up some Blogspot blogs. Read the fine print before using this.
580 s@</head>@<style type="text/css">\n\
581 /* Style sheet inserted by Privoxy's blogspot filter. */\n\
582 \#powered-by {display: none !important;}\n\
583 \#wrap4, \#wrapper {margin-top: 0px }\n\
584 \#blogheader, \#header {margin-top: 0.5em !important}\n\
585 \#content {width: 98% }\n\
586 \#main {width: 70% }\n\
587 \#sidebar {width: 29% }\n\
588 .post-body {overflow: auto;}\n\
589 .blogComments {width: 100%; overflow: auto;}\n</style>\n$0@
590 s@<body.*(?:<div id="space-for-ie"></div>|(<div id="(?:content|wrap4|wrapper)))@<body>\
591 <!-- Privoxy's blogspot filter ditched some garbage here -->$1@Us
592 s@(<div style=\"[^\"]*width:)30em@$1 100%@
593 s@background:url\(\"http://www.blogblog.com/rounders[^\"]*\"\).*;@/*$0*/@Ug
594 s@(background:\#[a-f\d]{3})( url\(\"http://www.blogblog.com/rounders[^\"]*\"\).*;)@$1 ;/*$2*/@Ug
596 #################################################################################
598 # x-httpd-php-to-html: Header filter to change the Content-Type from
599 # x-httpd-php to html. "Content-Type: x-httpd-php"
600 # is set by clueless PHP users and causes many
601 # browsers do open a download menu instead of
602 # rendering the page.
604 #################################################################################
605 FILTER: x-httpd-php-to-html Header filter to change the Content-Type from x-httpd-php to html.
606 s@^(Content-Type:) application/x-httpd-php@$1 text/html@
608 #################################################################################
610 # html-to-xml: Header filter to change the Content-Type from html to xml.
612 #################################################################################
613 FILTER: html-to-xml Header filter to change the Content-Type from html to xml.
614 s@^(Content-Type:) text/html(;.*)?$@$1 application/xhtml+xml$2@
616 #################################################################################
618 # xml-to-html: Header filter to change the Content-Type from xml to html.
620 #################################################################################
621 FILTER: xml-to-html Header filter to change the Content-Type from xml to html.
622 s@^(Content-Type:) (?:application|text)/(?:xhtml\+)?xml(;.*)?$@$1 text/html$2@
624 #################################################################################
626 # hide-tor-exit-notation: Header filter to remove the Tor exit node notation
627 # in Host and Referer headers.
629 # Note: If Privoxy and Tor are chained and Privoxy is configured to
630 # use socks4a, one can use http://www.example.org.foobar.exit/
631 # to access the host www.example.org through Tor exit node foobar.
633 # As the HTTP client isn't aware of this notation, it treats the
634 # whole string "www.example.org.foobar.exit" as host and uses it
635 # for the "Host" and "Referer" headers. From the server's point of
636 # view the resulting headers are invalid and can cause problems.
638 # An invalid "Referer" header can trigger "hot-linking" protections,
639 # an invalid "Host" header will make it impossible for the server to
640 # find the right vhost (several domains hosted on the same IP address).
642 # This filter removes the "foo.exit" part in those headers
643 # to prevent the mentioned problems. Note that it only modifies
644 # the HTTP headers, it doesn't make it impossible for the server
645 # to detect your Tor exit node based on the IP address the request is
648 #################################################################################
649 FILTER: hide-tor-exit-notation Header filter to remove the Tor exit node notation in Host and Referer headers.
650 s@^((?:Referer|Host):\s*(?:https?://)?[^/]*)\.[^\./]*?\.exit@$1@i
653 ##############################################################################
656 # $Log: default.filter,v $
657 # Revision 1.32 2006/11/10 18:04:04 fabiankeil
658 # Have no-ping print the ping warning in red.
660 # Modified yahoo to keep in sync with recent
661 # CSS changes and to suppress a useless horizontal
664 # msn now makes sure that the continue-link boxes
665 # act as links (the original CSS just changes the cursor).
667 # Changed fun filter regex to leave microsoft links alone.
670 # Revision 1.31 2006/10/21 13:12:28 fabiankeil
671 # Added no-ping and hide-tor-exit-notation.
673 # Adjusted jumping-windows to break less.
676 # Revision 1.30 2006/10/18 12:36:50 fabiankeil
677 # google filter now cleans Google groups as well.
679 # Revision 1.29 2006/10/11 14:03:17 fabiankeil
680 # Changed img-reorder regex to only move width
681 # attributes if they are following at least one
682 # whitespace. Fixes BR 1328455.
684 # Revision 1.28 2006/10/11 13:31:13 fabiankeil
685 # Added Anduin Withers' js-annoyances fix
686 # for not messing up escaped quotes. Fixes BR 999765.
688 # Improved blogspot filter to make it less likely that
689 # the blogspot banner at the top of the page is missed.
691 # Revision 1.27 2006/10/08 17:00:51 fabiankeil
692 # Modified webbugs filter to create a comment around the offending
693 # image instead of removing it entirely.
695 # Adjusted regex to only match if there's at least one whitespace
696 # before the width and height attributes. Makes it more likely that
697 # they are indeed attributes, and not part of the value of another attribute.
700 # Thanks to Martin Thomas for diagnosing the cause of the problem.
702 # Revision 1.26 2006/10/06 18:06:16 fabiankeil
703 # Added header filter x-httpd-php-to-html
704 # and reverted another img-reorder whitespace
707 # Revision 1.25 2006/10/06 15:26:09 fabiankeil
708 # Bumped copyright year.
710 # Reverted parts of the last img-reorder change
711 # which were intended to remove superfluous whitespace
712 # but had the side effect to mess up some tags.
714 # Modified banners-by-size and banners-by-link to
715 # use border value "0" instead of "\0". Fixes BR 1100065.
717 # Revision 1.24 2006/10/06 11:25:31 fabiankeil
718 # Taught img-reorder not to break img tags
719 # with empty src attributes. Fixes BR 1089474.
720 # Thanks to Raphael Moll for reporting.
722 # Revision 1.23 2006/10/05 14:46:28 fabiankeil
723 # Replaced "<" in img-reorder's description with "<".
725 # Modified msn filter to tag ads with classes instead
726 # of ids. There may be more than one ad per page,
727 # but ids are required to be unique.
729 # Revision 1.22 2006/10/04 19:17:14 fabiankeil
730 # Incorportated Frédéric Crozat's ie-exploits
731 # modification to make it less trigger-happy.
733 # Modified blogspot filter to make .post-body
734 # scrollable if necessary.
736 # Revision 1.21 2006/10/02 16:21:14 fabiankeil
737 # Adjusted yahoo filter to hide .yschspns as well.
738 # Added header filters: html-to-xml and xml-to-html.
740 # Revision 1.20 2006/10/01 21:00:22 fabiankeil
741 # New site-specific filters: google, yahoo, msn and blogspot.
743 # Revision 1.19 2006/07/18 14:48:45 david__schmidt
744 # Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
745 # with what was really the latest development (the v_3_0_branch branch)
747 # Revision 1.11.2.23 2004/02/17 13:34:01 oes
748 # - Beefed up the protection of the unsolicited-popups
749 # filter against matching in JavaScript string constants.
750 # - Extended the fun filter with a German joke
751 # - Extended the site-specifics filter with a convenience
752 # reeplacement for managing mailing lists at SourceForge
754 # Revision 1.11.2.22 2004/01/30 15:29:29 oes
755 # Updated the copyright note
757 # Revision 1.11.2.21 2004/01/20 15:15:01 oes
758 # Detail enhancement in all-popups
760 # Revision 1.11.2.20 2004/01/06 16:46:14 oes
761 # Fixed a JS syntax problem in jumping-windows
763 # Revision 1.11.2.19 2003/12/17 17:09:25 oes
764 # Added remedy against IE address bar spoofing
766 # Revision 1.11.2.18 2003/12/02 11:25:27 oes
767 # Fixed a line trashed in previous commit
769 # Revision 1.11.2.17 2003/12/01 21:58:46 oes
772 # - unsolicited-popups no longer matches at start or end of quoted
773 # strings, and is now activated earlier and deactivated later in
775 # - replacement images in banners-by-* now without border
776 # - more effective shockwave flash flattening
777 # - Custom annoyance filtering for Yahoo Groups, Monster.com, NY Times.
779 # Revision 1.11.2.16 2003/05/08 09:44:56 oes
780 # Allow extra parameters in blink,marquee tags. Fixes bug #734012
782 # Revision 1.11.2.15 2003/03/30 13:57:08 oes
783 # Making unsolicited-popups safe for use on <html> tags enclosed in JS strings
785 # Revision 1.11.2.14 2003/03/19 13:17:50 oes
786 # - Added filter "site-specifics" to address site specific problems
787 # - Fixed a small problem in the img-reorder filter
789 # Revision 1.11.2.13 2003/03/18 19:28:59 oes
790 # Fixed a minor problem in the img-reorder filter
792 # Revision 1.11.2.12 2003/03/15 14:06:58 oes
793 # - Assorted refinements, optimizations and fixes in the js-annoyances,
794 # img-reorder, banners-by-size, banners-by-link, webbugs, refresh-tags,
795 # html-annoyances, content-cookies and fun filters
796 # - Replaced filter "popups" by choice between two modes:
797 # - "unsolicited-popups" tries to catch only the unsolicited ones
798 # - "all-popups" tries to kill them all (as before)
799 # - New filter "tiny-textforms" Help those tiny or hard-wrap textareas.
800 # - New filter "jumping-windows" that prevents windows from resizing
801 # and moving themselves
802 # - Replaced "nimda" with more general "ie-exploits" filter in which
803 # all filters for exploits shall be collected
805 # Revision 1.11.2.11 2002/11/12 16:14:43 oes
806 # Exchanged js-annoyance filter against status bar rewrites with improved version by Don Libes
808 # Revision 1.11.2.10 2002/11/11 13:39:47 oes
809 # Make refresh-tags filter work even on incorrect refresh tags like found on usatoday.com
811 # Revision 1.11.2.9 2002/11/08 16:39:17 oes
812 # Made img-reorder more cautious. Fixes bug #632715
814 # Revision 1.11.2.8 2002/10/13 21:56:52 hal9
815 # Adding demoronizer filter. This should include all the common abuses. I have
816 # left a few of the rare cases commented out (never found these in the wild).
818 # Revision 1.11.2.7 2002/09/25 15:09:39 oes
819 # Preserve original quoting style in <img> tags wherever possible. Fixes Bug #605956
821 # Revision 1.11.2.6 2002/08/23 14:12:26 oes
822 # Proofed frameset-borders against "fremaborder=0 border=0"
824 # Revision 1.11.2.5 2002/08/22 15:05:20 oes
825 # Added Filter to make Quicktime movies saveable (thanks to aaron@linville.org for the idea)
827 # Revision 1.11.2.4 2002/08/10 11:32:29 oes
828 # Attribute values in replacement tags of banners-by-size filter now undelimited. (Fixes bug #592493)
830 # Revision 1.11.2.3 2002/08/05 11:43:56 oes
831 # Fixed a bug in the popups filter that was introduced with the last fix :-(
833 # Revision 1.11.2.2 2002/08/01 11:20:13 oes
834 # Fixed bugs 587802, 577802 and an unreported one
836 # Revision 1.11.2.1 2002/07/26 15:18:26 oes
837 # - All filters reviewed and many shorcomings fixed
838 # - New filters: img-reorder, banners-by-link and js-events
839 # - Jobs reorderd because they are now executed in order of
842 # Revision 1.11 2002/05/24 00:57:18 oes
843 # Made WeBugs job ungreedy; Fixes bug 559190
845 # Revision 1.10 2002/04/18 10:14:19 oes
846 # renamed some filters
848 # Revision 1.9 2002/04/11 07:36:35 oes
849 # Generalized js-popup filter
851 # Revision 1.8 2002/04/10 17:07:21 oes
852 # Fixed potentially desctructive jobs, added noflash filter
854 # Revision 1.7 2002/04/09 18:34:51 oes
855 # Fixed HTML syntax in replacements
857 # Revision 1.6 2002/04/03 19:49:52 swa
860 # Revision 1.5 2002/03/27 15:30:26 swa
861 # have a consistent appearance
863 # Revision 1.4 2002/03/26 22:29:54 swa
864 # we have a new homepage!
866 # Revision 1.3 2002/03/24 16:08:03 jongfoster
867 # Fixing banners-by-size for new config URLs
869 # Revision 1.2 2002/03/24 13:02:18 swa
870 # name change related issues.
872 # Revision 1.1 2002/03/24 11:37:39 jongfoster
875 # Revision 1.24 2002/03/16 20:39:54 oes
876 # - Added descriptions to the filters so users will know what they select in the cgi editor
877 # - Added content-cookies filter
878 # - Bugfixed many jobs (Thanks to Al for some hints)
880 # Revision 1.22 2002/03/12 13:42:50 oes
881 # Fixing & Optimizing REs
883 # Revision 1.21 2002/03/12 11:59:20 oes
884 # Beefed up Buzzword Bingo
886 # Revision 1.20 2002/03/12 01:42:50 oes
887 # Introduced modular filters
889 # Revision 1.19 2002/03/10 19:49:24 oes
890 # Added expression to kill referer tracking in JavaScripts
892 # Revision 1.18 2002/03/08 17:14:12 oes
893 # PNG -> image in comments
895 # Revision 1.17 2002/03/07 03:50:54 oes
896 # Adapted comments to new built-in images
898 # Revision 1.16 2002/02/21 00:12:19 jongfoster
899 # Modifying the banner regexps to use long URLS and to autodetect
900 # whether to show a logo or a transparent GIF, based on actionsfile
903 # Revision 1.15 2001/12/28 23:54:20 steudten
904 # Fix for feature Req #495374: http-equiv problem
906 # Revision 1.14 2001/12/09 18:55:11 david__schmidt
907 # Updated CODE_STATUS to beta, commented out microsuck line in re_filterfile
910 # Revision 1.13 2001/10/13 13:11:20 joergs
911 # Fixed WebBug filter.
913 # Revision 1.12 2001/10/07 15:46:42 oes
914 # Followed Guy's proposal to change the document.cookie job
916 # Revision 1.11 2001/09/21 12:34:00 joergs
917 # Added filter to replace "Nimda" code by a warning.
919 # Revision 1.10 2001/07/20 11:04:26 oes
920 # Added Rodneys javascript cookie filter
922 # Revision 1.9 2001/07/13 14:03:48 oes
923 # Elimiated yet another bug in the banner-by-size jobs. Shame on me!
925 # Revision 1.8 2001/06/29 13:34:00 oes
926 # - Added explanation for U and T options
927 # - Added hint on image replacement by CGI call
928 # - Fixed bug in banner-by-size jobs
930 # Revision 1.7 2001/06/19 14:21:56 oes
931 # Fixed microsuck line
933 # Revision 1.6 2001/06/09 14:01:57 swa
934 # header. cosmetics. default: no messing ala microsuck.