Post Reply 
Something like “decentraleyes” for Privoxy…
Jan. 01, 2017, 12:56 PM (This post was last modified: Mar. 31, 2017 02:33 PM by Faxopita.)
Post: #1
Something like “decentraleyes” for Privoxy…
To roughly mimic “decentraleyes” Firefox add-on…

More info here or there.

Quote:Decentraleyes is a new open source Firefox add-on that aims to improve your privacy while browsing. It does this by hosting CND resources locally. When your browser makes a request for one of these CDN resources, the request is blocked and you are served up a local version instead.

Quote:Can CDNs track me even though they do not place tracking cookies?
Absolutely. Requests to content delivery networks contain a "Referer" HTTP header (originally a misspelling of referrer) that reveals what page you're visiting. Techniques like IP address tracking and browser fingerprinting can then be used to determine your identity.
GitHub/Synzvato/decentraleyes

This rule allows Privoxy to use local versions instead:
Code:
{ +redirect{s@^(https?://)?[^,%]+\b(angular|backbone|dojo|ember|ext.core|jquery.ui|jquery|modernizr.min|mootools-yui-compressed|prototype|scriptaculous|swfobject|underscore.min)\b[^/]*\.js[^,%]*@http://localhost/~Your_Path_to/CommonJS/$2.js@} }
   .aspnetcdn.com
   .baidu.com
   .cloudflare.com
   .googleapis.com/(.(?!1\.7\.1/))*$ # Example: with an exception; use remote version 1.7.1 instead: ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
   .jquery.com
   .jsdelivr.net
   .microsoft.com
   .sinaapp.com
   .upaiyun.com
   .yandex.st
   .yastatic.net

Put it in `user.action` file.

Instead of using `?!`, the above exception could be equally rewritten like this:
Code:
{ -redirect }
   .googleapis.com/.+/1\.7\.1/

Useful for some websites requiring a specific resource version.

If you encounter an issue while visiting a website, the following alias can help you isolate it:
Code:
JSRoute='egrep "Redirect:\s+pcrs.*changed" /private/var/log/privoxy/logfile.log | \
         sed -r "s/[a-z0-9]+\s+Redirect:[^\"]+\"[^\"]+\"\s+changed\s+/\n/g; s/\s(to)\s/ changed \1…\n/g"| tail -45'

Example of outputs:
Code:
2016-09-05 11:12:07.640
"http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.min.js" changed to…
"http://localhost/~Your_Path_to/CommonJS/angular.js" (1 hit).
2016-09-05 11:12:07.923
"http://code.jquery.com/ui/1.11.2/jquery-ui.min.js" changed to…
"http://localhost/~Your_Path_to/CommonJS/jquery-ui.js" (1 hit).

Note: do update your libraries regularly… Mad with Teeth

Some stats.
After one week of surfing…
Code:
Libraries | Request # | JS Sizes
__________|___________|_________
jquery    |    306    x 259.3 KB =  79,345.8 KB
jquery-ui |    156    x 508.5 KB =  79,326   KB
prototype |      7    x 195.1 KB =   1,365.7 KB
angular   |    117    x 144.6 KB =  16,918.2 KB

Total          586               = 176,955.7 KB ≈ 173 MB

173 MB's worth of third-party resources that didn't get downloaded over just one week.


Attached File(s)
.zip  CommonJS.zip (Size: 700.68 KB / Downloads: 80)
Add Thank You Quote this message in a reply
[-] The following 2 users say Thank You to Faxopita for this post:
cattleyavns, kik0s
Jan. 05, 2017, 08:30 AM (This post was last modified: Jan. 05, 2017 12:24 PM by cattleyavns.)
Post: #2
RE: Something like “decentraleyes” for Privoxy…
Thank you for this very useful tutorial, just one thing I would like to share is, config.privoxy.org/user-manual/ can be used to serve local content, support HTTPS if you open ProxHTTPSProxy's config.ini, find the line with "[SSL No-Verify]" and add:

Code:
config.privoxy.org

And you can access https://config.privoxy.org.
Privoxy have a hidden feature is "user-manual" folder can be used as webserver.

An example:
Code:
FILTER:gmfunc
    s†(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?<\/script>))†$1\n\
    <script src="http://config.privoxy.org/user-manual/GM_function.js"></script>\n\
    †i

{+filter{gmfunc}}
/
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to cattleyavns for this post:
kik0s
Jan. 05, 2017, 12:36 PM (This post was last modified: Jan. 05, 2017 05:38 PM by Faxopita.)
Post: #3
RE: Something like “decentraleyes” for Privoxy…
(Jan. 05, 2017 08:30 AM)cattleyavns Wrote:  Privoxy have a hidden feature is "user-manual" folder can be used as webserver.

Very good to know indeed! In my case, it's much simpler to use your tip than carrying out the many steps to enable MacOS' local web server…

Thanks.
Add Thank You Quote this message in a reply
Jan. 14, 2017, 11:48 PM (This post was last modified: Jan. 15, 2017 01:27 PM by kik0s.)
Post: #4
RE: Something like “decentraleyes” for Privoxy…
(Jan. 05, 2017 08:30 AM)cattleyavns Wrote:  Thank you for this very useful tutorial, just one thing I would like to share is, config.privoxy.org/user-manual/ can be used to serve local content, support HTTPS if you open ProxHTTPSProxy's config.ini, find the line with "[SSL No-Verify]" and add:

Code:
config.privoxy.org

And you can access https://config.privoxy.org.
Privoxy have a hidden feature is "user-manual" folder can be used as webserver.

An example:
Code:
FILTER:gmfunc
    s†(^[^;]*?(?:<head[^>]*?>|<body[^>]*?>|<script[^>]*?>[^>]*?<\/script>))†$1\n\
    <script src="http://config.privoxy.org/user-manual/GM_function.js"></script>\n\
    †i

{+filter{gmfunc}}
/

so i can put the GM file their instead of using greasyfork? but why are you saying it here? Smile! does your gm thing does the same what faxtopia showed in the first post?

now i got what you meant with the webserver stuff.

@faxtopia so i can use that commonJS file for every site?! why is it always the same?
Add Thank You Quote this message in a reply
Jan. 15, 2017, 03:00 PM (This post was last modified: Jan. 15, 2017 05:30 PM by cattleyavns.)
Post: #5
RE: Something like “decentraleyes” for Privoxy…
(Jan. 14, 2017 11:48 PM)kik0s Wrote:  so i can put the GM file their instead of using greasyfork? but why are you saying it here? Smile! does your gm thing does the same what faxtopia showed in the first post?

now i got what you meant with the webserver stuff.

@faxtopia so i can use that commonJS file for every site?! why is it always the same?

I think that time I put greasefork.org link for my GM_function to make sure that the script "can" run on HTTPS site ( the greasefork one is HTTPS ), but a few months from that time, I found out that I can use config.privoxy.org as not only a webserver, but it can work as a HTTPS webserver.

Normally if I use http://config.privoxy.org/user-manual/GM_function.js and try to open Youtube.com, web browser will block GM_function, the reason is, Youtube is HTTPS, the js file is HTTP, HTTPS will block all HTTP (see Mixed Content)

All thank to ProxHTTPSProxy, the above problem is solved.

And I also want to share another filter, this filter will disable Content-Security-Policy on all website, will prevent websites from blocking our local content.
Code:
SERVER-HEADER-FILTER: removecontentsecuritypolicy

s@content-security.*@@i

The better way is we can parse Content-Security-Policy and add our local webserver's domain to it, but it is hard for me, but I think someone can do that.
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to cattleyavns for this post:
Faxopita
Jan. 16, 2017, 01:02 PM (This post was last modified: Jan. 17, 2017 12:22 PM by Faxopita.)
Post: #6
RE: Something like “decentraleyes” for Privoxy…
(Jan. 14, 2017 11:48 PM)kik0s Wrote:  @faxtopia so i can use that commonJS file for every site?! why is it always the same?

CommonJS is a folder that contains most common used libraries. Privoxy will query the corresponding local versions—inside folder CommonJS—to the remote ones. Web pages will load faster.


If you are not inclined to enable your local web server…

You can copy the content of CommonJS folder to…
Code:
/usr/local/share/doc/privoxy/user-manual/

-–—
I tried copying the folder CommonJS itself, but Privoxy does not, for example, allow access to…
Code:
https://config.privoxy.org/user-manual/CommonJS/angular.js

It doesn't like the folder CommonJS in-between… Banging Head
—–-

Then, you can replace…
Code:
http://localhost/~Your_Path_to/CommonJS/$2.js
by…
Code:
https://config.privoxy.org/user-manual/$2.js
in the redirect action.

As an example, you can access angular.js by typing
Code:
https://config.privoxy.org/user-manual/angular.js

Notes:
  1. I suggest you update the libraries once in a while… A bit tedious, but with a small script it is feasible…
  2. If you upgrade Privoxy, be sure to backup your changes, since folder user-manual will likely be overwritten.
Add Thank You Quote this message in a reply
[-] The following 2 users say Thank You to Faxopita for this post:
cattleyavns, kik0s
Jan. 16, 2017, 02:58 PM
Post: #7
RE: Something like “decentraleyes” for Privoxy…
@faxtopia looks like the internal webserver is only using one folder. i will check the source if their is a limitation of somekind. so putting the files directly into user-manual should wirk?
Add Thank You Quote this message in a reply
Jan. 16, 2017, 03:19 PM (This post was last modified: Jan. 17, 2017 12:30 PM by Faxopita.)
Post: #8
RE: Something like “decentraleyes” for Privoxy…
(Jan. 16, 2017 02:58 PM)kik0s Wrote:  @faxtopia looks like the internal webserver is only using one folder. i will check the source if their is a limitation of somekind. so putting the files directly into user-manual should wirk?

Just tested. I confirm it works.

Make sure you replace
Code:
http://localhost/~Your_Path_to/CommonJS/$2.js
by
Code:
https://config.privoxy.org/user-manual/$2.js
in { +redirect{…} }

Example with angular:
Code:
2017-01-16 15:20:55.539
"http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.min.js" changed to…
"https://config.privoxy.org/user-manual/angular.js" (1 hit).
Add Thank You Quote this message in a reply
[-] The following 2 users say Thank You to Faxopita for this post:
kik0s, cattleyavns
Sep. 02, 2017, 07:57 AM
Post: #9
RE: Something like “decentraleyes” for Privoxy…
Files that are redirected, such as specially made?
Add Thank You Quote this message in a reply
Sep. 02, 2017, 09:23 AM (This post was last modified: Sep. 02, 2017 09:31 AM by vlad_s.)
Post: #10
RE: Something like “decentraleyes” for Privoxy…
Another way to cancel a redirect. Makes a filter:
Code:
CLIENT-HEADER-TAGGER: do-not-redirect
s@^Referer:\s*.*(site1|site2|site3).*$@test@i
where site1|site2|site3 are the sites from which the request was made and you need to cancel the redirect.
Next action:
Activating the filter on yastatic.net and googleapis.com
Code:
{+client-header-tagger{do-not-redirect} \
}
.yastatic.net/
.googleapis.com/

Canceling the redirect when the "test" tag appears:
Code:
{-redirect \
}
TAG:test
Thanks Arcady N. Shpak https://sites.google.com/site/rpfteam/
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to vlad_s for this post:
Faxopita
Post Reply 


Forum Jump: