Total Pageviews

Saturday 2 April 2016

用obfstunnel混淆socks代理服务器程序的流量,从而翻墙(我成功用来翻墙)

首先登陆linux vps,然后
git clone https://github.com/greensea/obfstunnel
cd obfstunnel
root@AR:~/obfstunnel# ls
COPYING obfstunnel.h  README.zh_CN  udpsession.h
Makefile  obfstunnel.c    README.md     udpsession.c
root@AR:~/obfstunnel# make
root@AR:~/obfstunnel# ls
COPYING   obfstunnel    obfstunnel.h  README.zh_CN  udpsession.h
Makefile  obfstunnel.c    README.md     udpsession.c
root@AR:~/obfstunnel#
(make完成后,obfstunnel目录里就会生成一个obfstunnel文件,这个obfstunnel文件就是obfstunnel的可执行文件)
root@AR:~/obfstunnel# ./obfstunnel -h
Usage: ./obfstunnel <<-s|-c> port> [-t <domain|IP>[:port]] [-u [timeout]]
root@AR:~/obfstunnel# nohup ./obfstunnel -s 2000 -t localhost:20080 -m xor > /dev/null & (回车2次)
./obfstunnel -s 2000 -t localhost:20080 -m xor 的意思是obfstunnel以server模式运行,监听2000端口,服务器接到连接其2000端口的请求后,把请求转发到同一台机器(vps)上的20080端口,而监听20080端口的程序是一个socks代理服务器程序mocks,见这里-briteming.blogspot.com/2012/02/socks-server-mocks.html,(当然其他的socks代理服务器程序也行,比如dante,kingate,ssocks),然后mocks就会去目标网站取回数据。"-m xor"的意思是加密方式为xor.
你可以把nohup ./obfstunnel -s 2000 -t localhost:20080 -m xor > /dev/null &保存为start-obfstunnel.sh,然后chmod 755 start-obfstunnel.sh,以后想要启动obfstunnel的话,运行
./start-obfstunnel.sh即可。

这里localhost后面的端口号也可换成你在vps上所安装的某个http代理服务器程序(比如squid/tinyproxy) 的端口号.

然后在客户端机器(linux桌面系统或mac)上,
git clone https://github.com/greensea/obfstunnel
cd obfstunnel
make
(make完成后,obfstunnel目录里就会生成一个obfstunnel文件,这个obfstunnel文件就是obfstunnel的可执行文件)
nohup ./obfstunnel -c 2346 -t your_vps_ip:2000 -m xor > /dev/null &

你可把nohup ./obfstunnel -c 2346 -t your_vps_ip:2000 -m xor > /dev/null &保存为
start-obfstunnel.sh, 然后chmod 755 start-obfstunnel.sh,以后想要启动obfstunnel的话,运行
./start-obfstunnel.sh即可。

./obfstunnel -c 2346 -t your_vps_ip:2000 -m xor 的意思是obfstunnel以client模式运行,监听2346端口,这个本地机器的obfstunnel接到连接其2346端口的请求后,把请求转发到your_vps_ip的2000
端口,"-m xor"的意思是加密方式为xor.

然后设置本地机器的浏览器的代理为socks代理-127.0.0.1:2346, 本地机器的浏览器即可翻墙。

你在服务器上所运行的后端代理服务器程序是socks代理服务器程序(比如mocks/kingate),则本地机器的浏览器的代理就设为socks代理;
你在服务器上所运行的后端代理服务器程序是http代理服务器程序(比如squid/tinyproxy),则本地机器的浏览器的代理就设为http代理;

通常的socks代理服务器程序/http代理服务器程序是明文代理,因此无法用它们来直接翻墙,这时用obfstunnel混淆socks代理服务器程序/http代理服务器程序的流量,二者结合,就可顺利的翻墙了
 
这是我的原创文章。 
项目地址:https://github.com/greensea/obfstunnel,这个程序是中国人写的,跟torproject官方无关。我又要说中国人很聪明,能不断创造出翻墙的工具。
 
如果在自己的vps上,mocks的20080端口已经搭配obfsproxy,那么建议更换obfstunnel所使用的后端程序mocks的端口号。如果还是使用20080,那么用obfstunnel翻墙的速度会变慢。你可以重新运行一个mocks进程如下:
cp /root/mocks-0.0.2/mocks.conf /root/mocks-0.0.2/mocks2.conf  
nano /root/mocks-0.0.2/mocks2.conf (把里面的20080改为30080)
/root/mocks-0.0.2/mocks start --config /root/mocks-0.0.2/mocks2.conf -f
然后运行
nohup ./obfstunnel -s 2000 -t localhost:30080 -m xor > /dev/null &即可。
 
相关帖子:http://briteming.blogspot.com/2016/03/obfsproxysockshttp.html