protox-gatekeeper 0.2.0__py3-none-any.whl → 0.2.1__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.
- protox_gatekeeper/core.py +11 -2
- protox_gatekeeper/geo.py +1 -1
- {protox_gatekeeper-0.2.0.dist-info → protox_gatekeeper-0.2.1.dist-info}/METADATA +3 -2
- protox_gatekeeper-0.2.1.dist-info/RECORD +11 -0
- {protox_gatekeeper-0.2.0.dist-info → protox_gatekeeper-0.2.1.dist-info}/WHEEL +1 -1
- protox_gatekeeper-0.2.0.dist-info/RECORD +0 -11
- {protox_gatekeeper-0.2.0.dist-info → protox_gatekeeper-0.2.1.dist-info}/licenses/LICENSE +0 -0
- {protox_gatekeeper-0.2.0.dist-info → protox_gatekeeper-0.2.1.dist-info}/top_level.txt +0 -0
protox_gatekeeper/core.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
3
|
import requests
|
|
4
|
+
from requests.exceptions import RequestException
|
|
4
5
|
|
|
5
6
|
from protox_gatekeeper.session import make_tor_session
|
|
6
7
|
from protox_gatekeeper.verify import is_tor_exit, get_public_ip
|
|
@@ -33,8 +34,16 @@ class GateKeeper:
|
|
|
33
34
|
self._session = make_tor_session(port=socks_port)
|
|
34
35
|
|
|
35
36
|
# 3) Verify Tor routing
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
try:
|
|
38
|
+
if not is_tor_exit(session=self._session, timeout=timeout):
|
|
39
|
+
raise RuntimeError(
|
|
40
|
+
'Tor verification failed. Execution aborted.')
|
|
41
|
+
except RequestException as e:
|
|
42
|
+
logger.debug('Underlying Tor connection error', exc_info=e)
|
|
43
|
+
raise RuntimeError(
|
|
44
|
+
f'Tor SOCKS proxy is not reachable on 127.0.0.1:{socks_port}. '
|
|
45
|
+
'Start Tor or Tor Browser and try again.'
|
|
46
|
+
) from None
|
|
38
47
|
|
|
39
48
|
# 4) Measure Tor exit IP
|
|
40
49
|
self.exit_ip = get_public_ip(session=self._session, timeout=timeout)
|
protox_gatekeeper/geo.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: protox-gatekeeper
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Fail-closed Tor session enforcement for Python HTTP(S) traffic
|
|
5
5
|
Author: Tom Erik Harnes
|
|
6
6
|
License: MIT License
|
|
@@ -33,6 +33,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
33
33
|
Classifier: Programming Language :: Python :: 3.10
|
|
34
34
|
Classifier: Programming Language :: Python :: 3.11
|
|
35
35
|
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
36
37
|
Classifier: License :: OSI Approved :: MIT License
|
|
37
38
|
Classifier: Operating System :: OS Independent
|
|
38
39
|
Requires-Python: >=3.10
|
|
@@ -252,7 +253,7 @@ MIT License
|
|
|
252
253
|
|
|
253
254
|
## Status
|
|
254
255
|
|
|
255
|
-
- Version: **v0.2.
|
|
256
|
+
- Version: **v0.2.1**
|
|
256
257
|
- Phase 2 in progress
|
|
257
258
|
- API intentionally minimal
|
|
258
259
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
protox_gatekeeper/__init__.py,sha256=HisDC-NCbMlkrNkrLRdANILoBqw03ssqFp6BTsXm6Us,75
|
|
2
|
+
protox_gatekeeper/core.py,sha256=oMTTlSbzZ3OxpJ7DFY5sKjbIsffeQhV2bzjt5KLArAM,4414
|
|
3
|
+
protox_gatekeeper/geo.py,sha256=j1TY88OavTx5rqhWd-3hbhZzD51Gjtl726bqvnApA1Q,641
|
|
4
|
+
protox_gatekeeper/ops.py,sha256=Kmr8lU8Ohe81URHHNUlUJ0S71aZ1uGgyiztLBPsOUO4,690
|
|
5
|
+
protox_gatekeeper/session.py,sha256=0qGZF44EHr7CP-bSM0awtq4F-5LWiIb4w87mV7Yocfk,235
|
|
6
|
+
protox_gatekeeper/verify.py,sha256=bsHK3f16sRV8cHo30AY82SB1vb_Svu-US7IhghTSQ6E,452
|
|
7
|
+
protox_gatekeeper-0.2.1.dist-info/licenses/LICENSE,sha256=EE75Vy9_csDDBRXBF4uVQWxYu1YpzXTcmaeuVcPOjl4,1093
|
|
8
|
+
protox_gatekeeper-0.2.1.dist-info/METADATA,sha256=Is8hyTIs6kRhGdhLsRrw86rxI9PCtxMu6ZUetxVNZ6s,6942
|
|
9
|
+
protox_gatekeeper-0.2.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
10
|
+
protox_gatekeeper-0.2.1.dist-info/top_level.txt,sha256=KOVL4YUpiWQLGjCvx2SmP8VSsA6hPcEvKCd4k6kPl8s,18
|
|
11
|
+
protox_gatekeeper-0.2.1.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
protox_gatekeeper/__init__.py,sha256=HisDC-NCbMlkrNkrLRdANILoBqw03ssqFp6BTsXm6Us,75
|
|
2
|
-
protox_gatekeeper/core.py,sha256=SALDt7IhalzkOBQ2amjsmcMTf3IMiZYaWqQDU9B8FLo,4010
|
|
3
|
-
protox_gatekeeper/geo.py,sha256=AdjHfZqjP0w5ujHFI_WV7c5XWnDTzqkVL32KeJQojYo,641
|
|
4
|
-
protox_gatekeeper/ops.py,sha256=Kmr8lU8Ohe81URHHNUlUJ0S71aZ1uGgyiztLBPsOUO4,690
|
|
5
|
-
protox_gatekeeper/session.py,sha256=0qGZF44EHr7CP-bSM0awtq4F-5LWiIb4w87mV7Yocfk,235
|
|
6
|
-
protox_gatekeeper/verify.py,sha256=bsHK3f16sRV8cHo30AY82SB1vb_Svu-US7IhghTSQ6E,452
|
|
7
|
-
protox_gatekeeper-0.2.0.dist-info/licenses/LICENSE,sha256=EE75Vy9_csDDBRXBF4uVQWxYu1YpzXTcmaeuVcPOjl4,1093
|
|
8
|
-
protox_gatekeeper-0.2.0.dist-info/METADATA,sha256=0V4NABFLpC2NOWg_2v6gLWJTqfqRhrBP6_2h8GcJ4Uc,6890
|
|
9
|
-
protox_gatekeeper-0.2.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
10
|
-
protox_gatekeeper-0.2.0.dist-info/top_level.txt,sha256=KOVL4YUpiWQLGjCvx2SmP8VSsA6hPcEvKCd4k6kPl8s,18
|
|
11
|
-
protox_gatekeeper-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|