Privoxy是一个 HTTP 协议过滤代理商。Privoxy 是有着先进的过滤能力和保护隐私的代理商工具,它可以过滤网页内容,管理cookies,控制访问,除广告、横幅、弹出窗口等等,它同时支持单系统和多客户网络。
如你看到这个简介一样,有意思的是它既能屏蔽广告页可以弹出广告,所以,任何事物都有两面性。
除了上述功能外, privoxy很多时候结合其余的隧道工具使用,达到少量保护隐私的作用,本文简单详情PAC。
ubuntu下可直接用apt安装(mac下面可用brew安装)
sudo apt install privoxy # 安装
sudo systemctl status privoxy # 查看运行状态sudo systemctl restart|stop|start privoxy # 重启中止
配置文件
privoxy 在ubuntu下的配置文件在/etc/privoxy下面,下面它的配置有哪些内容
> tree /etc/privoxy/etc/privoxy├── config├── default.action├── default.filter├── match-all.action├── regression-tests.action├── templates│ ├── blocked│ ├── cgi-error-404│ ├── cgi-error-bad-param│ ├── cgi-error-disabled│ ├── cgi-error-file│ ├── cgi-error-file-read-only│ ├── cgi-error-modified│ ├── cgi-error-parse│ ├── cgi-style.css│ ├── client-tags│ ├── connect-failed│ ├── connection-timeout│ ├── default│ ├── edit-actions-add-url-form│ ├── edit-actions-for-url│ ├── edit-actions-for-url-filter│ ├── edit-actions-list│ ├── edit-actions-list-button│ ├── edit-actions-list-section│ ├── edit-actions-list-url│ ├── edit-actions-remove-url-form│ ├── edit-actions-url-form│ ├── forwarding-failed│ ├── mod-local-help│ ├── mod-support-and-service│ ├── mod-title│ ├── mod-unstable-warning│ ├── no-server-data│ ├── no-such-domain│ ├── show-request│ ├── show-status│ ├── show-status-file│ ├── show-url-info│ ├── show-version│ ├── toggle│ ├── toggle-mini│ ├── untrusted│ └── url-info-osd.xml├── trust├── user.action└── user.filter
上面这些配置就不详细详情了,可以看官方文档
privoxy的所有功能由一系列的Action组成(链接里有所有支持的Action)
而后,所有的Action的能否启动的配置的入口在config这个文件里面,通过actionsfile这个指令来导入这些action
actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.actionsfile default.action # Main actions fileactionsfile user.action # User customizations
# actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.# actionsfile default.action # Main actions file# actionsfile user.action # User customizationsforward-socks5t / 127.0.0.1:1080 .
这种情况,一般可以结合浏览器的插件来使用,可以在插件使用gfwlst.txt来做智能路由。
当然,假如你不想在浏览器里面用插件,或者者你没有条件用那种条件在用户端使用gfwlst.txt(是的,就是你想的那个),比方你希望你的手机也可以聪明的根据网站来路由,那可以给privoxy定制一个gfwlst.txt的PAC
gfwlist2privoxy -i gfwlst.txt -f gfwlst.action -p 127.0.0.1:1080 -t socks5
而后在config里面注册这些个action就好了
# actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.# actionsfile default.action # Main actions file# actionsfile user.action # User customizations# forward-socks5t / 127.0.0.1:1080 .actionsfile gfwlst.action
配置网后重启一下就好了(重启命令见上面),之后把手机设置到这个privoxy的代理商地址就好。
最后,假如大家有这个条件可以自由上网,大家还是不要用于来干违法或者者打擦边球事,家长下决心要追查的话,是不可能逃掉的。用来学习的话,家长还是有肯定的分寸的。
还有一点,privoxy+nat很容易实现定点攻击,可以把用户端所有的上网日志记录下来,用来做广告弹出和少量不合法的事情,如盗取用户端的隐私信息(如账号密码之类),所以想提示大家出门在外,尽量不要连那种公共的wifi。
回到开篇所说,privoxy它既能屏蔽广告页可以弹出广告,任何事物都有两面性,技术也不例外,一念天堂,一念地狱,劝君自护念之。