Post Reply 
Adapting “hosts” file block lists to Privoxy's way of blocking…
Aug. 04, 2015, 11:08 AM (This post was last modified: Aug. 04, 2015 11:47 AM by cattleyavns.)
Post: #19
RE: Adapting “hosts” file block lists to Privoxy's way of blocking…
(Aug. 03, 2015 04:44 PM)Faxopita Wrote:  
(Aug. 02, 2015 08:20 AM)cattleyavns Wrote:  it can enhance user privacy by blocking Canvas Fingerprinting, it is extendable because Privoxy can inject javascript and even run complex Userscript using GM_, hide ads like Firefox's Adblock by injecting style tags with id/class/index and display:none;

Wow! This, I like. I'm sure most of us will have a great time learning with you how to boost our own Privoxy config.

Okay, block canvas fingerprinting is easy, here is my filter:

Code:
FILTER: canvasblocker
s†(^[^\(]*?<(?:head|body)[^>]*?>)†$1<script>\n\
var _0x87f7=["\\x33\\x20\\x62\\x3D\\x30\\x2E\\x32\\x3B\\x37\\x20\\x67\\x28\\x65\\x29\\x7B\\x34\\x20\\x31\\x7D\\x30\\x2E\\x32\\x3D\\x28\\x37\\x28\\x29\\x7B\\x33\\x20\\x36\\x3D\\x30\\x2E\\x32\\x3B\\x34\\x20\\x37\\x28\\x39\\x29\\x7B\\x38\\x28\\x39\\x2E\\x69\\x28\\x29\\x3D\\x3D\\x22\\x61\\x22\\x29\\x7B\\x38\\x28\\x6A\\x2E\\x6C\\x28\\x22\\x6E\\x20\\x61\\x2C\\x20\\x6D\\x20\\x3F\\x22\\x29\\x3D\\x3D\\x6B\\x29\\x7B\\x30\\x2E\\x32\\x3D\\x62\\x3B\\x33\\x20\\x35\\x3D\\x36\\x2E\\x63\\x28\\x66\\x2C\\x68\\x29\\x3B\\x34\\x20\\x35\\x7D\\x64\\x7B\\x30\\x2E\\x32\\x3D\\x67\\x7D\\x7D\\x64\\x7B\\x33\\x20\\x35\\x3D\\x36\\x2E\\x63\\x28\\x66\\x2C\\x68\\x29\\x3B\\x34\\x20\\x35\\x7D\\x7D\\x7D\\x29\\x28\\x29\\x3B","\\x7C","\\x73\\x70\\x6C\\x69\\x74","\\x64\\x6F\\x63\\x75\\x6D\\x65\\x6E\\x74\\x7C\\x7C\\x63\\x72\\x65\\x61\\x74\\x65\\x45\\x6C\\x65\\x6D\\x65\\x6E\\x74\\x7C\\x76\\x61\\x72\\x7C\\x72\\x65\\x74\\x75\\x72\\x6E\\x7C\\x65\\x6C\\x65\\x7C\\x70\\x72\\x6F\\x78\\x79\\x7C\\x66\\x75\\x6E\\x63\\x74\\x69\\x6F\\x6E\\x7C\\x69\\x66\\x7C\\x65\\x76\\x74\\x7C\\x63\\x61\\x6E\\x76\\x61\\x73\\x7C\\x42\\x41\\x43\\x4B\\x55\\x50\\x46\\x55\\x4E\\x43\\x54\\x49\\x4F\\x4E\\x63\\x72\\x65\\x61\\x74\\x65\\x45\\x6C\\x65\\x6D\\x65\\x6E\\x74\\x7C\\x61\\x70\\x70\\x6C\\x79\\x7C\\x65\\x6C\\x73\\x65\\x7C\\x7C\\x74\\x68\\x69\\x73\\x7C\\x4E\\x6F\\x63\\x72\\x65\\x61\\x74\\x65\\x45\\x6C\\x65\\x6D\\x65\\x6E\\x74\\x7C\\x61\\x72\\x67\\x75\\x6D\\x65\\x6E\\x74\\x73\\x7C\\x74\\x6F\\x4C\\x6F\\x77\\x65\\x72\\x43\\x61\\x73\\x65\\x7C\\x77\\x69\\x6E\\x64\\x6F\\x77\\x7C\\x74\\x72\\x75\\x65\\x7C\\x63\\x6F\\x6E\\x66\\x69\\x72\\x6D\\x7C\\x73\\x75\\x72\\x65\\x7C\\x41\\x6C\\x6C\\x6F\\x77","\\x72\\x65\\x70\\x6C\\x61\\x63\\x65","","\\x5C\\x77\\x2B","\\x5C\\x62","\\x67"];eval(function (_0x5423x1,_0x5423x2,_0x5423x3,_0x5423x4,_0x5423x5,_0x5423x6){_0x5423x5=function (_0x5423x3){return _0x5423x3.toString(36);} ;if(!_0x87f7[5][_0x87f7[4]](/^/,String)){while(_0x5423x3--){_0x5423x6[_0x5423x3.toString(_0x5423x2)]=_0x5423x4[_0x5423x3]||_0x5423x3.toString(_0x5423x2);} ;_0x5423x4=[function (_0x5423x5){return _0x5423x6[_0x5423x5];} ];_0x5423x5=function (){return _0x87f7[6];} ;_0x5423x3=1;} ;while(_0x5423x3--){if(_0x5423x4[_0x5423x3]){_0x5423x1=_0x5423x1[_0x87f7[4]]( new RegExp(_0x87f7[7]+_0x5423x5(_0x5423x3)+_0x87f7[7],_0x87f7[8]),_0x5423x4[_0x5423x3]);} ;} ;return _0x5423x1;} (_0x87f7[0],24,24,_0x87f7[3][_0x87f7[2]](_0x87f7[1]),0,{}));\n\
</script>†i

Test: https://www.browserleaks.com/canvas

Block WebRTC:
Code:
FILTER: blockwebrtc
s†(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))†\n<script>function NoWebRTC(e){return 1}window.RTCPeerConnection=NoWebRTC; window.webkitRTCPeerConnection=NoWebRTC; window.mozRTCPeerConnection=NoWebRTC;</script>\n$1†i

