torwire 0.1.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.
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.5
2
+ Name: torwire
3
+ Version: 0.1.0
4
+ Summary: Route your Python app's traffic through Tor. No proxychains, no Privoxy, no manual setup.
5
+ Project-URL: Homepage, https://github.com/TechXploreGenSec/torwire
6
+ Project-URL: Documentation, https://github.com/TechXploreGenSec/torwire#readme
7
+ Project-URL: Repository, https://github.com/TechXploreGenSec/torwire
8
+ Project-URL: Issues, https://github.com/TechXploreGenSec/torwire/issues
9
+ Author: torwire contributors
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: anonymity,ip-rotation,privacy,proxy,socks5,tor
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Internet :: Proxy Servers
24
+ Classifier: Topic :: Security
25
+ Requires-Python: >=3.9
26
+ Requires-Dist: platformdirs>=3.0
27
+ Requires-Dist: stem>=1.8
28
+ Provides-Extra: aiohttp
29
+ Requires-Dist: aiohttp-socks>=0.9; extra == 'aiohttp'
30
+ Requires-Dist: aiohttp>=3.9; extra == 'aiohttp'
31
+ Provides-Extra: all
32
+ Requires-Dist: aiohttp-socks>=0.9; extra == 'all'
33
+ Requires-Dist: aiohttp>=3.9; extra == 'all'
34
+ Requires-Dist: httpx[socks]>=0.27; extra == 'all'
35
+ Requires-Dist: requests[socks]>=2.31; extra == 'all'
36
+ Requires-Dist: torwire-bin; extra == 'all'
37
+ Provides-Extra: bundled
38
+ Requires-Dist: torwire-bin; extra == 'bundled'
39
+ Provides-Extra: httpx
40
+ Requires-Dist: httpx[socks]>=0.27; extra == 'httpx'
41
+ Provides-Extra: requests
42
+ Requires-Dist: requests[socks]>=2.31; extra == 'requests'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # torwire
46
+
47
+ **Route your Python app's traffic through Tor — no proxychains, no Privoxy, no manual setup.**
48
+
49
+ `pip install torwire`, then three lines of code.
50
+
51
+ ---
52
+
53
+ ## Features
54
+
55
+ - **Zero manual setup** — Automatically finds, bundles (`torwire[bundled]`), or downloads and verifies the Tor binary.
56
+ - **Cross-platform** — Works identically on Windows, macOS, and Linux.
57
+ - **Dual proxy endpoints** — Exposes both `socks5h://` (remote DNS, leak-safe) and an in-process pure-Python `http://` forward proxy bridge.
58
+ - **Programmatic IP switching** — Call `tor.new_identity()` or use automatic `RotationPolicy` rules (`EveryNSeconds`, `EveryNRequests`, `OnStatus`, `OnException`).
59
+ - **Stream isolation** — Pass `isolated=True` to give parallel sessions distinct Tor circuits without hitting `NEWNYM` rate limits.
60
+ - **First-class HTTP client helpers** — Ready-made factories for `requests`, `httpx` (sync & async), `aiohttp`, and `proxy_env()` for `urllib` / subprocesses.
61
+ - **Self-healing & low-end friendly** — Built-in watchdog auto-restarts Tor if it crashes; `profile="low_end"` reduces memory and idle CPU.
62
+ - **CLI included** — `torwire start`, `torwire ip`, `torwire newnym`, `torwire download`, `torwire doctor`.
63
+
64
+ ---
65
+
66
+ ## Quick Start
67
+
68
+ ```bash
69
+ pip install "torwire[requests]"
70
+ ```
71
+
72
+ ```python
73
+ import torwire
74
+
75
+ with torwire.TorManager() as tor:
76
+ s = tor.requests_session()
77
+ print(s.get("https://api.ipify.org").text)
78
+
79
+ tor.new_identity()
80
+ print(s.get("https://api.ipify.org").text) # new exit IP
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Examples
86
+
87
+ ### Explicit Proxies (Requests / curl / HTTP Bridge)
88
+
89
+ ```python
90
+ import subprocess
91
+ import requests
92
+ import torwire
93
+
94
+ tor = torwire.TorManager(http_port=0).start()
95
+
96
+ # SOCKS5h for requests
97
+ requests.get("https://api.ipify.org", proxies=tor.proxies)
98
+
99
+ # HTTP/HTTPS bridge for tools that don't speak SOCKS5
100
+ subprocess.run(["curl", "-x", tor.http_url, "https://api.ipify.org"])
101
+
102
+ tor.stop()
103
+ ```
104
+
105
+ ### Country-Specific Exit Nodes
106
+
107
+ ```python
108
+ cfg = torwire.TorConfig(exit_countries=["{de}"], strict_exit=True)
109
+ with torwire.TorManager(cfg) as tor:
110
+ print(tor.current_ip())
111
+ ```
112
+
113
+ ### Auto-Rotation on Block or Interval
114
+
115
+ ```python
116
+ from torwire.rotation import Composite, EveryNSeconds, OnStatus
117
+
118
+ with torwire.TorManager() as tor:
119
+ tor.auto_rotate(Composite(EveryNSeconds(300), OnStatus({403, 429})))
120
+ s = tor.requests_session()
121
+ ...
122
+ ```
123
+
124
+ ### Parallel Workers with Isolated Circuits
125
+
126
+ ```python
127
+ from concurrent.futures import ThreadPoolExecutor
128
+
129
+ with torwire.TorManager() as tor:
130
+ def fetch(url):
131
+ with tor.requests_session(isolated=True) as s:
132
+ return s.get(url).text
133
+
134
+ with ThreadPoolExecutor(max_workers=8) as pool:
135
+ results = list(pool.map(fetch, urls))
136
+ ```
137
+
138
+ ### Async with `httpx`
139
+
140
+ ```python
141
+ async with torwire.TorManager() as tor:
142
+ async with tor.httpx_async_client(isolated=True) as client:
143
+ resp = await client.get("https://api.ipify.org")
144
+ print(resp.text)
145
+ ```
146
+
147
+ ### Attach to an Existing Tor / Tor Browser
148
+
149
+ ```python
150
+ tor = torwire.TorManager.attach(socks_port=9150, control_port=9151, password="")
151
+ print(tor.current_ip())
152
+ ```
153
+
154
+ ### Low-End / Always-On Devices
155
+
156
+ ```python
157
+ cfg = torwire.TorConfig(profile="low_end", persist_data=True, http_port=0)
158
+ with torwire.TorManager(cfg) as tor:
159
+ ...
160
+ ```
161
+
162
+ ---
163
+
164
+ ## CLI Usage
165
+
166
+ ```bash
167
+ torwire start --socks 9050 --http 8118 --country "{de}"
168
+ torwire ip
169
+ torwire newnym
170
+ torwire download
171
+ torwire doctor
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Configuration (`TorConfig`)
177
+
178
+ | Field | Default | Description |
179
+ |---|---|---|
180
+ | `tor_path` | `None` | Explicit path to `tor` binary |
181
+ | `auto_download` | `True` | Download Tor Expert Bundle if missing |
182
+ | `socks_port` | `0` | SOCKS5 port (`0` = auto free port) |
183
+ | `control_port` | `0` | Control port (`0` = auto free port) |
184
+ | `http_port` | `None` | HTTP bridge port (`None` = disabled, `0` = auto) |
185
+ | `data_dir` | `None` | Custom data directory (`None` = ephemeral temp dir) |
186
+ | `persist_data` | `False` | Keep consensus cache for faster warm restarts |
187
+ | `exit_countries` | `None` | Preferred exit country codes |
188
+ | `strict_exit` | `False` | Enforce `StrictNodes 1` |
189
+ | `bridges` | `None` | Pluggable transport bridge lines |
190
+ | `profile` | `"default"` | `"default"` or `"low_end"` |
191
+ | `watchdog` | `True` | Auto-restart Tor if it exits unexpectedly |
192
+
193
+ ---
194
+
195
+ ## Security, Privacy & Legal Notes
196
+
197
+ - **Remote DNS (`socks5h://`)** is enforced everywhere to prevent DNS leaks.
198
+ - **No telemetry** — URLs and headers are never logged by the HTTP bridge.
199
+ - **Disclaimer**: `torwire` provides no anonymity guarantees beyond what Tor itself provides.
200
+ - **Responsible use**: Tor exit bandwidth is donated by volunteers. Respect site terms of service, local laws, and rate-limit your requests.
201
+
202
+ ---
203
+
204
+ ## Requirements & License
205
+
206
+ - Python 3.9+
207
+ - Core dependencies: `stem`, `platformdirs`
208
+ - License: [MIT](LICENSE)
@@ -0,0 +1,24 @@
1
+ torwire/__init__.py,sha256=S0f0HSjdcCXnZT1DqctIjcYLA7SU9RZjh__t3O0f5Gg,1095
2
+ torwire/_platform.py,sha256=NkCVDktGOw7GGO3RP9MNFCQGDIhLs61d1yq9uj5m6TE,4856
3
+ torwire/binary.py,sha256=G6nmoAJU2LCMDgPFfGK6T5XKxEdl4PpK5sJikU3MIis,11698
4
+ torwire/bridge.py,sha256=GDIzH6juBb4Wt2Q5Hs0Q8deBCVQtiC3Cloo8piUgt8A,11969
5
+ torwire/checks.py,sha256=fe3kYIU2ZepTg5KU-kAHoG3RoNH1-OmZpD9cg55Z2VM,6172
6
+ torwire/cli.py,sha256=eVu6VCuRWh6rWw_AuExYVSnM1iZxJIQL6WuMZYHMkFM,6149
7
+ torwire/config.py,sha256=P8XCxG0J76q6xF0nMCASyWQyIUxkUyqPvMfsxaBXCzg,6150
8
+ torwire/controller.py,sha256=ty5Bd-Rjckw4LGR9keTlkFe1y2TdzKQxM7DwAaQ6Pks,6407
9
+ torwire/env.py,sha256=lfTtJKnzwOhw4Hd9miprwmZcFHov6WJt-eJ32VdWtx0,3189
10
+ torwire/errors.py,sha256=qKVoH3c_sE8Vz0PGXr2n1yRUcboUeA13YUZX_BYv-Gk,6562
11
+ torwire/manager.py,sha256=25n4cBUMjQObnvkJu5HRZMWcQ8874xwck07WKepIqCw,13082
12
+ torwire/pool.py,sha256=5hi3jufnGgBPhdzpaR6dWxhFf7VjgkpkT_fQ-DHY5HY,4533
13
+ torwire/process.py,sha256=noxWX5AzAvRt4A1tYbvQR6vEuq9RDuORLT6FDe57h6I,14004
14
+ torwire/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ torwire/rotation.py,sha256=OJ7Ow2DClXTqctuP_KEnseWKu3rACJ8kRujsb34F7RQ,4961
16
+ torwire/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ torwire/clients/aiohttp_.py,sha256=fC9D-jIDRQJsnsu0ybavmIGMNM4mLqkkGWy-39Jkiik,1633
18
+ torwire/clients/httpx_.py,sha256=3I7hgF-cXAeewrrG9liD_RMVfMAcYgu2PTrX9zxDcMc,2268
19
+ torwire/clients/requests_.py,sha256=IKpjiKEUSNyObs7wTSrBFwZQJK8DHPEy2DyqhVXG7fs,2065
20
+ torwire-0.1.0.dist-info/METADATA,sha256=7vWiEZ0Qr_JewFT5LwhZCjhOjofpuNXk6EElvYsZtLg,6710
21
+ torwire-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
22
+ torwire-0.1.0.dist-info/entry_points.txt,sha256=IEPpoEjhvG03MZ4JK--dcjykTPhsXf59Y0tGzY1awZ8,45
23
+ torwire-0.1.0.dist-info/licenses/LICENSE,sha256=e4pK3ObSYVsAtOjDAlXyIE1DSRat_hF0eCAb7Bmtusg,1077
24
+ torwire-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ torwire = torwire.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 torwire contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.