1

I'm working on a windows application that will make post get requests and interact with a hidden service. It will require Tor.exe running on the system listening, and thats fine.

I get that Tor listens on localhost port 9050 and it can be used if I set a application proxy on localhost:9050.

Edit: Ok lets change the question a bit.

Lets suppose I'm connected to Tor, if I already specified the hostname (onion URL) in my connection function how I send an http get request for a page ( like myurl.onion/folder/folder/page.php )? I tried using the plain send(socket, myrequest , myrequest lenght) but nothing happends and I see no activity.

If nobody posts I'm going to remove the question soon.

  • This question is 11 months old but for anybody that still has problems with this, you can follow this Tutorial – XEL Jun 17 '15 at 9:50
1

https://tor.stackexchange.com/a/2131/743

this is a description of what I did when I implemented (using c# instead of c++ though, but it should be the same)

here is a copy paste of the text

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)

if you are having specific problems at any point tell me in the comments.

the http request should contain

"GET " + urlPathAndQuery + " HTTP/1.1\r\n" +
"Host: " + urlHost + "\r\n" + 
"\r\n"

put in any other lines you want for your request, like User-agent or Accept-language

in c# the socket commands i used were

_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_socket.connect
_socket.send
_socket.receive

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.