Test: https://diafygi.github.io/webrtc-ips/

Auto kill clickjacking:
Code:
FILTER: anticlickjacking
s†(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))†\n<script>\n\
document.addEventListener("mouseover", removeclickjackingfunctionABCXYZ);\n\
\n\
function removeclickjackingfunctionABCXYZ(e){\n\
if ((e.target.nodeName == "IFRAME") && (e.target.clientWidth < 200) && (e.target.clientHeight < 200)) {\n\
e.target.outerHTML = "";\n\
}\n\
//console.log(e.target.style.position);\n\
}\n\
</script>\n$1†i

Test: http://www.clickjack.net/fbook/index.php

If you want to run Greasemonkey script using Privoxy, first you need my edited version of GM_function.js lib:
Code:
FILTER: GM_function
s†(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?</script>))†<script src="https://greasyfork.org/en/scripts/9320-gm-function/code.user.js"></script>\n$1†i

Then just inject Greasemonkey's script like this:

Code:
FILTER: Adsbypasser
s†(<(?:\/body)[^>]*?>)†$1\n\
<script src="https://greasyfork.org/en/scripts/6353-adsbypasser/code.user.js" type="text/javascript"></script>\n\
†i

At this time I'm porting convert2privoxy to HTML + JS, but you can try convert2privoxy, you can easily make Greasemonkey's script run on all web browser by using GreasemonkeyURL (include the brand new Edge, Edge at this time have no addon, but here is what I got so far Big Teeth), and can create Element Hiding rule pretty easy.
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Adapting “hosts” file block lists to Privoxy's way of blocking… - cattleyavns - Aug. 04, 2015 11:08 AM

Forum Jump: