[tor-dev] Example of how a stream of RELAY_DATA cells would work?

Eli Vakrat eli at vakrat.com
Tue May 5 17:05:36 UTC 2020


Hi again everyone! It's Eli ...

So thanks to Teor and Nick's help, my python client (tor OP) is finally
able to successfully establish a three-hop circuit with any TOR relays in
the whole public network!

Now It's on to the Data Cells...
As of writing this, I can send and receive the proper RELAY_BEGIN and
RELAY_CONNECTED to and from my exit node, but I'm not quite sure what to do
next...

Do I just start sending RELAY_DATA cells (where the "data" of the cell is
literally the encoded HTTP requests)?

I've tried connecting to 'www.facebook.com:443'  with the RELAY_BEGIN cells
as a test (I do get a Relay Connected Cell so at least I know that part
works).

After getting back the RELAY_CONNECTED cell, I send a RELAY_DATA cell with
the data of the cell being the following 'utf-8' encoded string:

* #######this is how i wrote the literal in python#### *
*'GET / HTTP/1.1\r\nHost: www.facebook.com
<http://www.facebook.com>\r\nUser-Agent:
python-requests/2.23.0\r\nAccept-Encoding: gzip, deflate\r\nAccept:
*/*\r\nConnection: keep-alive\r\n\r\n\r\n'.encode() *

What I get back is a short couple of bytes:


*\x15\x03\x03\x00\x02\x022*

I had no idea what this meant but after digging around a bit I found that
this seems to be some part of the TLS handshake that is used in HTTPS.

So now two questions arise:

1. Is this a good TLS response? What does it mean exactly?

2. Generally speaking, is this how the RELAY_DATA cells are supposed to be
sent and received?
Just to clarify it would be great if I could get an exact example of how
the stream of data should look. For example, if someone could maybe break
down the steps of how a basic HTTP GET request would work through a TOR
circuit (starting from sending a RELAY_BEGIN cell) that would help me
tremendously.

Thanks again to everyone who've helped me so far, and thanks in advance to
anyone with an answer to any of my questions!

Regards,
Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-dev/attachments/20200505/e98128ed/attachment.html>


More information about the tor-dev mailing list