windows下 使用 obfs4proxy混淆 shadowsocks (是原版python版SS 非SSR)
obfs4proxy混淆 shadowsocks流量
- 工具准备
需要一台 vps 系统debian——服务端
一台windows系统的pc——客户端
- 安装
服务端准备
1、vps同时要安装 python2 和 python3 以及覆带的 pip 、 pip3 、 python-setuptools 、 python3-setuptools 因很多vps自带python2+ 以下只说明python3 如何安装。
过程(注意次序,单独安装便于排错):
#apt-get update
#apt-get install python3
#apt-get install python3-pip
#apt-get install python3-setuptools
2、安装obfs4proxy
#apt-get install obfs4proxy
2.1、安装ptproxy 和运行 ptproxy所需的 aiosocks
因单独的pobfs4proxy无任何作用必须配合其他工具来使用,附带 ptproxy 和运行 ptproxy所需的 aiosocks
#git clone https://github.com/gumblex/ptproxy.git (如果不能执行请安装git 如何安装掠过)
#pip3 install aiosocks
客户端准备
1、需要安装 windows 版的python3 注意:不是 python2
安装过程中将 配置环境变量 勾上(详细安装掠过)
2、同样将ptproxy 克隆到本地windows上
如果不使用git克隆可点击此处下载
2.1同样需要安装运行 ptproxy 所需的 aiosocks。此时需要先安装windows版 pip3 才能 pip 安装 aiosocks
过程:
点击此处下载 并将文件保存为get-pip.py
在cmd中执行命令
python get-pip.py
3、安装 aiosocks
pip3 install aiosocks
- 配置|运行
服务端配置
1、进入克隆到vps本地的ptproxy文件夹备份下example.json 文件
#mv example.json ./server.json
2、修改 server.json 中的参数
将参数改成改如下格式 (不要复制内容)
{
"role": "server",
"state": ".",
"local": "127.0.0.1:8080", # forward to this address (your destination proxy server) / 转发到此地址 (终点Shadowsocks服务器地址)
"server": "0.0.0.0:23456", # listen on this address (for the client to connect to) / 监听此地址(客户端连接此地址)
"ptexec": "obfs4proxy -logLevel=ERROR -enableLogging=true",
"ptname": "obfs4",
"ptargs": "cert=AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;iat-mode=0",
"ptserveropt": "",
"ptproxy": ""
}
服务端运行 测试
1、在 ptproxy文件夹中执行命令
#./ptproxy.py -s server.json
此时你将在终端得到一个类似这样的输出 你成功了
===== Server information =====
"server": "[::]:1300", #1300是obfs4服务端口
"ptname": "obfs4",
"ptargs": "cert=fn399mH5f+gr4ALA8TF0vhw8YPJxxSbsverM+mhSjRjpISfRlASDbISzsHFgf1QfSbCiPQ;iat-mode=0",
注意:请记住输出中的 ptargs 参数 在配置客户端时需要使用
客户端配置
1、同理 将 ptproxy 中的 example.json 备份并修改文件名为 client.json
2、修改 client.json 中的参数
将参数改成如下格式 (不要复制内容)
{
"role": "client",
"state": ".",
"local": "0.0.0.0:1090", # Listen on this address / 监听这里。在本地shadowsocks服务器栏填写该地址/端口
"server": "1.2.3.4:23456", # Remote server to connect to / 连接远程obfs4服务器
"ptexec": "obfs4proxy -logLevel=ERROR -enableLogging=true",
"ptname": "obfs4",
"ptargs": "cert=thisIsYourCert;iat-mode=0", # fill in the cert / 把cert填好
"ptserveropt": "",
"ptproxy": ""
}
注意:用刚才得到的服务端 ptarges 部份 替换配置文件中的相应部份
客户端运行 测试
1、在cmd中执行 命令 (该cmd窗口应该在 ptproxy.py 所在的文件夹中打开并执行该命令)
ptproxy.py -c client.json
你将得到一个输出,与下面类似
2316-16-17 15:16:39 Starting PT...
2216-16-11 15:16:39 PT started successfully.
- 排除错误(以下资料来源于网络)
1、运行SS 服务端时出现错误 (引发该错误的原因是升级了 openssl 导致,在openssl1.1.0版本中,废弃了EVP_CIPHER_CTX_cleanup函数,可以用EVP_CIPHER_CTX_reset来代替此函数 官方文档)
#ssserver -c /etc/ss.json
INFO: loading config from /etc/ss.json
2316-1-17 00:29:53 INFO loading libcrypto from libcrypto.so.1.1
Traceback (most recent call last):
File "/usr/local/bin/ssserver", line 9, in <module>
load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'ssserver')()
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/server.py", line 34, in main
config = shell.get_config(False)
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/shell.py", line 262, in get_config
check_config(config, is_local)
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/shell.py", line 124, in check_config
encrypt.try_cipher(config['password'], config['method'])
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py", line 44, in try_cipher
Encryptor(key, method)
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py", line 83, in __init__
random_string(self._method_info[1]))
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/encrypt.py", line 109, in get_cipher
return m[2](method, key, iv, op)
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py", line 76, in __init__
load_openssl()
File "/usr/local/lib/python2.7/dist-packages/shadowsocks/crypto/openssl.py", line 52, in load_openssl
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
File "/usr/lib/python2.7/ctypes/__init__.py", line 378, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
{ "role": "server", "state": ".", "local": "127.0.0.1:8080", # forward to this address (your destination proxy server) / 转发到此地址 (终点Shadowsocks服务器地址) "server": "0.0.0.0:23456", # listen on this address (for the client to connect to) / 监听此地址(客户端连接此地址) "ptexec": "obfs4proxy -logLevel=ERROR -enableLogging=true", "ptname": "obfs4", "ptargs": "cert=AAAAAAAAAAAAAAAAAAAAAAAAAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;iat-mode=0", "ptserveropt": "", "ptproxy": "" }
===== Server information =====
"server": "[::]:1300", #1300是obfs4服务端口
"ptname": "obfs4",
"ptargs": "cert=fn399mH5f+gr4ALA8TF0vhw8YPJxxSbsverM+mhSjRjpISfRlASDbISzsHFgf1QfSbCiPQ;iat-mode=0",
{ "role": "client", "state": ".", "local": "0.0.0.0:1090", # Listen on this address / 监听这里。在本地shadowsocks服务器栏填写该地址/端口 "server": "1.2.3.4:23456", # Remote server to connect to / 连接远程obfs4服务器 "ptexec": "obfs4proxy -logLevel=ERROR -enableLogging=true", "ptname": "obfs4", "ptargs": "cert=thisIsYourCert;iat-mode=0", # fill in the cert / 把cert填好 "ptserveropt": "", "ptproxy": "" }
2316-16-17 15:16:39 Starting PT...
2216-16-11 15:16:39 PT started successfully.
评论
发表评论