我编译的tor 0.2.8.1-alpha win32可执行文件(单文件版,不需要dll运行库)

572 views
Skip to first unread message

Gary12

unread,
Feb 10, 2016, 12:42:38 AM2/10/16
to fq...@googlegroups.com
我编译的tor 0.2.8.1-alpha win32可执行文件:

https://copy.com/jCtGAv6qMnpLFPjv/tor?download=1

下载以后加exe后缀即可使用(单文件版,不需要dll运行库,也就是说libeven,libgcc,zlib等dll文件可以全部都删掉)

从源代码编译windows版的tor是一件非常有挑战性的事情(官方版一般会释放最新版的tor源代码,但是不释放可执行文件,编译linux版的tor很容易,但是编译win版的tor却很难了),有兴趣尝试的网友可以参考下面的教程:

视频教程: http://www.mictronics.de/2014/04/how-to-build-tor-for-win32/

我精简的文字教程:

1. 安装好MinGW和MSYS等运行库:
http://sourceforge.net/projects/mingw/files/latest/download

注意要用SS做全局代理,否则下载不成功。

到了MinGW Installation Manager的界面,注意把All packages都装上。

然后设置系统环境变量:
PATH:                   添加:C:\MinGW\bin
BINARY_PATH        C:\MinGW\bin
INCLUDE_PATH    C:\MinGW\include
LIBRARY_PATH    C:\MinGW\lib

在C:\MinGW\msys\1.0\home\[USERNAME] 新建 tor-mingw目录

下载openssl-1.0.2f, Zlib 1.2.8, Libevent 2.0.22-stable,Tor v0.2.8.1-alpha这四个压缩包放进tor-mingw目录。

下载地址如下:

https://www.openssl.org/source/openssl-1.0.2f.tar.gz

http://zlib.net/zlib-1.2.8.tar.gz

https://github-cloud.s3.amazonaws.com/releases/1856976/b8683cb6-0519-11e5-817f-053e621a8f47.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAISTNZFOVBIJMK3TQ%2F20160209%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160209T122641Z&X-Amz-Expires=300&X-Amz-Signature=e93065fddeabd1cab93fb51f0bd4f765cd8eda830c0e006a7f72c247efe4c096&X-Amz-SignedHeaders=host&actor_id=11530991&response-content-disposition=attachment%3B%20filename%3Dlibevent-2.0.22-stable.tar.gz&response-content-type=application%2Foctet-stream

https://dist.torproject.org/tor-0.2.8.1-alpha.tar.gz

启动MSYS(启动路径: C:\MinGW\msys\1.0\msys.bat)

会出现一个类似linux的终端窗口:

然后 cd tor-mingw

1. 编译安装openssl:

执行下面的命令:

tar zxf openssl-1.0.2f.tar.gz

cd openssl-1.0.2f
./Configure -no-idea -no-rc5 -no-mdc2 -no-shared -DOPENSSL_NO_HEARTBEATS -DOPENSSL_NO_RDRAND mingw

完成以后,编辑 Makefile 文件,删除其中的test: 和 tests:  部分:

然后继续运行:
rm -rf ./test
cd crypto
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ../ssl/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ..
cp *.h include/openssl/
make depend
make
make install

20-30分钟可完成编译

2. 编译安装Zlib:

cd ..
tar zxf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
make -fwin32/Makefile.gcc

注意这三个系统环境变量一定要提前添加,否则编译会失败:BINARY_PATH, INCLUDE_PATH LIBRARY_PATH

继续运行:
make install -fwin32/Makefile.gcc

Zlib编译安装完成

3. 编译安装libevent:

cd ..
tar zxf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --enable-static --disable-shared
make
make install
整个过程会持续20分钟左右

至此tor的win32编译环境已经搭建好了。


4. 开始编译tor的win32 exe文件:

cd ..
tar zxf tor-0.2.8.1-alpha.tar.gz
cd tor-0.2.8.1-alpha
./configure --disable-gcc-hardening --enable-static-libevent --enable-static-openssl --enable-static-zlib --with-libevent-dir=../libevent-2.0.22-stable/ --with-openssl-dir=../openssl-1.0.2f/ --with-zlib-dir=../zlib-1.2.8/
make

整个过程会持续30分钟左右

完成以后,在src/or/目录下可以找到编译出来的tor.exe文件,而且是单文件版,不需要任何dll依赖库即可独立运行。

至此, tor的win32文件编译全部完成!






G.

unread,
Feb 10, 2016, 11:29:06 AM2/10/16
to 翻墙论坛
Gary大俠,

我發現你編譯tor的過程跟Advor幾乎是一樣的,不知道是否可以幫忙升級Advor到最新的tor? 它那個最後的版本為2.3.2版本也不知道還能撐多久。

fhzyfjy

unread,
Feb 10, 2016, 9:56:08 PM2/10/16
to 翻墙论坛
非常遗憾,用不了。卡在5%(bootstrapped)后就一直死机,无反应。系统是win7。带宽100M。谢谢

