Add OS/2 build section
[privoxy.git] / default.filter
1 # ********************************************************************
2
3 #  File        :  $Source: /cvsroot/ijbswa/current/default.filter,v $
4
5 #  $Id: basic.action,v 1.3 2002/03/26 22:29:54 swa Exp $
6 #
7 #  Purpose     :  Rules to process the content of web pages
8
9 #  Copyright   :  Written by and Copyright
10 #                 Privoxy team. http://www.privoxy.org/
11 #
12 #                 Based on the Internet Junkbuster originally written
13 #                 by and Copyright (C) 1997 Anonymous Coders and
14 #                 Junkbusters Corporation.  http://www.junkbusters.com
15 #
16 # We value your feedback. However, to provide you with the best support,
17 # please note:
18 #  
19 #  * Use the support forum to get help:
20 #    http://sourceforge.net/tracker/?group_id=11118&atid=211118
21 #  * Submit bugs only thru our bug forum:
22 #    http://sourceforge.net/tracker/?group_id=11118&atid=111118 
23 #    Make sure that the bug has not already been submitted. Please try
24 #    to verify that it is a Junkbuster bug, and not a browser or site
25 #    bug first. If you are using your own custom configuration, please
26 #    try the stock configs to see if the problem is a configuration
27 #    related bug. And if not using the latest development snapshot,
28 #    please try the latest one. Or even better, CVS sources.
29 #  * Submit feature requests only thru our feature request forum:
30 #    http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse
31 #      
32 # For any other issues, feel free to use the mailing lists:
33 # http://sourceforge.net/mail/?group_id=11118
34 #    
35 # Anyone interested in actively participating in development and related
36 # discussions can join the appropriate mailing list here:
37 # http://sourceforge.net/mail/?group_id=11118. Archives are available
38 # here too.
39
40 #################################################################################
41 #
42 # Syntax:
43 #
44 # Filters start with a line "FILTER: name description". They are then referrable
45 # from the actionsfile with +filter{name}
46 #
47 # Inside the filters, write one Perl-Style substitution (job) per line.
48 # Jobs that precede the first FILTER: line are ignored.
49 #
50 # For Details see the pcrs manpage contained in this distribution.
51 # (and the perlre, perlop and pcre manpages)
52 #
53 # Note that you are free to choose the delimter as you see fit.
54 #
55 # Note2: In addidion to the Perl options gimsx, the following nonstandard
56 # options are supported:
57
58 # 'U' turns the default to ungreedy matching.  Add ? to quantifiers to
59 #     switch back to greedy.
60 # 'T' (trivial) prevents parsing for backreferences in the substitute.
61 #     Use if you want to include text like '$&' in your substitute without
62 #     quoting.
63
64 #################################################################################
65
66
67 #################################################################################
68 #
69 # html-annoyances: Get rid of particularly annoying HTML abuse
70 #
71 #################################################################################
72 FILTER: html-annoyances Get rid of particularly annoying HTML abuse
73
74 # New browser windows (if allowed -- see no-popups filter below) should be
75 # resizeable and have a location and status bar
76 #
77 s/(<a\s+href[^>]+)resizable=['"]?(no|0|false)['"]?(.*>)/$1resizable=1$3/igU 
78 s/(<a\s+href[^>]+)location=['"]?(no|0)['"]?(.*>)/$1location=1$3/igU 
79 s/(<a\s+href[^>]+)status=['"]?(no|0)['"]?(.*>)/$1status=1$3/igU
80 s/(<a\s+href[^>]+)scrolling=['"]?(no|0|auto)['"]?(.*>)/$1scrolling=no$3/igU
81 s/(<a\s+href[^>]+)menubar=['"]?(no|0)['"]?(.*>)/$1menubar=1$3/igU
82
83 # The <BLINK> tag was a crime!
84 #
85 s*<blink>|</blink>**ig
86
87 # Is this evil? 
88 #
89 #s/margin(height|width)=[0-9]*//gi
90 #s/noresize/yesresize/igU
91
92
93 #################################################################################
94 #
95 # js-annoyances: Get rid of particularly annoying JavaScript abuse
96 #
97 #################################################################################
98 FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse
99
100 # Get rid of Javascript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm
101 #
102 s|(<script.*)document\.referrer(.*</script>)|$1"Not Your Business!"$2|Usg
103
104 # The status bar is for displaying link targets, not pointless blahblah
105 #
106 s/status='.*?';*//ig
107
108 # Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
109 #
110 s/(<body .*)onunload(.*>)/$1never$2/iU
111
112
113 #################################################################################
114 #
115 # content-cookies: Kill cookies that come in the HTML or JS content
116 #
117 #################################################################################
118 FILTER: content-cookies Kill cookies that come in the HTML or JS content
119
120 # JS cookies, like found on privacy.net:
121 #
122 s|(document\.cookie)([ \t\r\n]*=)|documenZapCooky$2|g
123
124 # HTML cookies:
125 #
126 s|<meta\s+http-equiv=['"]?set-cookie['"]?\s+content=[^>].*>|<!--no cookies here -->|iUT  
127
128
129 ##################################################################################
130 #
131 # no-popups: Kill all popups in JS and HTML
132 #
133 #################################################################################
134 FILTER: no-popups Kill all popups in JS and HTML
135
136 s/window\.open\(/1;''\.concat\(/ig           # JavaScript
137 s/target=['"]?_blank['"]?/target_crunched/ig # HTML
138 s/target=['"]?_new['"]?/target_crunched/ig   # HTML
139
140 #################################################################################
141 #
142 # frameset-borders: Give frames a border and make them resizable
143 #
144 #################################################################################
145 FILTER: frameset-borders Give frames a border and make them resizable
146
147 s/(<frameset [^>]+)framespacing=['"]?(no|0)['"]?(.*>)/$1$3/igU
148 s/(<frameset [^>]+)frameborder=['"]?(no|0)['"]?(.*>)/$1$3/igU
149 s/(<frame [^>]+)border=['"]?(no|0)['"]?(.*>)/$1$3/igU
150 s/(<frame [^>]+)resizable=['"]?(no|0|false)['"]?(.*>)/$1$3/igU 
151
152 #################################################################################
153 #
154 # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
155 #
156 #################################################################################
157 FILTER: webbugs Squish WebBugs (1x1 invisible GIFs used for user tracking)
158
159 s/<img\s+[^>]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1(\D[^>]*?)?>/<!-- Squished WebBug -->/sig
160
161
162 #################################################################################
163 #
164 # no-refresh: Kill automatic refresh tags (for dial-on-demand setups)
165 #
166 #################################################################################
167 FILTER: no-refresh Kill automatic refresh tags (for dial-on-demand setups)
168
169 s/<meta\s+http-equiv=['"]?refresh['"]?\s+content=['"]?[0-9]*;\s+url=([^>]*)['"]?>/<link rev="x-refresh" href=$1>/iU   
170 s/<meta\s+http-equiv=['"]?page-enter['"]?\s+content=[^>].*>/<!--no page enter for me-->/iU 
171
172
173 #################################################################################
174 #
175 # fun: Text replacements for subversive browsing fun!
176 #
177 #################################################################################
178 FILTER: fun Text replacements for subversive browsing fun!
179
180 s/microsoft(?!.com)/MicroSuck/ig
181
182 # Buzzword Bingo (example for extended syntax)
183 #
184 s* industry[ -]leading \
185 |  cutting[ -]edge \
186 |  award[ -]winning # Comments are OK, too! \
187 |  high[ -]performance \
188 |  solutions[ -]based \
189 |  unmatched \
190 |  unparalleled \
191 |  unrivalled \
192 *<font color=red><b>BINGO!</b></font> \
193 *igx
194
195
196 #################################################################################
197 #
198 # nimda: Remove Nimda (virus) code
199 #
200 #################################################################################
201 FILTER: nimda Remove Nimda (virus) code
202
203 s%<script language="JavaScript">(window\.open|1;''\.concat)\("readme\.eml", null, "resizable=no,top=6000,left=6000"\)</script>%<br><hr><font size=7><b>Internet J</b></font><b><font size=6>UNK</font><font size=5 color="red"><i>BUSTER</i></font></b><font size=7> WARNING: This Server is infected with <a href="http://www.cert.org/advisories/CA-2001-26.html">Nimda</a>!</font>%g
204
205
206 #################################################################################
207 #
208 # banners-by-size: Kill banners by size
209 #
210 #################################################################################
211 #
212 # Standard banner sizes taken from http://www.iab.net/iab_banner_standards/bannersizes.html
213 #
214 # Note: Use http://config.privoxy.org/send-banner?type=trans for a transparent 1x1 image
215 #       Use http://config.privoxy.org/send-banner?type=pattern for a grey/white pattern image
216 #       Use http://config.privoxy.org/send-banner?type=auto  to auto-select.
217 #
218 #################################################################################
219 FILTER: banners-by-size Kill banners by size
220
221 s|<img\s+[^>]*?(width=['"]?468\D)[^>]*(height=['"]?60[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
222 s|<img\s+[^>]*?(width=['"]?234\D)[^>]*(height=['"]?60[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
223 s|<img\s+[^>]*?(width=['"]?88\D)[^>]*(height=['"]?31[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
224 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?90[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
225 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?600[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
226 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?60[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
227 s|<img\s+[^>]*?(width=['"]?160\D)[^>]*(height=['"]?600[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
228 s|<img\s+[^>]*?(width=['"]?125\D)[^>]*(height=['"]?125[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
229 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?240[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
230 s|<img\s+[^>]*?(width=['"]?180\D)[^>]*(height=['"]?150[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
231 s|<img\s+[^>]*?(width=['"]?300\D)[^>]*(height=['"]?250[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
232 s|<img\s+[^>]*?(width=['"]?250\D)[^>]*(height=['"]?250[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
233 s|<img\s+[^>]*?(width=['"]?240\D)[^>]*(height=['"]?400[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
234 s|<img\s+[^>]*?(width=['"]?336\D)[^>]*(height=['"]?280[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
235
236 # One more. (Where is 200x50 from?)
237 #
238 s|<img\s+[^>]*?(width=['"]?200\D)[^>]*(height=['"]?50[^>]*?)>|<img src=http://config.privoxy.org/send-banner?type=auto $1 $2>|sig
239
240
241 #################################################################################
242 #
243 # crude-parental: Crude parental filtering?  (Use along with a suitable blocklist).
244 #                 Shows how to deny access to whole page based on a keyword.
245 #
246 #################################################################################
247 #
248 # (Note: Middlesex, Sussex and Essex are counties in the UK, not rude words)
249 # (Note #2: Is 'sex' a rude word?!)
250 #
251 #################################################################################
252 FILTER: crude-parental Crude parental filtering (demo only)
253
254 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
255 s+^.*warez.*$+<html><head><title>No Warez</title></head><body><h3>You're not searching for illegal stuff, are you?</h3></body></html>+is
256
257 ############################################################################## 
258 #
259 #  Revisions   :
260 #     $Log: default.filter,v $
261 #     Revision 1.4  2002/03/26 22:29:54  swa
262 #     we have a new homepage!
263 #
264 #     Revision 1.3  2002/03/24 16:08:03  jongfoster
265 #     Fixing banners-by-size for new config URLs
266 #
267 #     Revision 1.2  2002/03/24 13:02:18  swa
268 #     name change related issues.
269 #
270 #     Revision 1.1  2002/03/24 11:37:39  jongfoster
271 #     Name change
272 #
273 #     Revision 1.24  2002/03/16 20:39:54  oes
274 #      - Added descriptions to the filters so users will know what they select in the cgi editor
275 #      - Added content-cookies filter
276 #      - Bugfixed many jobs (Thanks to Al for some hints)
277 #
278 #     Revision 1.22  2002/03/12 13:42:50  oes
279 #     Fixing & Optimizing REs
280 #
281 #     Revision 1.21  2002/03/12 11:59:20  oes
282 #     Beefed up Buzzword Bingo
283 #
284 #     Revision 1.20  2002/03/12 01:42:50  oes
285 #     Introduced modular filters
286 #
287 #     Revision 1.19  2002/03/10 19:49:24  oes
288 #     Added expression to kill referer tracking in JavaScripts
289 #
290 #     Revision 1.18  2002/03/08 17:14:12  oes
291 #     PNG -> image in comments
292 #
293 #     Revision 1.17  2002/03/07 03:50:54  oes
294 #     Adapted comments to new built-in images
295 #
296 #     Revision 1.16  2002/02/21 00:12:19  jongfoster
297 #     Modifying the banner regexps to use long URLS and to autodetect
298 #     whether to show a logo or a transparent GIF, based on actionsfile
299 #     setting.
300 #
301 #     Revision 1.15  2001/12/28 23:54:20  steudten
302 #     Fix for feature Req #495374: http-equiv problem
303 #
304 #     Revision 1.14  2001/12/09 18:55:11  david__schmidt
305 #     Updated CODE_STATUS to beta, commented out microsuck line in re_filterfile
306 #     for 2.9.10 beta
307 #
308 #     Revision 1.13  2001/10/13 13:11:20  joergs
309 #     Fixed WebBug filter.
310 #
311 #     Revision 1.12  2001/10/07 15:46:42  oes
312 #     Followed Guy's proposal to change the document.cookie job
313 #
314 #     Revision 1.11  2001/09/21 12:34:00  joergs
315 #     Added filter to replace "Nimda" code by a warning.
316 #
317 #     Revision 1.10  2001/07/20 11:04:26  oes
318 #     Added Rodneys javascript cookie filter
319 #
320 #     Revision 1.9  2001/07/13 14:03:48  oes
321 #     Elimiated yet another bug in the banner-by-size jobs. Shame on me!
322 #
323 #     Revision 1.8  2001/06/29 13:34:00  oes
324 #     - Added explanation for U and T options
325 #     - Added hint on image replacement by CGI call
326 #     - Fixed bug in banner-by-size jobs
327 #
328 #     Revision 1.7  2001/06/19 14:21:56  oes
329 #     Fixed microsuck line
330 #
331 #     Revision 1.6  2001/06/09 14:01:57  swa
332 #     header. cosmetics. default: no messing ala microsuck.
333 #
334 #
335