7

I want to incorporate Tor in my application in order to access a Tor hidden service. Make GET POST requests to the web server.

Is there any resource I can read to implement a simple Tor client that will allow me to send requests to a webservice ?

Roya
  • 3,240
  • 3
  • 19
  • 40
ring0
  • 181
  • 1
  • 6

2 Answers2

5

Tor is a socks5 proxy.

here is the socks5 rfc

here is a guide to how socks5 works with tor read this, it is VERY useful

if using sockets (I assume c++ uses sockets) you will need to

  1. connect to tor (127.0.0.1:9050 by default)
  2. Send authentication (5,1,0) see rfc part 3
  3. Receive the tor response (5,0) see rfc part 3
  4. Send Client's Connection request (5,1,0,3 + host length + a binary representation of the host and port) see rfc part 4
  5. receive the tor response (5,0,0,1,0,0,0,0,0,0) see rfc part 6 (there can be a bunch of errors here, so watch out)
  6. Send a binary representation of a http request to tor (Tor will forward this to the destination)
  7. Receive the http response (will send the header first then the web page)
puser
  • 510
  • 3
  • 14
2

For the protocol you should have a look at the tor specs.

If you understand Java you can also have a look at orchid or SilverTunnel-NG or just have a look at the tor codebase itself.

B4dT0bi
  • 399
  • 2
  • 7