Total Pageviews

Tuesday, 12 June 2018

利用s5proxy-by-lyncir翻墙

登陆linux vps.
首先安装python3环境。
首先编译python3.6.4环境:
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar zxvf Python-3.6.4.tgz
cd Python-3.6.4
./configure --prefix=/usr/local/python-3.6.4
make 
make install
echo 'export PATH=$PATH:/usr/local/python-3.6.4/bin' >> /etc/profile
. /etc/profile
至此python3.6.4环境就搭建好了.
 
cd ~
git clone https://github.com/lyncir/s5proxy s5proxy-by-lyncir
cd s5proxy-by-lyncir
openssl genrsa -out privkey.pem 2048
(会在当前目录下,生成 privkey.pem)
openssl req -new -x509 -key privkey.pem -out cacert.pem -days 3650
(会在当前目录下,生成 cacert.pem )
cp config.ini.example config.ini
nano config.ini
 
root@ar:~/s5proxy-by-lyncir# cat config.ini
[default]
server = 0.0.0.0
server_port = 7089
local = 127.0.0.1
local_port = 1056
certfile = cacert.pem
keyfile = privkey.pem

root@ar:~/s5proxy-by-lyncir# pip3.6 install -r requirements.txt 
root@ar:~/s5proxy-by-lyncir# python3.6 server.py &
不过此命令: python3.6 server.py &容易退出运行,我们可以利用daemonize来
python3.6 server.py运行为daemon:
root@ar:~/s5proxy-by-lyncir# daemonize -c . /usr/local/python-3.6.4/bin/python3.6 server.py
root@ar:~/s5proxy-by-lyncir#
服务器端就搭建完成。

在本地机器mac.
首先安装python3环境:
brew install python3
cd ~
git clone https://github.com/lyncir/s5proxy s5proxy-by-lyncir
cd s5proxy-by-lyncir 
然后把服务器上的~/s5proxy-by-lyncir/目录里的privkey.pem和cacert.pem下载到
当前目录。 
pip3 install -r requirements.txt 
cp config.ini.example config.ini
nano config.ini 

yudeMacBook-Air:s5proxy-by-lyncir brite$ cat config.ini
[default]
server = vps-ip
server_port = 7089
local = 127.0.0.1
local_port = 1056
certfile = cacert.pem
keyfile = privkey.pem
yudeMacBook-Air:s5proxy-by-lyncir brite$ python3 client.py

然后,设置浏览器的socks5代理服务器为127.0.0.1:1056 ,浏览器即可翻墙。
 
项目地址:https://github.com/lyncir/s5proxy 

注意:这个程序跟https://briteming.blogspot.com/2018/06/cmakesocks5-s5proxy.html里面说的
s5proxy 是2回事,同名而已

No comments:

Post a Comment