Convert Shadowsocks to Sock5/HTT
2017-10-17 本文已影响594人
寺院的研究僧
1. Shadow socks converted to sock5 proxy
- go run ss2http (https://github.com/hugozhu/ss2http)
git clone https://github.com/hugozhu/ss2http
or
go get github.com/hugozhu/ss2http
cd $GOPATH/src/github.com/hugozhu/ss2http
cat <<EOF >config.json
{ "server":"123.123.123.123", "server_port":1234, "local_address":"127.0.0.1", "local_port":30080, "password":"****", "method":"rc4-md5", "timeout":600 }
EOF
go run ss2http.go --proxy_type socks5
1.1 converted to http proxy
go run ss2http.go --proxy_type http
2. proxy for python script
- install PySocks (https://github.com/Anorov/PySocks)
pip install PySocks
psutil
pytest
pylint
flake8
- example for python script to get google or youtube
import urllib2
import socks
from sockshandler import SocksiPyHandler
opener = urllib2.build_opener(SocksiPyHandler(socks.SOCKS5, "127.0.0.1", 30080))
#x = opener.open("http://www.youtube.com/")
x = opener.open("http://www.google.com")
print x.read()
using shadowsocks to setup a proxy server
cat /etc/shadowsocks.json
{
"server":"xxxx.com",
"server_port":10008,
"local_port":1080,
"password":"123456",
"timeout":600,
"method":"aes-256-cfb"
}
sslocal -c /etc/shadowsocks.json -d start
Reference
- https://github.com/Anorov/PySocks
- https://segmentfault.com/a/1190000005081542
- http://www.panweizeng.com/python-urllib2-socks-proxy.html
- https://stackoverflow.com/questions/22597485/socks5-proxy-using-urllib2-and-pysocks
- http://supercocoa.github.io/2015/10/24/shadowsocks-httpproxy/
- http://www.jianshu.com/p/fef11e46ebf1