在 2016年2月10日星期三 UTC+8下午1:42:38,Gary12写道:

Gary12

unread,
Feb 10, 2016, 10:07:50 PM2/10/16
to fq...@googlegroups.com
应该是你torrc配置的问题,我的可以正常使用:



Feb 11 11:37:54.000 [notice] Tor 0.2.8.1-alpha (git-9093e3769746742f) opening log file.
Feb 11 11:37:54.399 [notice] Tor v0.2.8.1-alpha (git-9093e3769746742f) running on Windows 7 with Libevent 2.0.22-stable, OpenSSL 1.0.2f and Zlib 1.2.8.
Feb 11 11:37:54.404 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Feb 11 11:37:54.405 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Feb 11 11:37:54.446 [notice] Read configuration file "C:\Users\Administrator\Desktop\Tor V.2.8.1\torrc.txt".
Feb 11 11:37:54.457 [warn] Path for GeoIPFile (./geoip) is relative and will resolve to C:\Users\Administrator\Desktop\Tor V.2.8.1\geoip. Is this what you wanted?
Feb 11 11:37:54.457 [warn] Path for GeoIPv6File (./geoip6) is relative and will resolve to C:\Users\Administrator\Desktop\Tor V.2.8.1\geoip6. Is this what you wanted?
Feb 11 11:37:54.457 [warn] Path for DataDirectory (./) is relative and will resolve to C:\Users\Administrator\Desktop\Tor V.2.8.1\. Is this what you wanted?
Feb 11 11:37:54.458 [warn] You have asked to exclude certain relays from all positions in your circuits. Expect hidden services and other Tor features to be broken in unpredictable ways.
Feb 11 11:37:54.473 [notice] Opening Socks listener on 127.0.0.1:9050
Feb 11 11:37:54.000 [notice] Parsing GEOIP IPv4 file ./geoip.
Feb 11 11:37:54.000 [notice] Parsing GEOIP IPv6 file ./geoip6.
Feb 11 11:37:54.000 [notice] Bootstrapped 0%: Starting
Feb 11 11:37:55.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Feb 11 11:37:58.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Feb 11 11:38:00.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Feb 11 11:38:01.000 [warn] Your Guard Unnamed ($7FFE2445D91F2B38B25D1727C30D0703B7B7B36A) is failing an extremely large amount of circuits. This could indicate a route manipulation attack, extreme network overload, or a bug. Success counts are 29/257. Use counts are 18/23. 255 circuits completed, 3 were unusable, 224 collapsed, and 1 timed out. For reference, your timeout cutoff is 60 seconds.
Feb 11 11:38:01.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Feb 11 11:38:01.000 [notice] Bootstrapped 100%: Done





在 2016年2月11日星期四 UTC+8上午10:56:08,fhzyfjy写道:
Auto Generated Inline Image 2
Auto Generated Inline Image 1

fhzyfjy

unread,
Feb 11, 2016, 6:38:44 AM2/11/16
to 翻墙论坛
torrc还要配置吗?不是下载你的单文件版加后缀exe即可使用吗?我是小白。谢谢

在 2016年2月11日星期四 UTC+8上午11:07:50,Gary12写道:

Gary12

unread,
Feb 11, 2016, 7:20:54 AM2/11/16
to 翻墙论坛
你注意看:最精简的文件结构是这样的:



torrc文件的内容如下(需要开启蓝灯做前置):

SocksListenAddress 127.0.0.1


HTTPSProxy 127.0.0.1:8787
#Socks5Proxy 127.0.0.1:1080

UseBridges 0
DataDirectory ./
GeoIPFile ./geoip
GeoIPv6File ./geoip6
Log notice file ./tor.log
StrictNodes 1
AvoidDiskWrites 1

ExcludeExitNodes {cn},{hk},{mo},{sg},{th},{pk},{by},{ru},{ir},{vn},{ph},{my},{cu}
ExcludeNodes {cn},{hk},{mo},{sg},{th},{pk},{by},{ru},{ir},{vn},{ph},{my},{cu}

ReachableAddresses *:80,*:443
ReachableAddresses reject *:*

NewCircuitPeriod 900

Tor-Start和Tor-Stop是两个bat批处理文件,内容如下:

Tor-Start.bat:

tor -f torrc.txt

Tor-Stop.bat

taskkill /IM tor.exe /F
taskkill /IM obfs4proxy.exe /F


在 2016年2月11日星期四 UTC+8下午7:38:44,fhzyfjy写道:
Auto Generated Inline Image 1

zkwa...@gmail.com

unread,
Feb 16, 2016, 11:12:22 PM2/16/16
to 翻墙论坛
很好用,一次运行成功。


Auto Generated Inline Image 1

yeahwu

unread,
Feb 17, 2016, 9:58:49 PM2/17/16
to 翻墙论坛
感谢gary,俺又捡现成的了,呵呵


在 2016年2月10日星期三 UTC+8下午1:42:38,Gary12写道:
我编译的tor 0.2.8.1-alpha win32可执行文件:
Reply all
Reply to author
Forward
0 new messages