python-socks 2.4.3__py3-none-any.whl → 2.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_socks/_connectors/socks4_async.py +1 -1
- python_socks/_connectors/socks4_sync.py +1 -1
- python_socks/_connectors/socks5_async.py +12 -2
- python_socks/_connectors/socks5_sync.py +12 -2
- python_socks/_protocols/socks5.py +3 -3
- python_socks/_version.py +1 -1
- {python_socks-2.4.3.dist-info → python_socks-2.5.0.dist-info}/METADATA +8 -11
- {python_socks-2.4.3.dist-info → python_socks-2.5.0.dist-info}/RECORD +11 -11
- {python_socks-2.4.3.dist-info → python_socks-2.5.0.dist-info}/WHEEL +1 -1
- {python_socks-2.4.3.dist-info → python_socks-2.5.0.dist-info}/LICENSE.txt +0 -0
- {python_socks-2.4.3.dist-info → python_socks-2.5.0.dist-info}/top_level.txt +0 -0
|
@@ -3,6 +3,7 @@ import socket
|
|
|
3
3
|
from .._abc import AsyncSocketStream, AsyncResolver
|
|
4
4
|
from .abc import AsyncConnector
|
|
5
5
|
|
|
6
|
+
from .._protocols.errors import ReplyError
|
|
6
7
|
from .._protocols import socks5
|
|
7
8
|
from .._helpers import is_ip_address
|
|
8
9
|
|
|
@@ -56,7 +57,7 @@ class Socks5AsyncConnector(AsyncConnector):
|
|
|
56
57
|
|
|
57
58
|
# Connect
|
|
58
59
|
if not is_ip_address(host) and not self._rdns:
|
|
59
|
-
_,
|
|
60
|
+
_, host = await self._resolver.resolve(
|
|
60
61
|
host,
|
|
61
62
|
family=socket.AF_UNSPEC,
|
|
62
63
|
)
|
|
@@ -65,6 +66,15 @@ class Socks5AsyncConnector(AsyncConnector):
|
|
|
65
66
|
data = conn.send(request)
|
|
66
67
|
await stream.write_all(data)
|
|
67
68
|
|
|
68
|
-
data = await stream.
|
|
69
|
+
data = await stream.read_exact(4)
|
|
70
|
+
if data[3] == socks5.AddressType.IPV4:
|
|
71
|
+
data += await stream.read_exact(6)
|
|
72
|
+
elif data[3] == socks5.AddressType.IPV6:
|
|
73
|
+
data += await stream.read_exact(18)
|
|
74
|
+
elif data[3] == socks5.AddressType.DOMAIN:
|
|
75
|
+
data += await stream.read_exact(int.from_bytes(await stream.read_exact(1)) + 2)
|
|
76
|
+
else: # pragma: no cover
|
|
77
|
+
raise ReplyError(f'Invalid address type: {data[3]:#02X}')
|
|
78
|
+
|
|
69
79
|
reply: socks5.ConnectReply = conn.receive(data)
|
|
70
80
|
return reply
|
|
@@ -3,6 +3,7 @@ import socket
|
|
|
3
3
|
from .._abc import SyncSocketStream, SyncResolver
|
|
4
4
|
from .abc import SyncConnector
|
|
5
5
|
|
|
6
|
+
from .._protocols.errors import ReplyError
|
|
6
7
|
from .._protocols import socks5
|
|
7
8
|
from .._helpers import is_ip_address
|
|
8
9
|
|
|
@@ -50,12 +51,21 @@ class Socks5SyncConnector(SyncConnector):
|
|
|
50
51
|
|
|
51
52
|
# Connect
|
|
52
53
|
if not is_ip_address(host) and not self._rdns:
|
|
53
|
-
_,
|
|
54
|
+
_, host = self._resolver.resolve(host, family=socket.AF_UNSPEC)
|
|
54
55
|
|
|
55
56
|
request = socks5.ConnectRequest(host=host, port=port)
|
|
56
57
|
data = conn.send(request)
|
|
57
58
|
stream.write_all(data)
|
|
58
59
|
|
|
59
|
-
data = stream.
|
|
60
|
+
data = stream.read_exact(4)
|
|
61
|
+
if data[3] == socks5.AddressType.IPV4:
|
|
62
|
+
data += stream.read_exact(6)
|
|
63
|
+
elif data[3] == socks5.AddressType.IPV6:
|
|
64
|
+
data += stream.read_exact(18)
|
|
65
|
+
elif data[3] == socks5.AddressType.DOMAIN:
|
|
66
|
+
data += stream.read_exact(int.from_bytes(stream.read_exact(1)) + 2)
|
|
67
|
+
else: # pragma: no cover
|
|
68
|
+
raise ReplyError(f'Invalid address type: {data[3]:#02X}')
|
|
69
|
+
|
|
60
70
|
reply: socks5.ConnectReply = conn.receive(data)
|
|
61
71
|
return reply
|
|
@@ -200,7 +200,7 @@ class ConnectReply:
|
|
|
200
200
|
try:
|
|
201
201
|
reply = ReplyCode(data[1])
|
|
202
202
|
except IndexError:
|
|
203
|
-
raise ReplyError(
|
|
203
|
+
raise ReplyError('Malformed connect reply')
|
|
204
204
|
except ValueError:
|
|
205
205
|
raise ReplyError(f'Invalid reply code: {data[1]:#02X}')
|
|
206
206
|
|
|
@@ -211,7 +211,7 @@ class ConnectReply:
|
|
|
211
211
|
try:
|
|
212
212
|
rsv = data[2]
|
|
213
213
|
except IndexError:
|
|
214
|
-
raise ReplyError(
|
|
214
|
+
raise ReplyError('Malformed connect reply')
|
|
215
215
|
|
|
216
216
|
if rsv != RSV: # pragma: no cover
|
|
217
217
|
raise ReplyError(f'The reserved byte must be {RSV:#02X}')
|
|
@@ -221,7 +221,7 @@ class ConnectReply:
|
|
|
221
221
|
bnd_host_data = data[4:-2]
|
|
222
222
|
bnd_port_data = data[-2:]
|
|
223
223
|
except IndexError:
|
|
224
|
-
raise ReplyError(
|
|
224
|
+
raise ReplyError('Malformed connect reply')
|
|
225
225
|
|
|
226
226
|
if addr_type == AddressType.IPV4:
|
|
227
227
|
bnd_host = socket.inet_ntop(socket.AF_INET, bnd_host_data)
|
python_socks/_version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__title__ = 'python-socks'
|
|
2
|
-
__version__ = '2.
|
|
2
|
+
__version__ = '2.5.0'
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-socks
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: Core proxy (SOCKS4, SOCKS5, HTTP tunneling) functionality for Python
|
|
5
5
|
Home-page: https://github.com/romis2012/python-socks
|
|
6
6
|
Author: Roman Snegirev
|
|
7
7
|
Author-email: snegiryev@gmail.com
|
|
8
8
|
License: Apache 2
|
|
9
9
|
Keywords: socks socks5 socks4 http proxy asyncio trio curio anyio
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Description-Content-Type: text/markdown
|
|
12
11
|
License-File: LICENSE.txt
|
|
13
12
|
Provides-Extra: anyio
|
|
14
|
-
Requires-Dist: anyio
|
|
13
|
+
Requires-Dist: anyio <5.0.0,>=3.3.4 ; extra == 'anyio'
|
|
15
14
|
Provides-Extra: asyncio
|
|
16
|
-
Requires-Dist: async-timeout
|
|
15
|
+
Requires-Dist: async-timeout >=3.0.1 ; extra == 'asyncio'
|
|
17
16
|
Provides-Extra: curio
|
|
18
|
-
Requires-Dist: curio
|
|
17
|
+
Requires-Dist: curio >=1.4 ; extra == 'curio'
|
|
19
18
|
Provides-Extra: trio
|
|
20
|
-
Requires-Dist: trio
|
|
19
|
+
Requires-Dist: trio >=0.16.0 ; extra == 'trio'
|
|
21
20
|
|
|
22
21
|
## python-socks
|
|
23
22
|
|
|
24
|
-
[](https://
|
|
23
|
+
[](https://github.com/romis2012/python-socks/actions/workflows/ci.yml)
|
|
24
|
+
[](https://codecov.io/gh/romis2012/python-socks)
|
|
25
|
+
[](https://pypi.python.org/pypi/python-socks)
|
|
27
26
|
<!--
|
|
28
27
|
[](https://pepy.tech/project/python-socks)
|
|
29
28
|
-->
|
|
@@ -272,5 +271,3 @@ manager = ProxyPoolManager('socks5://user:password@127.0.0.1:1080')
|
|
|
272
271
|
response = manager.request('GET', 'https://check-host.net/ip')
|
|
273
272
|
print(response.data)
|
|
274
273
|
```
|
|
275
|
-
|
|
276
|
-
|
|
@@ -3,22 +3,22 @@ python_socks/_abc.py,sha256=_kK5iWNYpHuWRxhK-e6GQdVgRYxcioKIGnSYy2QzAK8,1422
|
|
|
3
3
|
python_socks/_errors.py,sha256=l2j03Zna_EJhNqF3yApTYuQ147BcY0k74pkT4HAlRp4,245
|
|
4
4
|
python_socks/_helpers.py,sha256=WTqOACKhJ80bCLWqeoXHPKp6YWCg66vLtai5AM7HJNY,2517
|
|
5
5
|
python_socks/_types.py,sha256=dgQifNf2mIwdKoX7YmI91H_lUsW9-Y0ZkZGlIV6_NNw,90
|
|
6
|
-
python_socks/_version.py,sha256=
|
|
6
|
+
python_socks/_version.py,sha256=3BvpvFG4zPWrLEEv8Ldtw2rIXRnWsseKynCtjZBLORw,49
|
|
7
7
|
python_socks/_connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
python_socks/_connectors/abc.py,sha256=1fgjPiv64UAMiJDsJXYr-GofPGhuHTwTzaodQfrzf7Q,397
|
|
9
9
|
python_socks/_connectors/factory_async.py,sha256=y9JGVk-ub9FMuQlIp2s5y95F7JMvA2fEdWGRKLUpRXc,997
|
|
10
10
|
python_socks/_connectors/factory_sync.py,sha256=h9s_BHLWgtuBk2rdA5vKaY4fMfdT_RszyQ-uoeTw-AE,984
|
|
11
11
|
python_socks/_connectors/http_async.py,sha256=sCkEporEkm5yr5S08JjzX9VHtXjEsIqrfIcuM_HvVdY,903
|
|
12
12
|
python_socks/_connectors/http_sync.py,sha256=BecdB5J8fIAMkNCgTgJqrdF82uIwBVjzoZmefKear34,878
|
|
13
|
-
python_socks/_connectors/socks4_async.py,sha256=
|
|
14
|
-
python_socks/_connectors/socks4_sync.py,sha256=
|
|
15
|
-
python_socks/_connectors/socks5_async.py,sha256=
|
|
16
|
-
python_socks/_connectors/socks5_sync.py,sha256=
|
|
13
|
+
python_socks/_connectors/socks4_async.py,sha256=dlQ-AwJ9gNBWMth-E4PxxfW17oWBF2Blxp71HeO80gM,1131
|
|
14
|
+
python_socks/_connectors/socks4_sync.py,sha256=m0KixzO5jQ6qHHtA5Muq7HcPjTdYPLM4AlTmWZr3SmY,1100
|
|
15
|
+
python_socks/_connectors/socks5_async.py,sha256=XufGdX5NRQridwOmUyMHwL0eNIygG8WHa583SMilFX4,2423
|
|
16
|
+
python_socks/_connectors/socks5_sync.py,sha256=r3Q-u8VjEoxWj0QuW7wuNQjyQzRc0Rcungs-6JcRlM8,2215
|
|
17
17
|
python_socks/_protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
python_socks/_protocols/errors.py,sha256=4XqU4AqgrWaedmUVGMjd6TvQKXv3mV0H76s5lf8aazY,150
|
|
19
19
|
python_socks/_protocols/http.py,sha256=h6uLgiNbqrd8HUk-nX5lOnCoYRjrZWaQ2CjbOB6QDHI,4451
|
|
20
20
|
python_socks/_protocols/socks4.py,sha256=QlWtGaPIa0jUfHreHIXZalHM9q4GQ684h7JSvxFwiJI,3023
|
|
21
|
-
python_socks/_protocols/socks5.py,sha256=
|
|
21
|
+
python_socks/_protocols/socks5.py,sha256=W1myJnlZOrGL3Osy-ttP1e9qjlHnJBwy2VQM8aL_Uu4,9700
|
|
22
22
|
python_socks/async_/__init__.py,sha256=TeBn5oirLy6aPoWcTc3OW9OxXh5Uv5LADwF_Y7f7HjY,64
|
|
23
23
|
python_socks/async_/_proxy_chain.py,sha256=A2LbxoRBgdHSikVJcrOAVDx79DT5Isq3RM_DiHTI8dM,824
|
|
24
24
|
python_socks/async_/anyio/__init__.py,sha256=pZnrND4Qd-pIGg7KI1ML41kZNkWHmkd3vrvwZZIJyk4,106
|
|
@@ -69,8 +69,8 @@ python_socks/sync/v2/_connect.py,sha256=eqMKsH2wVnGZhV24_t9QfsNhjbnKtnipj7wzSNct
|
|
|
69
69
|
python_socks/sync/v2/_proxy.py,sha256=-38o3QxE_FfJjQ88SK2YqBlWQgeNQQfYkGsFtYHWq94,3400
|
|
70
70
|
python_socks/sync/v2/_ssl_transport.py,sha256=MURwzvKu-S2-MI7o8KaZTvvBFOiiKIu5R0ERVIMvERE,6088
|
|
71
71
|
python_socks/sync/v2/_stream.py,sha256=Jq89x1xmIX3L_v-WyS1nRTItjTnYTcDcfDblsANxfJI,1544
|
|
72
|
-
python_socks-2.
|
|
73
|
-
python_socks-2.
|
|
74
|
-
python_socks-2.
|
|
75
|
-
python_socks-2.
|
|
76
|
-
python_socks-2.
|
|
72
|
+
python_socks-2.5.0.dist-info/LICENSE.txt,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
73
|
+
python_socks-2.5.0.dist-info/METADATA,sha256=mDM73fWuSRo_6HX2Cl0WLdUPOpOAI7gSJ_tyPW1WeCY,7018
|
|
74
|
+
python_socks-2.5.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
75
|
+
python_socks-2.5.0.dist-info/top_level.txt,sha256=7qyDAVwjTZ0sIYG1iatFbE-SLpWhONjaoMQ0Ib2DX0Q,13
|
|
76
|
+
python_socks-2.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|