1
1
This repository is home to Pluggable Transport Adapter, a Python 3 package that
2
- interfaces with Tor's pluggable transports, and obfs4-standalone-tunnel, a set
3
- of scripts to run pluggable transports as TCP tunnel.
2
+ interfaces with Tor's pluggable transports, plus a script to run pluggable
3
+ transports as TCP tunnel.
4
4
5
- ** This project REQUIRES Python 3.4 or higher.** It only depends on the standard
6
- library, not on any optional packages .
5
+ ** This project REQUIRES Python 3.4.2 or higher.** Other than the standard
6
+ library, it has no dependencies .
7
7
8
8
## Motivation
9
9
The motivation for this project comes from the desire of running
@@ -15,34 +15,42 @@ so I implemented enough of [Tor's pluggable transport specification]
15
15
support standalone operation as server or client, in a way that's hopefully
16
16
reusable for other projects.
17
17
18
- # pluggabletransportadapter
18
+ # ptadapter
19
+
20
+ The package used to be called ` pluggabletransportadapter ` , but that name is
21
+ rather long and cumbersome, so it has been renamed to the shorter version.
19
22
20
23
This package implements Tor's pluggable transport protocol, in order to run
21
24
and control pluggable transports (PT).
22
25
23
- This package requires Python 3.4 or higher.
26
+ This package requires Python 3.4.2 or higher.
27
+
28
+ These classes are implemented: ` PTServerAdapter ` , ` PTClientSOCKSAdapter ` ,
29
+ ` PTClientStreamAdapter ` , ` PTClientListeningAdapter ` .
24
30
25
- It implements 3 classes: ` PluggableTransportServerAdapter ` ,
26
- ` PluggableTransportClientSOCKSAdapter ` and ` PluggableTransportClientTCPAdapter ` .
31
+ ` PTServerAdapter ` runs PT executable as a server, listening on TCP ports for
32
+ obfuscated traffic and forwards plaintext traffic to a given address: port .
33
+ Obfuscated traffic hit the PT executable directly, and unobfuscated traffic
34
+ is emitted by the PT executable; the script has no idea about client
35
+ connections.
27
36
28
- ` PluggableTransportServerAdapter ` runs PT executable as a server, listening on
29
- a TCP port for obfuscated traffic and forwards plaintext traffic to a given
30
- address : port .
37
+ ` PTClientSOCKSAdapter ` runs PT executable as a client, where the PT listens on
38
+ an address : port of its choice, accepts either SOCKS4 or SOCKS5 connection
39
+ attempts, obfuscates the traffic and forwards it to a server .
31
40
32
- ` PluggableTransportClientSOCKSAdapter ` runs PT executable as a client, where the
33
- PT listens on address : port of its choice, accepts either SOCKS4 or SOCKS5
34
- connection attempts, obfuscates the traffic and forwards it to a server .
41
+ ` PTClientStreamAdapter ` does what ` PTClientSOCKSAdapter ` does, and provides
42
+ convenient methods for creating StreamReader/Writer pairs that talks through the
43
+ PT .
35
44
36
- ` PluggableTransportClientTCPAdapter ` runs PT executable as a client and
37
- additionally handles SOCKS reverse proxying, accepting plaintext traffic
38
- directly on a TCP address : port .
45
+ ` PTClientListeningAdapter ` does what ` PTClientStreamAdapter ` does. In addition
46
+ it listens for plaintext traffic on a TCP address : port and forwards them
47
+ through the PT .
39
48
40
- # obfs4-standalone-tunnel
49
+ # The script
41
50
42
- The two scripts, ` standalone_server.py ` and ` standalone_client.py ` , are wrappers
43
- around the ` pluggabletransportadapter ` libary. They allow running pluggable
44
- transports such as ` obfs4proxy ` as standalone servers and clients, creating
45
- obfuscated tunnels carrying TCP traffic.
51
+ The script ` standalone.py ` allows running pluggable transports such as
52
+ ` obfs4proxy ` as standalone servers and clients. Run one copy as client and
53
+ another as server to create obfuscated tunnels.
46
54
47
55
## Requirements
48
56
@@ -56,7 +64,7 @@ to download a zip package, or just checkout with git.
56
64
distributions you can install them from the package repository. For Windows, it
57
65
might be easiest to extract the binary from Tor Browser Bundle.
58
66
59
- * Python 3.4 or higher for your operating system.
67
+ * Python 3.4.2 or higher for your operating system.
60
68
61
69
## Configuration
62
70
@@ -71,12 +79,20 @@ persistent and writable. After first run, the server will save its keys to the
71
79
states directory and read it from there for future runs. It will also write the
72
80
appropriate client parameters there.
73
81
74
- # Ideas for Future Work
82
+ ## Some notes
75
83
76
- Now that the reverse proxy is written in ` asyncio ` , it might make sense to rewrite
77
- the subprocess handling asynchronously as well.
84
+ The reason I'm targetting Python 3.4.2 is that Debian Jessie has that version
85
+ in the official repository, and it has ` loop.create_task() ` so I don't have to
86
+ use ` asyncio.async() ` where ` async ` is a reserved keyword in Python 3.5 and
87
+ later.
88
+
89
+ Since communication to the PT executable is now via ` asyncio ` subprocess pipes,
90
+ on Windows the event loop must be a ` ProactorEventLoop ` , not the default
91
+ ` SelectorEventLoop ` .
92
+
93
+ # Ideas for Future Work
78
94
79
- Also, with the script now being able to communicate to PT directly, implementing
80
- Extended ORPort support should not be too difficult. Extended ORPort would give
81
- us more detailed logging info for connected clients, as well as per-connection
82
- bandwidth control .
95
+ Extended ORPort support is still work in progress. Turns out per-connection
96
+ bandwidth control and throttling was never implemented in Tor and PTs, so the
97
+ only benefit of ExtORPort is that the server script can know where clients are
98
+ connecting from, and potentially refuse connections .
0 commit comments