[tor-dev] New python Tor client implementation
Damian Johnson
atagar at torproject.org
Thu Oct 17 21:16:07 UTC 2019
Thanks James, this is awesome! Very well done. Out of curiosity why
sidestep any use of Stem? It supports encoding/decoding most tor cell
types...
Yours: https://github.com/torpyorg/torpy/blob/master/torpy/cells.py
Mine: https://gitweb.torproject.org/stem.git/tree/stem/client/cell.py
If you'd care to integrate any of this functionality into Stem I'd be
delighted to work with you.
Cheers! -Damian
On Thu, Oct 17, 2019 at 7:05 AM James Brown <jbrown299 at yandex.com> wrote:
>
> Hello all,
>
> Recently I finished a pure python implementation of the Tor client. It's called torpy (https://github.com/torpyorg/torpy).
>
> It offers handy API, supports v2 hidden services with "basic" and "stealth" authorization protocol. Works with python 3.6+.
> It has no dependencies on the original C Tor client and Stem. For more information please take a look at README on github.
>
> Here is a quick example of how to use the library:
> ```python
> from torpy import TorClient
>
> hostname = 'ifconfig.me' # or onion-services as well, for example 'http://facebookcorewwwi.onion'
> tor = TorClient()
>
> # Choose random guard node and create 3-hops circuit
> with tor.create_circuit(3) as circuit:
> # Create tor stream to host
> with circuit.create_stream((hostname, 80)) as stream:
> # Now we can communicate with host
> stream.send(b'GET / HTTP/1.0\r\nHost: %s\r\n\r\n' % hostname.encode())
> recv = stream.recv(1024)
> ```
>
> Please list torpy project at https://trac.torproject.org/projects/tor/wiki/doc/ListOfTorImplementations
>
> It would be nice if you try the client. I look forward to any feedback.
>
> Cheers.
>
>
> _______________________________________________
> tor-dev mailing list
> tor-dev at lists.torproject.org
> https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev
More information about the tor-dev
mailing list