Showing posts with label Firefox. Show all posts
Showing posts with label Firefox. Show all posts

Saturday, August 25, 2007

使用自动配置代理脚本来跨越GFW

今天偶得一个很实用的pac文件,原帖见这里。详细的pac编写方法见这里。另外还有个有用的firefox插件torbutton

pac的原理是,浏览器在加载一个页面前首先执行这个文件里的
function FindProxyForURL(url, host)
是用javascript的语法编写的,它返回一个代理服务器地址或直接连接。

因此只要先判断:
如果是访问带有".blogspot.com"字串的地址,即访问blogger,则使用blogger的备用代理服务器地址。否则,判断是否某些被gfwed的网址,是则使用tor的代理服务器,最后,直接链接。


function FindProxyForURL(url,host)
{

// ==================================================
// Automatic proxy configuration Script Paradigm V0.1
//
// Author : zdpress
// Blog : Blog Behind GFW
// URL : http://behindgfw.blogspot.com
// Email : zdpress+blog at Gmail.com
// Thanks : super1 from zh.wikipedia.org
// Note : Under Firefox the URL should be like
// file:///C:/TOR.pac
// Under IE the URL should be like
// file://C:\TOR.pac
// ==================================================

url = url.toLowerCase();
host = host.toLowerCase();

if(dnsDomainIs(host, ".blogspot.com"))
return "PROXY 72.14.219.190:80";
//使用blogspot服务器后备IP
else if
(
//域名匹配.
dnsDomainIs(host,"lefkada.eecs.harvard.edu")
//通过http://lefkada.eecs.harvard.edu/cgi-bin/ipaddr.pl?tor=1检验是否已登陆Tor.
|| dnsDomainIs(host,"technorati.com")
|| dnsDomainIs(host,"wikipedia.org")
|| dnsDomainIs(host,"mediawiki.org")
|| dnsDomainIs(host,"wikimedia.org")
|| dnsDomainIs(host,"wiktionary.org")
|| dnsDomainIs(host,"wikibooks.org")
|| dnsDomainIs(host,"wikisource.org")
|| dnsDomainIs(host,"wikiquote.org")
|| dnsDomainIs(host,"wikinews.org")
|| dnsDomainIs(host,"wikimediafoundation.org")
|| dnsDomainIs(host,"voanews.com")
|| dnsDomainIs(host,"bbc.co.uk")
|| dnsDomainIs(host,"xys.org")
|| dnsDomainIs(host,"mindmeters.com")
|| dnsDomainIs(host,"gpass1.com")
|| dnsDomainIs(host,"pbwiki.com")
|| dnsDomainIs(host,"ice.citizenlab.org")
|| dnsDomainIs(host,"greatfirewallofchina.net")
|| dnsDomainIs(host,"civisec.org")
|| dnsDomainIs(host,"solog.org")
|| dnsDomainIs(host,"zuola.com")
|| dnsDomainIs(host,"im.tv")
//想增加网址在这里复制增加一行即可
|| shExpMatch(url, "http://*/search?q=cache*")
//匹配google网页快照
)
// return "PROXY 145.97.39.139:80;PROXY 125.241.38.130:8080;PROXY 127.0.0.1:8118";
// 注:IE支持代理列表,但FF不支持。为防止Tor滥用,有时因出口地址相同,
// 而不能编辑维基,所以有必要换用专用维基代理或者其他普通代理地址。
// 145.97.39.139:80为维基专用代理中一个,后者125.241.38.130:8080为普通代理。
// 维基专用代理: 145.97.39.156:80 145.97.39.142:80 145.97.39.140:80 145.97.39.135:80
// 145.97.39.132:80 145.97.39.138:80 145.97.39.133:80 145.97.39.139:80
// 145.97.39.134:80 145.97.39.136:80 145.97.39.131:80 145.97.39.137:80
return "PROXY 127.0.0.1:8118";
//使用tor+privoxy
else return "DIRECT";
//如缺少这句在IE下会经常显示错误
}

Friday, August 24, 2007

Firefox:恢复被关闭的页面

原来无需实用Tab Mix [Lite]也能完成这个功能,方法是:
History->Recently Closed Tabs,快捷键Ctrl+Shift+T,恢复上次被关闭的页面

Monday, August 20, 2007

Firefox+Adblock_plus+正则表达式:屏蔽恼人广告好帮手!

最近在回味以前看的漫画《龙狼传》,我在这里看的。
但是,里面好多广告,满屏都被占满了,很烦,于是使用了Firefox一个威力巨大的插件:Adblock_plus来杀死烦人广告!

首先可以在这里安装插件Adblock_plus

安装好后,打开想看的页面,如《龙狼传》第25卷在线观看。里面有三个4个frame放置广告,依次在它们上面点击右键,选择"block this frame"(我的系统是英文的),然后……广告帧消失了!

遗憾的是,点击了“下一页”后,下面两个帧的广告又出来了……
因此我查看了一下广告的链接,发觉不外乎是两种形式,应该是某种生成广告链接的技术吧(垃圾技术!)
第一个链接是类似
http://sogou.com/cpc_ads?......后跟一串使用者ID之类的带有某些生成字符串的东西。他们应该是随机生成的。因此,可以使用伟大的正则表达式来完成工作。

如下,点击Adblock_plus->preference,新加一条规则:
/http:\/\/sogou\.com\/cpc_ads\?.*/
其中使用两个斜线,作用是说明该规则是一条正则表达式。
这条正则表达式生成所有以"http://sogou.com/cpc_ads?"开头,后跟任意字符的字符串,或说“语言”。
怎么样?方便吧?

关于正则表达式的文章,可以查看本站的“正则表达式”标签。

后记:《龙狼传》的作者可是让我orz了……从95年开始看,看到现在已经12年快13年了,TMD竟然还未连载完,速度还越来越慢。里面人物个个杀不死,我怀疑他是不是打算利用这部漫画赚尽棺材本,甚至入棺那天还未完成呢……
没办法,谁叫我这么热爱三国啊……而且这部漫画也挺不错的。