Skip to content

Commit 8496633

Browse files
authored
v1.6.4
1 parent dfed055 commit 8496633

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

pproxy/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import argparse, time, re, asyncio, functools, urllib.parse
1+
import argparse, time, re, asyncio, functools, base64, urllib.parse
22
from pproxy import proto
33

44
__title__ = 'pproxy'
5-
__version__ = "1.6.3"
5+
__version__ = "1.6.4"
66
__description__ = "Proxy server that can tunnel among remote servers by regex rules."
77
__author__ = "Qian Wenjie"
88
__license__ = "MIT License"
@@ -155,6 +155,13 @@ def compile(cls, uri, relay=None):
155155
cipher, _, loc = url.netloc.rpartition('@')
156156
if cipher:
157157
from pproxy.cipher import get_cipher
158+
if ':' not in cipher:
159+
try:
160+
cipher = base64.b64decode(cipher).decode()
161+
except Exception:
162+
pass
163+
if ':' not in cipher:
164+
raise argparse.ArgumentTypeError('userinfo must be "cipher:key"')
158165
err_str, cipher = get_cipher(cipher)
159166
if err_str:
160167
raise argparse.ArgumentTypeError(err_str)

pproxy/cipher.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,8 @@ def setup(self):
189189

190190
def get_cipher(cipher_key):
191191
from pproxy.cipherpy import MAP as MAP_PY
192-
cipher, _, key = cipher_key.partition(':')
192+
cipher, key = cipher_key.split(':')
193193
cipher_name, ota, _ = cipher.partition('!')
194-
if not key:
195-
return 'empty key', None
196194
if cipher_name not in MAP and cipher_name not in MAP_PY and not (cipher_name.endswith('-py') and cipher_name[:-3] in MAP_PY):
197195
return f'existing ciphers: {sorted(set(MAP)|set(MAP_PY))}', None
198196
key, ota = key.encode(), bool(ota) if ota else False

0 commit comments

Comments
 (0)