All Projects → Amaindex → asyncio-socks-server

Amaindex / asyncio-socks-server

Licence: MIT license
A SOCKS proxy server implemented with the powerful python cooperative concurrency framework asyncio.

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to asyncio-socks-server

Nps
一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
Stars: ✭ 19,537 (+12586.36%)
Mutual labels:  tcp, udp, socks, socks5
Pingtunnel
ping tunnel is a tool that advertises tcp/udp/socks5 traffic as icmp traffic for forwarding.
Stars: ✭ 1,904 (+1136.36%)
Mutual labels:  tcp, udp, socks5
duckpy
A simple Python library for searching on DuckDuckGo.
Stars: ✭ 20 (-87.01%)
Mutual labels:  asynchronous, pypi, asyncio
Socks5
A full-fledged high-performance socks5 proxy server written in C#. Plugin support included.
Stars: ✭ 331 (+114.94%)
Mutual labels:  proxy-server, socks, socks5
python-socks
Core proxy client (SOCKS4, SOCKS5, HTTP) functionality for Python
Stars: ✭ 40 (-74.03%)
Mutual labels:  socks, socks5, asyncio
Leaf
A lightweight and fast proxy utility tries to include any useful features.
Stars: ✭ 530 (+244.16%)
Mutual labels:  tcp, udp, socks
Gobetween
☁️ Modern & minimalistic load balancer for the Сloud era
Stars: ✭ 1,631 (+959.09%)
Mutual labels:  tcp, udp, proxy-server
Purerpc
Asynchronous pure Python gRPC client and server implementation supporting asyncio, uvloop, curio and trio
Stars: ✭ 125 (-18.83%)
Mutual labels:  asynchronous, pypi, asyncio
Frpc Android
Android,安卓版frpc,一个快速反向代理,可帮助您将NAT或防火墙后面的本地服务器暴露给Internet。
Stars: ✭ 205 (+33.12%)
Mutual labels:  tcp, udp, socks5
sx
🖖 Fast, modern, easy-to-use network scanner
Stars: ✭ 1,267 (+722.73%)
Mutual labels:  udp, socks, socks5
nimSocks
A filtering SOCKS proxy server and client library written in nim.
Stars: ✭ 51 (-66.88%)
Mutual labels:  proxy-server, socks, socks5
Message Io
Event-driven message library for building network applications easy and fast.
Stars: ✭ 321 (+108.44%)
Mutual labels:  tcp, asynchronous, udp
XAsyncSockets
XAsyncSockets is an efficient Python/MicroPython library of managed asynchronous sockets.
Stars: ✭ 28 (-81.82%)
Mutual labels:  tcp, asynchronous, udp
Blinksocks
A framework for building composable proxy protocol stack.
Stars: ✭ 587 (+281.17%)
Mutual labels:  tcp, udp, socks5
twjitm-core
采用Netty信息加载实现长连接实时通讯系统,客户端可以值任何场景,支持实时http通讯、webSocket通讯、tcp协议通讯、和udp协议通讯、广播协议等 通过http协议,rpc协议。 采用自定义网络数据包结构, 实现自定义网络栈。
Stars: ✭ 98 (-36.36%)
Mutual labels:  tcp, asynchronous, udp
Goproxy
🔥 Proxy is a high performance HTTP(S) proxies, SOCKS5 proxies,WEBSOCKET, TCP, UDP proxy server implemented by golang. Now, it supports chain-style proxies,nat forwarding in different lan,TCP/UDP port forwarding, SSH forwarding.Proxy是golang实现的高性能http,https,websocket,tcp,socks5代理服务器,支持内网穿透,链式代理,通讯加密,智能HTTP,SOCKS5代理,黑白名单,限速,限流量,限连接数,跨平台,KCP支持,认证API。
Stars: ✭ 11,334 (+7259.74%)
Mutual labels:  tcp, udp, socks5
Psiphon
A multi-functional version of a popular network circumvention tool
Stars: ✭ 169 (+9.74%)
Mutual labels:  proxy-server, socks, socks5
Tor Socks Proxy
🐳 Tiny Docker(🤏 10MB) image as 🧅 Tor SOCKS5 proxy 🛡
Stars: ✭ 218 (+41.56%)
Mutual labels:  proxy-server, socks, socks5
Gap Proxy
gap-proxy 是一个加速网络的 SOCKS5 安全代理工具。
Stars: ✭ 144 (-6.49%)
Mutual labels:  tcp, udp, socks
Prox5
🧮 SOCKS5/4/4a 🌾 validating proxy pool and upstream SOCKS5 server for 🤽 LOLXDsoRANDum connections 🎋
Stars: ✭ 39 (-74.68%)
Mutual labels:  proxy-server, socks, socks5

asyncio-socks-server

Latest version Build Image Tests Build

A SOCKS proxy server implemented with the powerful python cooperative concurrency framework asyncio.

