<?xml version="1.0" encoding="UTF-8" ?> 
<safesquid>
<rewrite>
        <enabled>true</enabled>
        <rewrite>
            <enabled>true</enabled>
            <comment>Change referer to make page appear as if it were reloaded</comment>
            <profiles>mask-referrer</profiles>
            <mime></mime>
            <pattern>^(GET|POST)\shttp://([^/]*)([^\s]*)(.*)^Referer:\shttp://([^/]*\.\.|)[^\n]*(.*)</pattern>
            <replace>$1 http://$2$3$4Referer: http://$5$2$3$6</replace>
            <which>,client,,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Change link URL to linked text if linked text is a URL</comment>
            <profiles>linked-urls</profiles>
            <mime>text/html</mime>
            <pattern>&lt;a([^&gt;]+)href\s*=\s*(&quot;|&apos;)[^&gt;]+(&quot;|&apos;)([^&gt;]*)&gt;\s*(http|ftp)://([^\[\s]+)\s*&lt;/a&gt;</pattern>
            <replace>&lt;a$1href=$2$5://$6$3$4&gt;$5://$6&lt;/a&gt;</replace>
            <which>body</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>remove 0x0 and 1x1 images (webbugs) - this screws up rendering of alot of pages, use with caution</comment>
            <profiles>anti-webbug</profiles>
            <mime>text/html</mime>
            <pattern>&lt;img\s+[^&gt;]*?(width|height)\s*=\s*[&apos;&quot;]?(1|0)\D[^&gt;]*?(width|height)\s*=\s*[&apos;&quot;]?(0|1)(\D[^&gt;]*?)?&gt;</pattern>
            <replace></replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>show link location along with custom label in statusbar</comment>
            <profiles>statusbar-link</profiles>
            <mime>(text/html|application/x-javascript)</mime>
            <pattern>(([\n =;{}]|window\.)(default)?status\s*=)</pattern>
            <replace>$1this.href + &apos; label: &apos; +</replace>
            <which>body</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>prevent scripts from seeing referrer</comment>
            <profiles>mask-referrer</profiles>
            <mime>text/html</mime>
            <pattern>(&lt;script.*)document\.referrer(.*&lt;/script&gt;)</pattern>
            <replace>$1&quot;nevermind&quot;$2</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>prevent javascript&apos;s from seeing referrer</comment>
            <profiles>mask-referrer</profiles>
            <mime>application/x-javascript</mime>
            <pattern>document\.referrer</pattern>
            <replace>&quot;nevermind&quot;</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>ensure new windows are resizable</comment>
            <profiles>anti-window-altering</profiles>
            <mime>text/html</mime>
            <pattern>(&lt;a\s+href[^&gt;]+)resizable=[&apos;&quot;]?(no|0|false)[&apos;&quot;]?(.*&gt;)</pattern>
            <replace>$1resizable=&quot;1&quot;$3</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>ensure new windows have a location</comment>
            <profiles>anti-window-altering</profiles>
            <mime>text/html</mime>
            <pattern>(&lt;a\s+href[^&gt;]+)location=[&apos;&quot;]?(no|0)[&apos;&quot;]?(.*&gt;)</pattern>
            <replace>$1location=&quot;1&quot;$3</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>ensure new windows have a menubar</comment>
            <profiles>anti-window-altering</profiles>
            <mime>text/html</mime>
            <pattern>(&lt;a\s+href[^&gt;]+)menubar=[&apos;&quot;]?(no|0)[&apos;&quot;]?(.*&gt;)</pattern>
            <replace>$1menubar=&quot;1&quot;$3</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>ensure new windows have a status bar</comment>
            <profiles>anti-window-altering</profiles>
            <mime>text/html</mime>
            <pattern>(&lt;a\s+href[^&gt;]+)status=[&apos;&quot;]?(no|0)[&apos;&quot;]?(.*&gt;)</pattern>
            <replace>$1status=&quot;1&quot;$3</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>ensure new windows have a scrollbar</comment>
            <profiles>anti-window-altering</profiles>
            <mime>text/html</mime>
            <pattern>(&lt;a\s+href[^&gt;]+)scrolling=[&apos;&quot;]?(no|0|auto)[&apos;&quot;]?(.*&gt;)</pattern>
            <replace>$1scrolling=&quot;no&quot;$3</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Block unrequested popups (1 of 3)</comment>
            <profiles>anti-popup</profiles>
            <mime>text/html</mime>
            <pattern>&lt;body[^&gt;]*&gt;</pattern>
            <replace>$0 &lt;script&gt; function AntiPopup(a, b, c) { return(null); } &lt;/script&gt;</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Block unrequested popups (2 of 3)</comment>
            <profiles>anti-popup</profiles>
            <mime>(text/html|application/x-javascript)</mime>
            <pattern>([\n;{}()=]\s*)(window|this|parent)\.open\(</pattern>
            <replace>$1AntiPopup(</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
	    <enabled>true</enabled>
	    <comment>Block unrequested popups (2 .1 of 3)</comment>
	    <profiles>anti-popup</profiles>
	    <mime>(text/html|application/x-javascript)</mime>
	    <pattern>([\n;{}()=]\s*)(window|this|parent)\.open\(|openBadPopUp() </pattern>
	    <replace>$1AntiPopup(</replace>
	    <which>body</which>
	</rewrite>
	<rewrite>
	    <enabled>true</enabled>
	    <comment>Block unrequested popups (2 .2 of 3)</comment>
	    <profiles>anti-popup</profiles>
	    <mime>(text/html|application/x-javascript)</mime>
	    <pattern>([\n;{}()=]\s*)(window|this|parent)\.open\(|openBadPopUnder() </pattern>
	    <replace>$1AntiPopup(</replace>
	    <which>body</which>
	</rewrite>
	<rewrite>
	     <enabled>true</enabled>
	     <comment>Block unrequested popups (2 .3 of 3)</comment>
	     <profiles>anti-popup</profiles>
	     <mime>(text/html|application/x-javascript)</mime>
	     <pattern>([\n;{}()=]\s*)(window|this|parent)\.open\(|window.sidebar.addPanel </pattern>
	     <replace>$1AntiPopup(</replace>
	     <which>body</which>
	 </rewrite>
	 <rewrite>
	      <enabled>true</enabled>
	      <comment>Block unrequested popups (2 .4of 3)</comment>
	      <profiles>anti-popup</profiles>
	      <mime>(text/html|application/x-javascript)</mime>
	      <pattern>([\n;{}()=]\s*)(window|this|parent)\.open\(|window.external.AddDesktopComponent </pattern>
	      <replace>$1AntiPopup(</replace>
	      <which>body</which>
	 </rewrite>
	 <rewrite>
	 	<enabled>true</enabled>
	 	<comment>Block unrequested popups (2 .5of 3)</comment>
	 	<profiles>anti-popup</profiles>
	 	<mime>(text/html|application/x-javascript)</mime>
	 	<pattern>([\n;{}()=]\s*)(window|this|parent)\.open\(|this.setHomePage </pattern>
	        <replace>$1AntiPopup(</replace>
	        <which>body</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Block unrequested popups (3 of 3)</comment>
            <profiles>anti-popup</profiles>
            <mime>text/html</mime>
            <pattern>&lt;/body&gt;</pattern>
            <replace>&lt;script&gt; function AntiPopup(a, b, c) { return(window.open(a, b, c)); } &lt;/script&gt; $0</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Mask useragent in javascript</comment>
            <profiles>mask-useragent-javascript</profiles>
            <mime>(text/html|application/x-javascript)</mime>
            <pattern>([\n;{}()=]\s*)navigator.userAgent</pattern>
            <replace>$1&quot;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)&quot;</replace>
            <which>body</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Remove non-standard &lt;blink&gt; tags</comment>
            <profiles>non-standard-html</profiles>
            <mime>text/html</mime>
            <pattern>&lt;blink&gt;(.*)&lt;/blink&gt;</pattern>
            <replace>$1</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Remove non-standard &lt;marquee&gt; tags</comment>
            <profiles>non-standard-html</profiles>
            <mime>text/html</mime>
            <pattern>&lt;marquee[^&gt;]*&gt;(.*)&lt;/marquee&gt;</pattern>
            <replace>$1</replace>
            <which>,,body,</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Workaround for a bug in apache 1.3</comment>
            <profiles>apache-targz-workaround</profiles>
            <mime></mime>
            <pattern>^Content-Encoding:[^\n]*</pattern>
            <replace></replace>
            <which>server</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Profile for disabling submit button from html Pages Turn on this profile from &quot;profiles section&quot; by making that profile true</comment>
            <profiles>disable-button</profiles>
            <mime>text/html</mime>
            <pattern>(&lt;input.*)type=&quot;submit&quot;\s value=.* \s class=.*&gt;</pattern>
            <replace>$1</replace>
            <which>body</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment>Block ActiveX controls ; turn on this profile from &quot;profiles section&quot; by making that profile true</comment>
            <profiles>BlockActiveX</profiles>
            <mime>text/html</mime>
            <pattern>&lt;object[^&gt;]*&gt;(.*)&lt;/object&gt;</pattern>
            <replace>&lt;b&gt;Safesquid restricting active x download&lt;/b&gt;</replace>
            <which>body</which>
        </rewrite>
        <rewrite>
            <enabled>true</enabled>
            <comment></comment>
            <profiles>BlockJavaScript</profiles>
            <mime>text/html</mime>
            <pattern>&lt;APPLET[^&gt;]*&gt;(.*)&lt;/APPLET&gt;</pattern>
            <replace>&lt;b&gt;Safesquid restricting JAVA SCRIPTS&lt;/b&gt;</replace>
            <which>body</which>
        </rewrite>
    </rewrite>
</safesquid>

