protox-gatekeeper 0.1.1__tar.gz → 0.2.0__tar.gz
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-0.1.1 → protox_gatekeeper-0.2.0}/PKG-INFO +71 -14
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/README.md +60 -13
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper/core.py +25 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper.egg-info/PKG-INFO +71 -14
- protox_gatekeeper-0.2.0/pyproject.toml +41 -0
- protox_gatekeeper-0.1.1/pyproject.toml +0 -19
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/LICENSE +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper/__init__.py +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper/geo.py +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper/ops.py +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper/session.py +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper/verify.py +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper.egg-info/SOURCES.txt +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper.egg-info/dependency_links.txt +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper.egg-info/requires.txt +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper.egg-info/top_level.txt +0 -0
- {protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: protox-gatekeeper
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Fail-closed Tor session enforcement for Python HTTP(S) traffic
|
|
5
5
|
Author: Tom Erik Harnes
|
|
6
6
|
License: MIT License
|
|
@@ -25,6 +25,16 @@ License: MIT License
|
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
27
|
|
|
28
|
+
Project-URL: Homepage, https://github.com/ProtoXCode/protox-gatekeeper
|
|
29
|
+
Project-URL: Repository, https://github.com/ProtoXCode/protox-gatekeeper
|
|
30
|
+
Project-URL: Issues, https://github.com/ProtoXCode/protox-gatekeeper/issues
|
|
31
|
+
Keywords: tor,privacy,networking,security,proxy
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
28
38
|
Requires-Python: >=3.10
|
|
29
39
|
Description-Content-Type: text/markdown
|
|
30
40
|
License-File: LICENSE
|
|
@@ -32,24 +42,28 @@ Requires-Dist: requests
|
|
|
32
42
|
Requires-Dist: pysocks
|
|
33
43
|
Dynamic: license-file
|
|
34
44
|
|
|
45
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
46
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
47
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
48
|
+
|
|
35
49
|
# ProtoX GateKeeper
|
|
36
50
|
|
|
37
51
|
**ProtoX GateKeeper** is a small, opinionated Python library that enforces
|
|
38
|
-
**fail
|
|
52
|
+
**fail-closed Tor routing** for HTTP(S) traffic.
|
|
39
53
|
|
|
40
54
|
The goal is simple:
|
|
41
55
|
|
|
42
56
|
> If Tor is not active and verified, **nothing runs**.
|
|
43
57
|
|
|
44
|
-
GateKeeper is designed to be *fire
|
|
58
|
+
GateKeeper is designed to be *fire-and-forget*: create a client once, then perform network operations with a hard guarantee that traffic exits through the Tor network.
|
|
45
59
|
|
|
46
60
|
---
|
|
47
61
|
|
|
48
62
|
## What GateKeeper Is
|
|
49
63
|
|
|
50
|
-
- A **Tor
|
|
51
|
-
- A thin wrapper around `requests.Session`
|
|
52
|
-
- Fail
|
|
64
|
+
- A **Tor-verified HTTP client**
|
|
65
|
+
- A thin wrapper around `requests.Session` with safe helpers
|
|
66
|
+
- Fail-closed by default (no silent clearnet fallback)
|
|
53
67
|
- Observable (exit IP, optional geo info)
|
|
54
68
|
- Suitable for scripts, tooling, and automation
|
|
55
69
|
|
|
@@ -77,6 +91,12 @@ On Windows this usually means **Tor Browser** running in the background.
|
|
|
77
91
|
|
|
78
92
|
## Installation
|
|
79
93
|
|
|
94
|
+
### From PyPI
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install protox-gatekeeper
|
|
98
|
+
```
|
|
99
|
+
|
|
80
100
|
### From source (development)
|
|
81
101
|
|
|
82
102
|
```bash
|
|
@@ -121,6 +141,20 @@ This confirms:
|
|
|
121
141
|
|
|
122
142
|
---
|
|
123
143
|
|
|
144
|
+
### HTTP requests
|
|
145
|
+
|
|
146
|
+
GateKeeper can also be used as a Tor-verified HTTP client:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
with GateKeeper() as gk:
|
|
150
|
+
response = gk.get("https://httpbin.org/ip")
|
|
151
|
+
print(response.json())
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
All requests are guaranteed to use the verified Tor session.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
124
158
|
## API Overview
|
|
125
159
|
|
|
126
160
|
### `GateKeeper(...)`
|
|
@@ -134,7 +168,7 @@ gk = GateKeeper(
|
|
|
134
168
|
|
|
135
169
|
**Parameters**:
|
|
136
170
|
- `socks_port` *(int)* – Tor SOCKS port (default: `9150`)
|
|
137
|
-
- `geo` *(bool)* – Enable best
|
|
171
|
+
- `geo` *(bool)* – Enable best-effort Tor exit geolocation (optional)
|
|
138
172
|
|
|
139
173
|
Raises `RuntimeError` if Tor routing cannot be verified.
|
|
140
174
|
|
|
@@ -153,13 +187,37 @@ gk.download(url, target_path)
|
|
|
153
187
|
|
|
154
188
|
---
|
|
155
189
|
|
|
190
|
+
### `get(url, **kwargs)`
|
|
191
|
+
|
|
192
|
+
Performs a Tor-verified HTTP GET request.
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
response = gk.get(url, timeout=10)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Returns a standard `requests.Response`.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### `post(url, data=None, json=None, **kwargs)`
|
|
203
|
+
|
|
204
|
+
Performs a Tor-verified HTTP POST request.
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
response = gk.post(url, json={"key": "value"})
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Returns a standard `requests.Response`.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
156
214
|
## Design Principles
|
|
157
215
|
|
|
158
216
|
- **Fail closed**: no Tor → no execution
|
|
159
217
|
- **Single verification point** (during construction)
|
|
160
218
|
- **No global state**
|
|
161
219
|
- **No logging configuration inside the library**
|
|
162
|
-
- **Session reuse without re
|
|
220
|
+
- **Session reuse without re-verification**
|
|
163
221
|
|
|
164
222
|
Logging is emitted by the library, but **configured by the application**.
|
|
165
223
|
|
|
@@ -181,8 +239,8 @@ The library does **not** call `logging.basicConfig()` internally.
|
|
|
181
239
|
## Security Notes
|
|
182
240
|
|
|
183
241
|
- Tor exit IPs may rotate over time
|
|
184
|
-
- Geo information is best
|
|
185
|
-
- GateKeeper guarantees routing, not anonymity
|
|
242
|
+
- Geo information is best-effort and may be unavailable (rate-limits, CAPTCHAs)
|
|
243
|
+
- GateKeeper guarantees transport routing, not anonymity
|
|
186
244
|
|
|
187
245
|
---
|
|
188
246
|
|
|
@@ -194,14 +252,13 @@ MIT License
|
|
|
194
252
|
|
|
195
253
|
## Status
|
|
196
254
|
|
|
197
|
-
- Version: **v0.
|
|
198
|
-
- Phase
|
|
255
|
+
- Version: **v0.2.0**
|
|
256
|
+
- Phase 2 in progress
|
|
199
257
|
- API intentionally minimal
|
|
200
258
|
|
|
201
259
|
Future versions may add optional features such as:
|
|
202
260
|
- circuit rotation
|
|
203
261
|
- ControlPort support
|
|
204
|
-
- higher
|
|
262
|
+
- higher-level request helpers
|
|
205
263
|
|
|
206
264
|
Without breaking the core contract.
|
|
207
|
-
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
2
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
3
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
4
|
+
|
|
1
5
|
# ProtoX GateKeeper
|
|
2
6
|
|
|
3
7
|
**ProtoX GateKeeper** is a small, opinionated Python library that enforces
|
|
4
|
-
**fail
|
|
8
|
+
**fail-closed Tor routing** for HTTP(S) traffic.
|
|
5
9
|
|
|
6
10
|
The goal is simple:
|
|
7
11
|
|
|
8
12
|
> If Tor is not active and verified, **nothing runs**.
|
|
9
13
|
|
|
10
|
-
GateKeeper is designed to be *fire
|
|
14
|
+
GateKeeper is designed to be *fire-and-forget*: create a client once, then perform network operations with a hard guarantee that traffic exits through the Tor network.
|
|
11
15
|
|
|
12
16
|
---
|
|
13
17
|
|
|
14
18
|
## What GateKeeper Is
|
|
15
19
|
|
|
16
|
-
- A **Tor
|
|
17
|
-
- A thin wrapper around `requests.Session`
|
|
18
|
-
- Fail
|
|
20
|
+
- A **Tor-verified HTTP client**
|
|
21
|
+
- A thin wrapper around `requests.Session` with safe helpers
|
|
22
|
+
- Fail-closed by default (no silent clearnet fallback)
|
|
19
23
|
- Observable (exit IP, optional geo info)
|
|
20
24
|
- Suitable for scripts, tooling, and automation
|
|
21
25
|
|
|
@@ -43,6 +47,12 @@ On Windows this usually means **Tor Browser** running in the background.
|
|
|
43
47
|
|
|
44
48
|
## Installation
|
|
45
49
|
|
|
50
|
+
### From PyPI
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install protox-gatekeeper
|
|
54
|
+
```
|
|
55
|
+
|
|
46
56
|
### From source (development)
|
|
47
57
|
|
|
48
58
|
```bash
|
|
@@ -87,6 +97,20 @@ This confirms:
|
|
|
87
97
|
|
|
88
98
|
---
|
|
89
99
|
|
|
100
|
+
### HTTP requests
|
|
101
|
+
|
|
102
|
+
GateKeeper can also be used as a Tor-verified HTTP client:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
with GateKeeper() as gk:
|
|
106
|
+
response = gk.get("https://httpbin.org/ip")
|
|
107
|
+
print(response.json())
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
All requests are guaranteed to use the verified Tor session.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
90
114
|
## API Overview
|
|
91
115
|
|
|
92
116
|
### `GateKeeper(...)`
|
|
@@ -100,7 +124,7 @@ gk = GateKeeper(
|
|
|
100
124
|
|
|
101
125
|
**Parameters**:
|
|
102
126
|
- `socks_port` *(int)* – Tor SOCKS port (default: `9150`)
|
|
103
|
-
- `geo` *(bool)* – Enable best
|
|
127
|
+
- `geo` *(bool)* – Enable best-effort Tor exit geolocation (optional)
|
|
104
128
|
|
|
105
129
|
Raises `RuntimeError` if Tor routing cannot be verified.
|
|
106
130
|
|
|
@@ -119,13 +143,37 @@ gk.download(url, target_path)
|
|
|
119
143
|
|
|
120
144
|
---
|
|
121
145
|
|
|
146
|
+
### `get(url, **kwargs)`
|
|
147
|
+
|
|
148
|
+
Performs a Tor-verified HTTP GET request.
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
response = gk.get(url, timeout=10)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Returns a standard `requests.Response`.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### `post(url, data=None, json=None, **kwargs)`
|
|
159
|
+
|
|
160
|
+
Performs a Tor-verified HTTP POST request.
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
response = gk.post(url, json={"key": "value"})
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Returns a standard `requests.Response`.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
122
170
|
## Design Principles
|
|
123
171
|
|
|
124
172
|
- **Fail closed**: no Tor → no execution
|
|
125
173
|
- **Single verification point** (during construction)
|
|
126
174
|
- **No global state**
|
|
127
175
|
- **No logging configuration inside the library**
|
|
128
|
-
- **Session reuse without re
|
|
176
|
+
- **Session reuse without re-verification**
|
|
129
177
|
|
|
130
178
|
Logging is emitted by the library, but **configured by the application**.
|
|
131
179
|
|
|
@@ -147,8 +195,8 @@ The library does **not** call `logging.basicConfig()` internally.
|
|
|
147
195
|
## Security Notes
|
|
148
196
|
|
|
149
197
|
- Tor exit IPs may rotate over time
|
|
150
|
-
- Geo information is best
|
|
151
|
-
- GateKeeper guarantees routing, not anonymity
|
|
198
|
+
- Geo information is best-effort and may be unavailable (rate-limits, CAPTCHAs)
|
|
199
|
+
- GateKeeper guarantees transport routing, not anonymity
|
|
152
200
|
|
|
153
201
|
---
|
|
154
202
|
|
|
@@ -160,14 +208,13 @@ MIT License
|
|
|
160
208
|
|
|
161
209
|
## Status
|
|
162
210
|
|
|
163
|
-
- Version: **v0.
|
|
164
|
-
- Phase
|
|
211
|
+
- Version: **v0.2.0**
|
|
212
|
+
- Phase 2 in progress
|
|
165
213
|
- API intentionally minimal
|
|
166
214
|
|
|
167
215
|
Future versions may add optional features such as:
|
|
168
216
|
- circuit rotation
|
|
169
217
|
- ControlPort support
|
|
170
|
-
- higher
|
|
218
|
+
- higher-level request helpers
|
|
171
219
|
|
|
172
220
|
Without breaking the core contract.
|
|
173
|
-
|
|
@@ -69,6 +69,31 @@ class GateKeeper:
|
|
|
69
69
|
""" Returns the Tor exit IP address. """
|
|
70
70
|
return self.exit_ip
|
|
71
71
|
|
|
72
|
+
def get(self, url: str, **kwargs) -> requests.Response:
|
|
73
|
+
"""
|
|
74
|
+
Passes a GET request to the Tor Gatekeeper.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
url (str): The url to request.
|
|
78
|
+
**kwargs: Additional parameters to pass to the GET request.
|
|
79
|
+
"""
|
|
80
|
+
logger.info(f'[Tor {self.tor_exit}] GET {url}')
|
|
81
|
+
return self._session.get(url=url, **kwargs)
|
|
82
|
+
|
|
83
|
+
def post(self, url: str, data=None, json=None,
|
|
84
|
+
**kwargs) -> requests.Response:
|
|
85
|
+
"""
|
|
86
|
+
Passes a POST request to the Tor Gatekeeper.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
url (str): The url to post to.
|
|
90
|
+
data (dict, optional): The data to post.
|
|
91
|
+
json (dict, optional): The json data to post.
|
|
92
|
+
**kwargs: Additional parameters to pass to the POST request.
|
|
93
|
+
"""
|
|
94
|
+
logger.info(f'[Tor {self.tor_exit}] POST {url}')
|
|
95
|
+
return self._session.post(url=url, data=data, json=json, **kwargs)
|
|
96
|
+
|
|
72
97
|
def download(self, url: str, target_path: str, timeout: int = 30,
|
|
73
98
|
chunk_size: int = 8192):
|
|
74
99
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: protox-gatekeeper
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Fail-closed Tor session enforcement for Python HTTP(S) traffic
|
|
5
5
|
Author: Tom Erik Harnes
|
|
6
6
|
License: MIT License
|
|
@@ -25,6 +25,16 @@ License: MIT License
|
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
27
|
|
|
28
|
+
Project-URL: Homepage, https://github.com/ProtoXCode/protox-gatekeeper
|
|
29
|
+
Project-URL: Repository, https://github.com/ProtoXCode/protox-gatekeeper
|
|
30
|
+
Project-URL: Issues, https://github.com/ProtoXCode/protox-gatekeeper/issues
|
|
31
|
+
Keywords: tor,privacy,networking,security,proxy
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
28
38
|
Requires-Python: >=3.10
|
|
29
39
|
Description-Content-Type: text/markdown
|
|
30
40
|
License-File: LICENSE
|
|
@@ -32,24 +42,28 @@ Requires-Dist: requests
|
|
|
32
42
|
Requires-Dist: pysocks
|
|
33
43
|
Dynamic: license-file
|
|
34
44
|
|
|
45
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
46
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
47
|
+
[](https://pypi.org/project/protox-gatekeeper/)
|
|
48
|
+
|
|
35
49
|
# ProtoX GateKeeper
|
|
36
50
|
|
|
37
51
|
**ProtoX GateKeeper** is a small, opinionated Python library that enforces
|
|
38
|
-
**fail
|
|
52
|
+
**fail-closed Tor routing** for HTTP(S) traffic.
|
|
39
53
|
|
|
40
54
|
The goal is simple:
|
|
41
55
|
|
|
42
56
|
> If Tor is not active and verified, **nothing runs**.
|
|
43
57
|
|
|
44
|
-
GateKeeper is designed to be *fire
|
|
58
|
+
GateKeeper is designed to be *fire-and-forget*: create a client once, then perform network operations with a hard guarantee that traffic exits through the Tor network.
|
|
45
59
|
|
|
46
60
|
---
|
|
47
61
|
|
|
48
62
|
## What GateKeeper Is
|
|
49
63
|
|
|
50
|
-
- A **Tor
|
|
51
|
-
- A thin wrapper around `requests.Session`
|
|
52
|
-
- Fail
|
|
64
|
+
- A **Tor-verified HTTP client**
|
|
65
|
+
- A thin wrapper around `requests.Session` with safe helpers
|
|
66
|
+
- Fail-closed by default (no silent clearnet fallback)
|
|
53
67
|
- Observable (exit IP, optional geo info)
|
|
54
68
|
- Suitable for scripts, tooling, and automation
|
|
55
69
|
|
|
@@ -77,6 +91,12 @@ On Windows this usually means **Tor Browser** running in the background.
|
|
|
77
91
|
|
|
78
92
|
## Installation
|
|
79
93
|
|
|
94
|
+
### From PyPI
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install protox-gatekeeper
|
|
98
|
+
```
|
|
99
|
+
|
|
80
100
|
### From source (development)
|
|
81
101
|
|
|
82
102
|
```bash
|
|
@@ -121,6 +141,20 @@ This confirms:
|
|
|
121
141
|
|
|
122
142
|
---
|
|
123
143
|
|
|
144
|
+
### HTTP requests
|
|
145
|
+
|
|
146
|
+
GateKeeper can also be used as a Tor-verified HTTP client:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
with GateKeeper() as gk:
|
|
150
|
+
response = gk.get("https://httpbin.org/ip")
|
|
151
|
+
print(response.json())
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
All requests are guaranteed to use the verified Tor session.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
124
158
|
## API Overview
|
|
125
159
|
|
|
126
160
|
### `GateKeeper(...)`
|
|
@@ -134,7 +168,7 @@ gk = GateKeeper(
|
|
|
134
168
|
|
|
135
169
|
**Parameters**:
|
|
136
170
|
- `socks_port` *(int)* – Tor SOCKS port (default: `9150`)
|
|
137
|
-
- `geo` *(bool)* – Enable best
|
|
171
|
+
- `geo` *(bool)* – Enable best-effort Tor exit geolocation (optional)
|
|
138
172
|
|
|
139
173
|
Raises `RuntimeError` if Tor routing cannot be verified.
|
|
140
174
|
|
|
@@ -153,13 +187,37 @@ gk.download(url, target_path)
|
|
|
153
187
|
|
|
154
188
|
---
|
|
155
189
|
|
|
190
|
+
### `get(url, **kwargs)`
|
|
191
|
+
|
|
192
|
+
Performs a Tor-verified HTTP GET request.
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
response = gk.get(url, timeout=10)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Returns a standard `requests.Response`.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### `post(url, data=None, json=None, **kwargs)`
|
|
203
|
+
|
|
204
|
+
Performs a Tor-verified HTTP POST request.
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
response = gk.post(url, json={"key": "value"})
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Returns a standard `requests.Response`.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
156
214
|
## Design Principles
|
|
157
215
|
|
|
158
216
|
- **Fail closed**: no Tor → no execution
|
|
159
217
|
- **Single verification point** (during construction)
|
|
160
218
|
- **No global state**
|
|
161
219
|
- **No logging configuration inside the library**
|
|
162
|
-
- **Session reuse without re
|
|
220
|
+
- **Session reuse without re-verification**
|
|
163
221
|
|
|
164
222
|
Logging is emitted by the library, but **configured by the application**.
|
|
165
223
|
|
|
@@ -181,8 +239,8 @@ The library does **not** call `logging.basicConfig()` internally.
|
|
|
181
239
|
## Security Notes
|
|
182
240
|
|
|
183
241
|
- Tor exit IPs may rotate over time
|
|
184
|
-
- Geo information is best
|
|
185
|
-
- GateKeeper guarantees routing, not anonymity
|
|
242
|
+
- Geo information is best-effort and may be unavailable (rate-limits, CAPTCHAs)
|
|
243
|
+
- GateKeeper guarantees transport routing, not anonymity
|
|
186
244
|
|
|
187
245
|
---
|
|
188
246
|
|
|
@@ -194,14 +252,13 @@ MIT License
|
|
|
194
252
|
|
|
195
253
|
## Status
|
|
196
254
|
|
|
197
|
-
- Version: **v0.
|
|
198
|
-
- Phase
|
|
255
|
+
- Version: **v0.2.0**
|
|
256
|
+
- Phase 2 in progress
|
|
199
257
|
- API intentionally minimal
|
|
200
258
|
|
|
201
259
|
Future versions may add optional features such as:
|
|
202
260
|
- circuit rotation
|
|
203
261
|
- ControlPort support
|
|
204
|
-
- higher
|
|
262
|
+
- higher-level request helpers
|
|
205
263
|
|
|
206
264
|
Without breaking the core contract.
|
|
207
|
-
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "protox-gatekeeper"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Fail-closed Tor session enforcement for Python HTTP(S) traffic"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
|
|
13
|
+
dependencies = [
|
|
14
|
+
"requests",
|
|
15
|
+
"pysocks"
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
keywords = ["tor", "privacy", "networking", "security", "proxy"]
|
|
28
|
+
|
|
29
|
+
authors = [
|
|
30
|
+
{ name = "Tom Erik Harnes" }
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/ProtoXCode/protox-gatekeeper"
|
|
35
|
+
Repository = "https://github.com/ProtoXCode/protox-gatekeeper"
|
|
36
|
+
Issues = "https://github.com/ProtoXCode/protox-gatekeeper/issues"
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
markers = [
|
|
40
|
+
"integration: requires Tor running locally"
|
|
41
|
+
]
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "protox-gatekeeper"
|
|
7
|
-
version = "0.1.1"
|
|
8
|
-
description = "Fail-closed Tor session enforcement for Python HTTP(S) traffic"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
license = { file = "LICENSE" }
|
|
11
|
-
requires-python = ">=3.10"
|
|
12
|
-
dependencies = [
|
|
13
|
-
"requests",
|
|
14
|
-
"pysocks"
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
authors = [
|
|
18
|
-
{ name = "Tom Erik Harnes" }
|
|
19
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{protox_gatekeeper-0.1.1 → protox_gatekeeper-0.2.0}/protox_gatekeeper.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|