Features

  • Supports both TCP and UDP with the implementation of SOCKS5 protocol
  • Supports username/password authentication
  • Provides optional strict mode that follows RFC1928 and RFC1929 without compromise
  • Driven by the python standard library, no third-party dependencies

Installation

Install with pip if Python version 3.8.0 or higher is available.

pip install asyncio-socks-server

Or pull a docker image from the Docker Hub registry.

docker pull amaindex/asyncio-socks-server

Usage

When installed with pip, you can invoke asyncio-socks-server from the command-line:

asyncio_socks_server [-h] [-v] 
                     [-H HOST] [-P PORT] [-A METHOD] 
                     [--access-log] [--debug] [--strict] 
                     [--env-prefix ENV_PREFIX]
                     [--config PATH]

where:

  • asyncio_socks_server: You could use python -m asyncio_socks_server in development.
  • -h, --help: Show a help message and exit.
  • -v, --version: Show program's version number and exit.
  • -H HOST, --host HOST: Host address to listen (default 0.0.0.0).
  • -P PORT, --port PORT: Port to listen (default 1080).
  • -A METHOD, --auth METHOD: Authentication method (default 0). Possible values: 0 (no auth), 2 (username/password auth)
  • --access-log: Display access log.
  • --debug: Work in debug mode.
  • --strict: Work in strict compliance with RFC1928 and RFC1929.

If the value of METHOD is 2, that is, when the username/password authentication is specified, you need to provide a config file containing the usernames and passwords in json format with the --config option. You can also list other options in the config file instead of the command:

config.json:

{
  "LISTEN_HOST": "0.0.0.0",
  "LISTEN_PORT": 1080,
  "AUTH_METHOD": 2,
  "ACCESS_LOG": true,
  "DEBUG": true,
  "STRICT": true,
  "USERS": {
    "username1": "password1",
    "username2": "password2",
    "username3": "password3"
  }
}
asyncio_socks_server --config ${ENV}/config.json

In addition, any environment variable named starting with AIOSS_ will also be applied to the option. The prefix can be changed by specifying the --env-prefix option,for example:

export MY_LISTEN_HOST=127.0.0.1
export MY_LISTEN_PORT=9999
asyncio_socks_server --env-prefix MY_

NOTE: The loading order of the options is: config file, environment variables, command options. The latter will overwrite the former if options are given in multiple ways.

Alternatively, if you use the docker image, you can launch the asyncio-socks-server with the following command:

docker run amaindex/asyncio-socks-server [-h] [-v] 
                                         [-H HOST] [-P PORT] [-A METHOD] 
                                         [--access-log] [--debug] [--strict] 
                                         [--env-prefix ENV_PREFIX]
                                         [--config PATH]

The network mode host is recommended since asyncio-socks-server uses multiple ports dynamically. If you also want to provide a config file, it should be mounted manually.

docker run \
    --rm \
    --net=host \
    -v /host/path/config.json:/config.json \ 
    amaindex/asyncio-socks-server \
    --config /config.json

Strict Mode

For various reasons, asyncio-socks-server has made some compromises on the Implementation details of the protocols. Therefore, in the following scenes, asyncio-socks-server’s behavior will be divergent from that described in RFC1928 and RFC1929.

asyncio-socks-server relays all UDP datagrams by default

In the SOCKS5 negotiation, a UDP ASSOCIATE request formed as follows is used to establish an association within the UDP relay process to handle UDP datagrams:

+----+-----+-------+------+----------+----------+
|VER | CMD |  RSV  | ATYP | DST.ADDR | DST.PORT |
+----+-----+-------+------+----------+----------+
| 1  |  1  | X'00' |  1   | Variable |    2     |
+----+-----+-------+------+----------+----------+

Normally, the DST.ADDR and DST.PORT fields contain the address and port that the client expects to use to send UDP datagrams on for the association, or use a port number and address of all zeros if the client does not possess this information. Therefore, when the client is working in a network that uses NAT, the DST.ADDR with all zeros should be used to avoid errors. But in case some clients did not follow this principle correctly, asyncio-socks-server relays all UDP datagrams it receives by default instead of using DST.ADDR and DST.PORT to limit the access.

asyncio-socks-server allows "V5" username/password authentication

Once the client selects the username/password authentication during negotiation, it will conduct a sub-negotiation with the server. This sub-negotiation begins with the client producing a request:

+----+------+----------+------+----------+
|VER | ULEN |  UNAME   | PLEN |  PASSWD  |
+----+------+----------+------+----------+
| 1  |  1   | 1 to 255 |  1   | 1 to 255 |
+----+------+----------+------+----------+

The VER field contains the current version of the sub-negotiation, which is X'01' but often considered as X'05' since it's a bit counter-intuitive. So asyncio-socks-server allows requests with VER X'05' in non-strict mode.

--strict option

To disable the compromise described above, you can specify the --strict option:

asyncio_socks_server --strict

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].