Skip to content

Commit

Permalink
Merge pull request #90 from drunkdream/bugfix/socks-auth
Browse files Browse the repository at this point in the history
Bugfix/socks auth
  • Loading branch information
drunkdream authored Nov 14, 2024
2 parents 7d6f3d3 + 75f2c2a commit 0e3f267
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion turbo_tunnel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Turbo tunnel
"""

VERSION = "0.18.3"
VERSION = "0.18.4"
BANNER = r"""
_____ _ _____ _
/__ \_ _ _ __| |__ ___/__ \_ _ _ __ _ __ ___| |
Expand Down
17 changes: 16 additions & 1 deletion turbo_tunnel/socks.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,23 @@ async def handle_stream(self, stream, address):
password_response = Socks5PasswordAuthResponsePacket(0)
await downstream.write(password_response.serialize())
elif auth:
auth_response = Socks5AuthResponsePacket(EnumSocks5AuthMethod.NOT_SUPPORTED)
if (
len(auth_request.auth_methods) == 1
and auth_request.auth_methods[0] == EnumSocks5AuthMethod.NO_AUTH
):
utils.logger.warn("[%s] Auth required" % self.__class__.__name__)
auth_response = Socks5PasswordAuthResponsePacket(1)
else:
utils.logger.warn(
"[%s] Auth %s not supported"
% (self.__class__.__name__, auth_request.auth_methods)
)
auth_response = Socks5AuthResponsePacket(
EnumSocks5AuthMethod.NOT_SUPPORTED
)
await downstream.write(auth_response.serialize())
stream.close()
return
else:
auth_response = Socks5AuthResponsePacket(EnumSocks5AuthMethod.NO_AUTH)
await downstream.write(auth_response.serialize())
Expand Down

0 comments on commit 0e3f267

Please sign in to comment.