1 # ********************************************************************
3 # File : $Source: /cvsroot/ijbswa/current/default.filter,v $
5 # $Id: default.filter,v 1.39 2007/02/21 14:10:23 fabiankeil Exp $
7 # Purpose : Rules to process the content of web pages
9 # Copyright : Written by and Copyright (C) 2001 - 2007 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*((['"]).*?\4)@$1$2 =\
86 (typeof(this.href) != 'undefined')?($3 + ' URL: ' + this.href):($2)@ig
88 s/(?:(?:this|window)\.(?:default)?status)\s*=\s*\w*\s*;//ig
90 # Kill OnUnload popups. Yummy.
91 # Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
93 s/(<body\s+[^>]*)onunload/$1never/siU
94 s|(<script.*)window\.onunload(?=.*</script>)|$1never|sigU
96 # If we allow window.open, we want normal window features:
97 # Test: http://www.htmlgoodies.com/beyond/notitle.html
99 s/(open\s*\([^\)]+resizable=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
100 s/(open\s*\([^\)]+location=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
101 s/(open\s*\([^\)]+status=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
102 s/(open\s*\([^\)]+scroll(?:ing|bars)=)(["']?)(?:no|0)\2/$1$2auto$2/sigU
103 s/(open\s*\([^\)]+menubar=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
104 s/(open\s*\([^\)]+toolbar=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
105 s/(open\s*\([^\)]+directories=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
106 s/(open\s*\([^\)]+fullscreen=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
107 s/(open\s*\([^\)]+always(?:raised|lowered)=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
108 s/(open\s*\([^\)]+z-?lock=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
109 s/(open\s*\([^\)]+hotkeys=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
110 s/(open\s*\([^\)]+titlebar=)(["']?)(?:no|0)\2/$1$2yes$2/sigU
111 s/(open\s*\([^\)]+always(?:raised|lowered)=)(["']?)(?:yes|1)\2/$1$2no$2/sigU
114 #################################################################################
116 # js-events: Kill all JS event bindings and timers (Radically destructive! Only for extra nasty sites)
118 #################################################################################
119 FILTER: js-events Kill all JS event bindings and timers (Radically destructive! Only for extra nasty sites)
121 s/(on|event\.)((mouse(over|out|down|up|move))|(un)?load|contextmenu|selectstart)/never/ig
122 # Not events, but abused on the same type of sites:
123 s/(alert|confirm)\s*\(/concat(/ig
124 s/settimeout\(/concat(/ig
126 #################################################################################
128 # html-annoyances: Get rid of particularly annoying HTML abuse
130 #################################################################################
131 FILTER: html-annoyances Get rid of particularly annoying HTML abuse
133 # New browser windows (if allowed -- see no-popups filter below) should be
134 # resizeable and have a location and status bar
136 s/(<a\s+href[^>]+resizable=)(['"]?)(?:no|0)\2/$1$2yes$2/igU
137 s/(<a\s+href[^>]+location=)(['"]?)(?:no|0)\2/$1$2yes$2/igU
138 s/(<a\s+href[^>]+status=)(['"]?)(?:no|0)\2/$1$2yes1$2/igU
139 s/(<a\s+href[^>]+scrolling=)(['"]?)(?:no|0)\2/$1$2auto$2/igU
140 s/(<a\s+href[^>]+menubar=)(['"]?)(?:no|0)\2/$1$2yes$2/igU
142 # The <BLINK> and <MARQUEE> tags were crimes!
144 s-</?(blink|marquee).*>--sigU
147 #################################################################################
149 # content-cookies: Kill cookies that come in the HTML or JS content
151 #################################################################################
152 FILTER: content-cookies Kill cookies that come in the HTML or JS content
154 # JS cookies, except those used by antiadbuster.com to detect us:
156 s|(\w+\.)+cookie(?=[ \t\r\n]*=)(?!='aab)|ZappedCookie|ig
160 s|<meta\s+http-equiv=['"]?set-cookie.*>|<!-- ZappedCookie -->|igU
163 #################################################################################
165 # refresh-tags: Kill automatic refresh tags (for dial-on-demand setups)
167 #################################################################################
168 FILTER: refresh-tags Kill automatic refresh tags (for dial-on-demand setups)
170 # Note: Only deactivates refreshes with more than 9 seconds delay to
171 # preserve monster-stupid but common redirections via meta tags.
173 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
176 #################################################################################
178 # unsolicited-popups: Disable unsolicited pop-up windows
180 #################################################################################
181 FILTER: unsolicited-popups Disable only unsolicited pop-up windows
183 s+([^'"]\s*<head.*>)(?=\s*[^'"])+$1<script>function PrivoxyWindowOpen(){return(null);}</script>+isU
184 s@([^\w\s.]\s*)((?:map)?(window|this|parent)\.?)?open\s*\(@$1PrivoxyWindowOpen(@ig
185 s+([^'"]\s*</html>)(?!\s*(\\n|'|"))+$1<script>function PrivoxyWindowOpen(a, b, c){return(window.open(a, b, c));}</script>+iU
188 ##################################################################################
190 # all-popups: Kill all popups in JavaScript and HTML
192 #################################################################################
193 FILTER: all-popups Kill all popups in JavaScript and HTML
195 s@((\W\s*)(?:map)?(window|this|parent)\.?)open\s*\\?\(@$1concat(@ig # JavaScript
196 s/\starget\s*=\s*(['"]?)_?(blank|new)\1?/ notarget/ig # HTML
199 ##################################################################################
201 # img-reorder: Reorder attributes in <img> tags to make the banners-by-* filters more effective
203 #################################################################################
204 FILTER: img-reorder Reorder attributes in <img> tags to make the banners-by-* filters more effective
206 # In the first step src is moved to the start, then width is moved to the second
207 # place to guarantee an order of src, width, height.
208 # This makes banners-by-size more effective and allows both banners-by-size
209 # and banners-by-link to preserve the original image URL in the title attribute.
211 s|<img\s+?([^>]*) src\s*=\s*(['"])([^>\\\2]+)\2|<img src=$2$3$2 $1|siUg
212 s|<img\s+?([^>]*) src\s*=\s*([^'">\\\s]+)|<img src=$2 $1|sig
214 s|<img (src=(?:(['"])[^>\\\\2]*\2\|[^'">\\\s]+?))([^>]*)\s+width\s*=\s*(["']?)(\d+?)\4|<img $1 width=$4$5$4$3|siUg
217 #################################################################################
219 # banners-by-size: Kill banners by size
221 #################################################################################
223 # Standard banner sizes taken from http://www.iab.net/iab_banner_standards/bannersizes.html
225 # Note: Use http://config.privoxy.org/send-banner?type=trans for a transparent 1x1 image
226 # Use http://config.privoxy.org/send-banner?type=pattern for a grey/white pattern image
227 # Use http://config.privoxy.org/send-banner?type=auto to auto-select.
229 # Note2: Use img-reorder before this filter to ensure maximum matching success
231 #################################################################################
232 FILTER: banners-by-size Kill banners by size
235 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)88\4)[^>]*?(height=(['"]?)31\6)[^>]*?(?=/?>)@\
236 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
237 # 120*60, 120*90, 120*240, 120*600
238 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)120\4)[^>]*?(height=(['"]?)(?:600?|90|240)\6)[^>]*?(?=/?>)@\
239 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
241 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)125\4)[^>]*?(height=(['"]?)125\6)[^>]*?(?=/?>)@\
242 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
244 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)160\4)[^>]*?(height=(['"]?)600\6)[^>]*?(?=/?>)@\
245 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
247 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)180\4)[^>]*?(height=(['"]?)150\6)[^>]*?(?=/?>)@\
248 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
249 # 234*60, 468*60 (Most Banners!)
250 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)(?:234|468)\4)[^>]*?(height=(['"]?)60\6)[^>]*?(?=/?>)@\
251 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
253 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)240\4)[^>]*?(height=(['"]?)400\6)[^>]*?(?=/?>)@\
254 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
256 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)(?:250|300)\4)[^>]*?(height=(['"]?)250\6)[^>]*?(?=/?>)@\
257 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
259 s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)336\4)[^>]*?(height=(['"]?)280\6)[^>]*?(?=/?>)@\
260 <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
262 # Note: 200*50 was also proposed, but it probably causes too much collateral damage:
264 #s@<img\s+(?:src\s*=\s*(['"]?)([^>\\\1\s]+)\1)?[^>]*?(width=(['"]?)200\4)[^>]*?(height=(['"]?)50\6)[^>]*?(?=/?>)@\
265 # <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-$2-by-size" $3 $5@sig
268 #################################################################################
270 # banners-by-link: Kill banners by their links to known clicktrackers (Experimental)
272 #################################################################################
273 FILTER: banners-by-link Kill banners by their links to known clicktrackers
275 # Common case with width and height attributes:
277 s@<a\s+href\s*=\s*(['"]?)([^>\1\s]*?(?:\
278 adclick # See www.dn.se \
279 | advert # see dict.leo.org \
280 | atwola\.com/(?:link|redir) # see www.cnn.com \
281 | /jump/ # redirs for doublecklick.net ads \
282 | tracker | counter # common \
283 | adlog\.pl # see sf.net \
284 )[^>\1\s]*)\1[^>]*>\s*<img\s+(?:src\s*=\s*(['"]?)([^>\\\3\s]+)\3)?[^>]*((?:width|height)\s*=\s*(['"]?)\d+?\6)[^>]*((?:width|height)\s*=\s*(['"]?)\d+?\8)[^>]*?(?=/?>)\
285 @<img $5 $7 src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed $4 by link to $2"@sigx
287 # Rare case w/o explicit dimensions:
289 s@<a\s+href\s*=\s*(['"]?)([^>\1\s]*?(?:ad(?:click|vert)|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="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed $4 by link to $2"@sig
292 ################################################################################
294 # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
296 #################################################################################
297 FILTER: webbugs Squish WebBugs (1x1 invisible GIFs used for user tracking)
299 s@<img[^>]*\s(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*\s(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*?>@@siUg
302 #################################################################################
304 # tiny-textforms: Extend those tiny textareas up to 40x80 and kill the hard wrap
306 #################################################################################
307 FILTER: tiny-textforms Extend those tiny textareas up to 40x80 and kill the hard wrap
309 s/(<textarea[^>]*?)(?:\s*(?:rows|cols)=(['"]?)\d+\2)+/$1 rows=$2\40$2 cols=$2\80$2/ig
310 s/(<textarea[^>]*?)wrap=(['"]?)hard\2/$1/ig
313 #################################################################################
315 # jumping-windows: Prevent windows from resizing and moving themselves
317 #################################################################################
318 FILTER: jumping-windows Prevent windows from resizing and moving themselves
320 s/(?<=[\W])(?:window|this|self)\.(?:move|resize)(?:to|by)\(/''.concat(/ig
322 #################################################################################
324 # frameset-borders: Give frames a border, make them resizable and scrollable
326 #################################################################################
327 FILTER: frameset-borders Give frames a border and make them resizable
329 s/(<frameset\s+[^>]*)framespacing=(['"]?)(no|0)\2/$1/igU
330 s/(<frameset\s+[^>]*)frameborder=(['"]?)(no|0)\2/$1/igU
331 s/(<frameset\s+[^>]*)border=(['"]?)(no|0)\2/$1/igU
332 s/(<frame\s+[^>]*)noresize/$1/igU
333 s/(<frame\s+[^>]*)frameborder=(['"]?)(no|0)\2/$1/igU
334 s/(<frame\s+[^>]*)scrolling=(['"]?)(no|0)\2/$1/igU
338 #################################################################################
340 # demoronizer: Correct Microsoft's abuse of standardized character sets, which
341 # leave the browser to (mis)-interpret unknown characters, with
342 # sometimes bizarre results on non-MS platforms.
344 # credit: ripped from the demoroniser.pl script by:
345 # John Walker -- January 1998, http://www.fourmilab.ch/webtools/demoroniser
347 #################################################################################
348 FILTER: demoronizer Fix MS's non-standard use of standard charsets
350 s/(&\#[0-2]\d\d)\s/$1; /g
351 # per Robert Lynch: http://slate.msn.com//?id=2067547, just a guess.
352 # Must come before x94 below.
353 s/\xE2\x80\x94/ -- /g
365 # Bullet type character.
369 #s-\x98-<sup>~</sup>-g
370 #s-\x99-<sup>TM</sup>-g
375 #################################################################################
377 # shockwave-flash: Kill embedded Shockwave Flash objects
378 # Note: Better just block "/.*\.swf$"!
380 #################################################################################
381 FILTER: shockwave-flash Kill embedded Shockwave Flash objects
383 s|<object [^>]*macromedia.*</object>|<!-- Squished Shockwave Object -->|sigU
384 s|<embed [^>]*(application/x-shockwave-flash\|\.swf).*>(.*</embed>)?|<!-- Squished Shockwave Flash Embed -->|sigU
387 #################################################################################
389 # quicktime-kioskmode: Make Quicktime movies saveable
391 #################################################################################
392 FILTER: quicktime-kioskmode Make Quicktime movies saveable
394 s/(<embed\s+[^>]*)kioskmode\s*=\s*(["']?)true\2/$1/ig
397 #################################################################################
399 # fun: Text replacements for subversive browsing fun!
401 #################################################################################
402 FILTER: fun Text replacements for subversive browsing fun!
406 s/microsoft(?!.[^\s])/MicroSuck/ig
408 # Buzzword Bingo (example for extended regex syntax)
410 s* (?:industry|world)[ -]leading \
412 | customer[ -]focused \
414 | award[ -]winning # Comments are OK, too! \
415 | high[ -]performance \
416 | solutions[ -]based \
420 *$0<sup><font color="red"><b>Bingo!</b></font></sup> \
425 s/(M|m)edien(?![^<]*>)/$1ädchen/Ug
427 #################################################################################
429 # crude-parental: Crude parental filtering. Use with a suitable blocklist.
430 # Pages are "blocked" based on keyword matching.
432 #################################################################################
433 FILTER: crude-parental Crude parental filtering
435 # (Note: Middlesex, Sussex and Essex are counties in the UK, not rude words)
436 # (Note #2: Is 'sex' a rude word?!)
438 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
440 s+^.*warez.*$+<html><head><title>No Warez</title></head><body><h3>You're not searching for illegal stuff, are you?</h3></body></html>+is
442 # Remove by description
444 (suck |lick |tounge |rub |fuck |fingering |finger |chicks? )?\
445 (her |your |my |hard |with |big |wet |tight |pink |hot |moist |young |teen )+\
446 (dicks?|penis|cocks?|balls?|tits?|pussy|cunt|clit|ass|mouth).*$\
447 /This page has been blocked by Privoxy's crude-parental content filter\
452 (download|broadband|view|watch|free|get|extreem)? \
453 (sex|xxx|porn|cumshot|fuck(ing|s)?|anal|ass|asian|adult|Amateur|org(y|ies)|close ups?|hand ? job|nail(ed)?)+ \
454 (movies?|pics?|videos?|dvds?|dvd's|links?).*$\
455 /This page has been blocked by Privoxy's crude-parental content filter\
458 #Remove by age disclaimer
460 (models?|chicks?|girls?|women|persons) \
461 (who|are|were)+ (over|at least) (16|18|21) years (old|of age).*$\
462 /This page has been blocked by Privoxy's crude-parental content filter\
465 #Remove by regulations
466 s/^.*(Section 2257|18 U.?S.?C.? 2257).*$\
467 /This page has been blocked by Privoxy's crude-parental content filter\
471 #################################################################################
473 # IE-Exploits: Disable some known Internet Explorer bug exploits
475 #################################################################################
476 FILTER: ie-exploits Disable some known Internet Explorer bug exploits
478 # Note: This is basically a demo and waits for someone more interested in IE
479 # security (sic!) to take over.
481 # Cross-site-scripting:
483 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
485 # Address bar spoofing (http://www.secunia.com/advisories/10395/):
487 s/(<a[^>]*href[^>]*)(?:\x01|\x02|\x03|%0[012])@/$1MALICIOUS-LINK@/ig
491 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
494 #################################################################################
497 # site-specifics: Cure for site-specific problems. Don't apply generally!
499 # Note: The fixes contained here are so specific to the problems of the
500 # particular web sites they are designed for that they would be a
501 # waste of CPU cycles (or even destructive!) on 99.9% of the web
502 # sites where they don't apply.
504 #################################################################################
505 FILTER: site-specifics Cure for site-specific problems. Don't apply generally!
507 # www.spiegel.de excludes X11 users from viewing Flash5 objects - shame.
508 # Apply to: www.spiegel.de/static/js/flash-plugin.js
510 s/indexOf\("x11"\)/indexOf("x13")/
512 # www.quelle-bausparkasse.de uses a very stupid redirect mechanism that
513 # relies on a webbug being present. Can we tolerate that? No!
514 # Apply to: www.quelle-bausparkasse.de/$
518 # groups.yahoo.com has splash pages that one needs to click through in
519 # order to access the actual messages. Let the browser do that. Thanks
520 # to Paul Jobson for this one:
522 s|<a href="(.+?)">(?:Continue to message\|Weiter zu Nachricht)</a>|<meta http-equiv="refresh" content="0; URL=$1">|ig
524 # monster.com has two very similar gimmicks:
526 s|<input type="hidden" name="REDIRECT" value="(.+?)">|<meta http-equiv="refresh" content="0; URL=$1">|i
528 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
530 # nytimes.com triggers popups through the onload handler of dummy images
531 # to fool popup-blockers.
533 s|(<img [^>]*)onload|$1never|sig
535 # Pre-check all the "Discard" buttons in GNU Mailman's web interface.
536 # (This saves a lot of mouse aiming practice when flushing spamtraps)
538 s|(<INPUT name="\d{2,4}" type="RADIO" value="0") CHECKED |$1|g
539 s|<INPUT name="\d{2,4}" type="RADIO" value="3" |$0 checked|g
541 #################################################################################
543 # no-ping: Removes non-standard ping attributes in <a> and <area> tags.
545 #################################################################################
546 FILTER: no-ping Removes non-standard ping attributes in <a> and <area> tags.
547 s@(<a(?:rea)?[^>]*?)\sping=(['"]?)([^"'>]+)\2([>\s]?)@\
548 <strong style="color:white; background-color:red;" title="Privoxy removed ping target '$3'">PING!</strong>\n$1$4@ig
550 #################################################################################
552 # google: CSS-based block for Google text ads. Also removes
553 # a width limitation and the toolbar advertisement.
555 #################################################################################
556 FILTER: google CSS-based block for Google text ads. Also removes a width limitation and the toolbar advertisement.
557 s@</head>@<style type="text/css">\n\
558 /* Style sheet inserted by Privoxy's google filter. */\n\
559 \#fbc, \#fbl, \#ra, .rhh {visibility: hidden !important;}\n\
560 \#tpa1,\#tpa2,\#tpa3,\#tpa4,\#tpa5,\#tpa5, \#spl, .ch, \#ads,\
561 \#toolbar, \#google_ads_frame, \#mbEnd {display: none !important;}\n\
562 .main_body, .j {width: 100%}\n</style>\n$0@
563 s@<div style=\"padding-top:11px;min-width:500px\">@<div id="main_body">@
564 s@(<table cellspacing=0 cellpadding=0 width=25% align=right bgcolor=\#ffffff border=0\
565 |</font></td></tr></tbody></table><table align=\"right\" bgcolor=\"\#ffffff\"\
566 |<table cellspacing=0 cellpadding=0 align=right bgcolor=\#ffffff border=0\
567 |<table style=\"clear:both\" align=right width=25% cellspacing=\"0\" cellpadding=\"0\"\
568 border=\"0\" bgcolor=\"\#ffffff\")@$0 id="ads"@
569 s@(<br clear=all><table)( border=0 cellpadding=9><tr><td)@$1 id="toolbar"$2@
571 #################################################################################
573 # yahoo: CSS-based block for Yahoo text ads. Also removes a width limitation.
575 #################################################################################
576 FILTER: yahoo CSS-based block for Yahoo text ads. Also removes a width limitation.
577 s@</head>@\n<style type="text/css">\n\
578 /* Style sheet inserted by Privoxy's yahoo filter. */\n\
579 \#symadbn, \#ymadbn, .yschbox, \#yschsec, .yschhd, \#yschanswr, .yschftad,\
580 .yschspn, .yschspns, \#ygrp-sponsored-links {display: none !important;}\n\
581 \#yschpri, \#yschweb {width: 100% !important; max-width: 100% !important;}\n\
582 \#yschqcon, \#yschtg {width: auto !important; /* No useless horizontal scrollbar please */}\n\
585 #################################################################################
587 # msn: CSS-based block for MSN text ads. Also removes tracking URLs
588 # and a width limitation.
590 #################################################################################
591 FILTER: msn CSS-based block for MSN text ads. Also removes tracking URLs and a width limitation.
592 s@</head>@<style type="text/css">\n\
593 /* Style sheet inserted by Privoxy's msn filter. */\n\
594 .msn_ads {display: none !important;}\n\
595 \#results, .flank, .results_area_flank, .results_area_stroke, .SearchSection .not\
596 {width: 99% /*!important*/; min-width: 99% !important;\
597 max-width: 100% !important; /* width:100% sometimes causes horizontal scrollbars */}\n\
598 /* Make continue links harder to miss */\n\
599 \#pagination_bottom a {padding: .3em .5em .3em .5em; border: 1px solid \#e6e6e6;}\n\
600 \#pagination_bottom li, \#pagination_bottom li .selected, li .nextPage \
601 {margin: 0 !important; cursor: auto; border: none; padding:.1em;}\n\
602 \#pagination_bottom li .prevPage {padding-right: 1.5em !important;}\n\
603 \#pagination_bottom li .selected {border: none;}\n\
604 .selected a {background-color: \#d2eaf6; border: 1px solid \#b7d8ee;}\n\
605 /* Remove "suggestions". They are next to worthless but partly overlap with the search results */\n\
606 .suggestion, \#nys_right {clear: both; display:none;}\n\
608 s@(<div[^>]*) id=(["']?)ads_[^\2]*\2@$1 class="msn_ads"@Uig
609 s@(<a[^>]*href=\")http://g.msn.com/.*\?(http://.*)(&&DI=.*)(\")@$1$2$4@Ug
610 s@(<a[^>]*)gping=\".*\"@$1 title="URL cleaned up by Privoxy's msn filter"@Ug
612 #################################################################################
614 # blogspot: Cleans up some Blogspot blogs. Read the fine print before using this.
616 # This filter also intentionally removes some navigation stuff and
617 # sets the page width to 100%. As a result, some rounded "corners" would
618 # appear to early or not at all and as fixing this would require a browser
619 # that understands background-size (CSS3), they are removed instead.
621 #################################################################################
622 FILTER: blogspot Cleans up some Blogspot blogs. Read the fine print before using this.
623 s@</head>@<style type="text/css">\n\
624 /* Style sheet inserted by Privoxy's blogspot filter. */\n\
625 \#powered-by {display: none !important;}\n\
626 \#wrap4, \#wrapper {margin-top: 0px }\n\
627 \#blogheader, \#header {margin-top: 0.5em !important}\n\
628 \#content {width: 98% }\n\
629 \#main {width: 70% }\n\
630 \#sidebar {width: 29% }\n\
631 .post-body {overflow: auto;}\n\
632 .blogComments {width: 100%; overflow: auto;}\n</style>\n$0@
633 s@<body.*(?:<div id="space-for-ie"></div>|(<div id="(?:content|wrap4|wrapper)))@<body>\
634 <!-- Privoxy's blogspot filter ditched some garbage here -->$1@Us
635 s@(<div style=\"[^\"]*width:)30em@$1 100%@
636 s@background:url\(\"http://www.blogblog.com/rounders[^\"]*\"\).*;@/*$0*/@Ug
637 s@(background:\#[a-f\d]{3})( url\(\"http://www.blogblog.com/rounders[^\"]*\"\).*;)@$1 ;/*$2*/@Ug
639 #################################################################################
641 # x-httpd-php-to-html: Changes the Content-Type header from
642 # x-httpd-php to html. "Content-Type: x-httpd-php"
643 # is set by clueless PHP users and causes many
644 # browsers do open a download menu instead of
645 # rendering the page.
647 #################################################################################
648 SERVER-HEADER-FILTER: x-httpd-php-to-html Changes the Content-Type header from x-httpd-php to html.
649 s@^(Content-Type:) application/x-httpd-php@$1 text/html@
651 #################################################################################
653 # html-to-xml: Changes the Content-Type header from html to xml.
655 #################################################################################
656 SERVER-HEADER-FILTER: html-to-xml Changes the Content-Type header from html to xml.
657 s@^(Content-Type:) text/html(;.*)?$@$1 application/xhtml+xml$2@
659 #################################################################################
661 # xml-to-html: Changes the Content-Type header from xml to html.
663 #################################################################################
664 SERVER-HEADER-FILTER: xml-to-html Changes the Content-Type header from xml to html.
665 s@^(Content-Type:) (?:application|text)/(?:xhtml\+)?xml(;.*)?$@$1 text/html$2@
667 #################################################################################
669 # hide-tor-exit-notation: Remove the Tor exit node notation in Host and Referer headers.
671 # Note: If Privoxy and Tor are chained and Privoxy is configured to
672 # use socks4a, one can use http://www.example.org.foobar.exit/
673 # to access the host www.example.org through Tor exit node foobar.
675 # As the HTTP client isn't aware of this notation, it treats the
676 # whole string "www.example.org.foobar.exit" as host and uses it
677 # for the "Host" and "Referer" headers. From the server's point of
678 # view the resulting headers are invalid and can cause problems.
680 # An invalid "Referer" header can trigger "hot-linking" protections,
681 # an invalid "Host" header will make it impossible for the server to
682 # find the right vhost (several domains hosted on the same IP address).
684 # This filter removes the "foo.exit" part in those headers
685 # to prevent the mentioned problems. Note that it only modifies
686 # the HTTP headers, it doesn't make it impossible for the server
687 # to detect your Tor exit node based on the IP address the request is
690 #################################################################################
691 CLIENT-HEADER-FILTER: hide-tor-exit-notation Removes the Tor exit node notation in Host and Referer headers.
692 s@^((?:Referer|Host):\s*(?:https?://)?[^/]*)\.[^\./]*?\.exit@$1@i
695 ##############################################################################
698 # $Log: default.filter,v $
699 # Revision 1.39 2007/02/21 14:10:23 fabiankeil
700 # - Fix a js-annoyances pcrs command that broke
701 # evaluated code. (BR #1124071, thanks to Bor Gergely)
702 # - Have unsolicited-popups and all-popups catch the
703 # wheather.com popup reported in in AF #1640173.
705 # Revision 1.38 2007/02/19 11:22:48 hal9
706 # Adding back the orginal filter content to offset problems found by Fabian.
708 # Revision 1.37 2007/02/17 13:29:44 hal9
709 # Updates to the crude parental filter per Feature Requests item #1648657.
711 # Revision 1.36 2007/02/05 16:47:31 fabiankeil
712 # - Let banners-by-link look for "advert".
713 # - Fix XML systax problems with banners-by-link
714 # and banners-by-size (AF#1651570).
716 # Revision 1.35 2006/12/21 12:28:12 fabiankeil
717 # Escaping special characters in filter descriptions is no
718 # longer necessary, it's done by Privoxy now.
720 # Revision 1.34 2006/12/12 17:32:23 fabiankeil
721 # Added id mbEnd to google filter, it's now and then
722 # used for the sponsored links.
724 # Have js-annoyances try to prevent status bar
725 # modifications where the status bar text is
726 # inside another variable. Fixes 1605710.
728 # Revision 1.33 2006/11/16 17:10:43 fabiankeil
729 # Removed webbugs debugging comment again.
730 # The apostrophe could break JavaScript and
731 # the comment itself could mess up existing
734 # Revision 1.32 2006/11/10 18:04:04 fabiankeil
735 # Have no-ping print the ping warning in red.
737 # Modified yahoo to keep in sync with recent
738 # CSS changes and to suppress a useless horizontal
741 # msn now makes sure that the continue-link boxes
742 # act as links (the original CSS just changes the cursor).
744 # Changed fun filter regex to leave microsoft links alone.
747 # Revision 1.31 2006/10/21 13:12:28 fabiankeil
748 # Added no-ping and hide-tor-exit-notation.
750 # Adjusted jumping-windows to break less.
753 # Revision 1.30 2006/10/18 12:36:50 fabiankeil
754 # google filter now cleans Google groups as well.
756 # Revision 1.29 2006/10/11 14:03:17 fabiankeil
757 # Changed img-reorder regex to only move width
758 # attributes if they are following at least one
759 # whitespace. Fixes BR 1328455.
761 # Revision 1.28 2006/10/11 13:31:13 fabiankeil
762 # Added Anduin Withers' js-annoyances fix
763 # for not messing up escaped quotes. Fixes BR 999765.
765 # Improved blogspot filter to make it less likely that
766 # the blogspot banner at the top of the page is missed.
768 # Revision 1.27 2006/10/08 17:00:51 fabiankeil
769 # Modified webbugs filter to create a comment around the offending
770 # image instead of removing it entirely.
772 # Adjusted regex to only match if there's at least one whitespace
773 # before the width and height attributes. Makes it more likely that
774 # they are indeed attributes, and not part of the value of another attribute.
777 # Thanks to Martin Thomas for diagnosing the cause of the problem.
779 # Revision 1.26 2006/10/06 18:06:16 fabiankeil
780 # Added header filter x-httpd-php-to-html
781 # and reverted another img-reorder whitespace
784 # Revision 1.25 2006/10/06 15:26:09 fabiankeil
785 # Bumped copyright year.
787 # Reverted parts of the last img-reorder change
788 # which were intended to remove superfluous whitespace
789 # but had the side effect to mess up some tags.
791 # Modified banners-by-size and banners-by-link to
792 # use border value "0" instead of "\0". Fixes BR 1100065.
794 # Revision 1.24 2006/10/06 11:25:31 fabiankeil
795 # Taught img-reorder not to break img tags
796 # with empty src attributes. Fixes BR 1089474.
797 # Thanks to Raphael Moll for reporting.
799 # Revision 1.23 2006/10/05 14:46:28 fabiankeil
800 # Replaced "<" in img-reorder's description with "<".
802 # Modified msn filter to tag ads with classes instead
803 # of ids. There may be more than one ad per page,
804 # but ids are required to be unique.
806 # Revision 1.22 2006/10/04 19:17:14 fabiankeil
807 # Incorportated Frédéric Crozat's ie-exploits
808 # modification to make it less trigger-happy.
810 # Modified blogspot filter to make .post-body
811 # scrollable if necessary.
813 # Revision 1.21 2006/10/02 16:21:14 fabiankeil
814 # Adjusted yahoo filter to hide .yschspns as well.
815 # Added header filters: html-to-xml and xml-to-html.
817 # Revision 1.20 2006/10/01 21:00:22 fabiankeil
818 # New site-specific filters: google, yahoo, msn and blogspot.
820 # Revision 1.19 2006/07/18 14:48:45 david__schmidt
821 # Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
822 # with what was really the latest development (the v_3_0_branch branch)
824 # Revision 1.11.2.23 2004/02/17 13:34:01 oes
825 # - Beefed up the protection of the unsolicited-popups
826 # filter against matching in JavaScript string constants.
827 # - Extended the fun filter with a German joke
828 # - Extended the site-specifics filter with a convenience
829 # reeplacement for managing mailing lists at SourceForge
831 # Revision 1.11.2.22 2004/01/30 15:29:29 oes
832 # Updated the copyright note
834 # Revision 1.11.2.21 2004/01/20 15:15:01 oes
835 # Detail enhancement in all-popups
837 # Revision 1.11.2.20 2004/01/06 16:46:14 oes
838 # Fixed a JS syntax problem in jumping-windows
840 # Revision 1.11.2.19 2003/12/17 17:09:25 oes
841 # Added remedy against IE address bar spoofing
843 # Revision 1.11.2.18 2003/12/02 11:25:27 oes
844 # Fixed a line trashed in previous commit
846 # Revision 1.11.2.17 2003/12/01 21:58:46 oes
849 # - unsolicited-popups no longer matches at start or end of quoted
850 # strings, and is now activated earlier and deactivated later in
852 # - replacement images in banners-by-* now without border
853 # - more effective shockwave flash flattening
854 # - Custom annoyance filtering for Yahoo Groups, Monster.com, NY Times.
856 # Revision 1.11.2.16 2003/05/08 09:44:56 oes
857 # Allow extra parameters in blink,marquee tags. Fixes bug #734012
859 # Revision 1.11.2.15 2003/03/30 13:57:08 oes
860 # Making unsolicited-popups safe for use on <html> tags enclosed in JS strings
862 # Revision 1.11.2.14 2003/03/19 13:17:50 oes
863 # - Added filter "site-specifics" to address site specific problems
864 # - Fixed a small problem in the img-reorder filter
866 # Revision 1.11.2.13 2003/03/18 19:28:59 oes
867 # Fixed a minor problem in the img-reorder filter
869 # Revision 1.11.2.12 2003/03/15 14:06:58 oes
870 # - Assorted refinements, optimizations and fixes in the js-annoyances,
871 # img-reorder, banners-by-size, banners-by-link, webbugs, refresh-tags,
872 # html-annoyances, content-cookies and fun filters
873 # - Replaced filter "popups" by choice between two modes:
874 # - "unsolicited-popups" tries to catch only the unsolicited ones
875 # - "all-popups" tries to kill them all (as before)
876 # - New filter "tiny-textforms" Help those tiny or hard-wrap textareas.
877 # - New filter "jumping-windows" that prevents windows from resizing
878 # and moving themselves
879 # - Replaced "nimda" with more general "ie-exploits" filter in which
880 # all filters for exploits shall be collected
882 # Revision 1.11.2.11 2002/11/12 16:14:43 oes
883 # Exchanged js-annoyance filter against status bar rewrites with improved version by Don Libes
885 # Revision 1.11.2.10 2002/11/11 13:39:47 oes
886 # Make refresh-tags filter work even on incorrect refresh tags like found on usatoday.com
888 # Revision 1.11.2.9 2002/11/08 16:39:17 oes
889 # Made img-reorder more cautious. Fixes bug #632715
891 # Revision 1.11.2.8 2002/10/13 21:56:52 hal9
892 # Adding demoronizer filter. This should include all the common abuses. I have
893 # left a few of the rare cases commented out (never found these in the wild).
895 # Revision 1.11.2.7 2002/09/25 15:09:39 oes
896 # Preserve original quoting style in <img> tags wherever possible. Fixes Bug #605956
898 # Revision 1.11.2.6 2002/08/23 14:12:26 oes
899 # Proofed frameset-borders against "fremaborder=0 border=0"
901 # Revision 1.11.2.5 2002/08/22 15:05:20 oes
902 # Added Filter to make Quicktime movies saveable (thanks to aaron@linville.org for the idea)
904 # Revision 1.11.2.4 2002/08/10 11:32:29 oes
905 # Attribute values in replacement tags of banners-by-size filter now undelimited. (Fixes bug #592493)
907 # Revision 1.11.2.3 2002/08/05 11:43:56 oes
908 # Fixed a bug in the popups filter that was introduced with the last fix :-(
910 # Revision 1.11.2.2 2002/08/01 11:20:13 oes
911 # Fixed bugs 587802, 577802 and an unreported one
913 # Revision 1.11.2.1 2002/07/26 15:18:26 oes
914 # - All filters reviewed and many shorcomings fixed
915 # - New filters: img-reorder, banners-by-link and js-events
916 # - Jobs reorderd because they are now executed in order of
919 # Revision 1.11 2002/05/24 00:57:18 oes
920 # Made WeBugs job ungreedy; Fixes bug 559190
922 # Revision 1.10 2002/04/18 10:14:19 oes
923 # renamed some filters
925 # Revision 1.9 2002/04/11 07:36:35 oes
926 # Generalized js-popup filter
928 # Revision 1.8 2002/04/10 17:07:21 oes
929 # Fixed potentially desctructive jobs, added noflash filter
931 # Revision 1.7 2002/04/09 18:34:51 oes
932 # Fixed HTML syntax in replacements
934 # Revision 1.6 2002/04/03 19:49:52 swa
937 # Revision 1.5 2002/03/27 15:30:26 swa
938 # have a consistent appearance
940 # Revision 1.4 2002/03/26 22:29:54 swa
941 # we have a new homepage!
943 # Revision 1.3 2002/03/24 16:08:03 jongfoster
944 # Fixing banners-by-size for new config URLs
946 # Revision 1.2 2002/03/24 13:02:18 swa
947 # name change related issues.
949 # Revision 1.1 2002/03/24 11:37:39 jongfoster
952 # Revision 1.24 2002/03/16 20:39:54 oes
953 # - Added descriptions to the filters so users will know what they select in the cgi editor
954 # - Added content-cookies filter
955 # - Bugfixed many jobs (Thanks to Al for some hints)
957 # Revision 1.22 2002/03/12 13:42:50 oes
958 # Fixing & Optimizing REs
960 # Revision 1.21 2002/03/12 11:59:20 oes
961 # Beefed up Buzzword Bingo
963 # Revision 1.20 2002/03/12 01:42:50 oes
964 # Introduced modular filters
966 # Revision 1.19 2002/03/10 19:49:24 oes
967 # Added expression to kill referer tracking in JavaScripts
969 # Revision 1.18 2002/03/08 17:14:12 oes
970 # PNG -> image in comments
972 # Revision 1.17 2002/03/07 03:50:54 oes
973 # Adapted comments to new built-in images
975 # Revision 1.16 2002/02/21 00:12:19 jongfoster
976 # Modifying the banner regexps to use long URLS and to autodetect
977 # whether to show a logo or a transparent GIF, based on actionsfile
980 # Revision 1.15 2001/12/28 23:54:20 steudten
981 # Fix for feature Req #495374: http-equiv problem
983 # Revision 1.14 2001/12/09 18:55:11 david__schmidt
984 # Updated CODE_STATUS to beta, commented out microsuck line in re_filterfile
987 # Revision 1.13 2001/10/13 13:11:20 joergs
988 # Fixed WebBug filter.
990 # Revision 1.12 2001/10/07 15:46:42 oes
991 # Followed Guy's proposal to change the document.cookie job
993 # Revision 1.11 2001/09/21 12:34:00 joergs
994 # Added filter to replace "Nimda" code by a warning.
996 # Revision 1.10 2001/07/20 11:04:26 oes
997 # Added Rodneys javascript cookie filter
999 # Revision 1.9 2001/07/13 14:03:48 oes
1000 # Elimiated yet another bug in the banner-by-size jobs. Shame on me!
1002 # Revision 1.8 2001/06/29 13:34:00 oes
1003 # - Added explanation for U and T options
1004 # - Added hint on image replacement by CGI call
1005 # - Fixed bug in banner-by-size jobs
1007 # Revision 1.7 2001/06/19 14:21:56 oes
1008 # Fixed microsuck line
1010 # Revision 1.6 2001/06/09 14:01:57 swa
1011 # header. cosmetics. default: no messing ala microsuck.