views:

318

answers:

1

I'm trying to use TOR as a generic proxy but it fails

Right now I'm trying with python but I'm pretty sure it would be the same with any other language. I can connect to other proxies with python so I get how it "should" be done.

I found a list of TOR entry nodes

h = httplib.HTTPConnection("one entry node", 80)
h.connect()
h.request("GET", "www.google.com")
resp = h.getresponse()
page = resp.read()

unfortunately that doesnt work, i get redirected to a 404 message.

I'm just not sure of what I'm doing wrong. Probably the list of entry nodes cannot be connected just like that. I'm searching on how to do it properly but i dont get any documentation about how to program applications with tor

edit : ditch the tor proxy list, i don't know why i should want to know about it.

the "entry node" is yourself, after you've installed the (windows) vidalia client and privoxy (all bundled as one)

httplib.HTTPConnection("one entry node", 80)

becomes

httplib.HTTPConnection("127.0.0.1", 8118)

and voilà, everything is routed through TOR

+3  A: 

First, make sure you are using the correct node location and port. Most proxies use ports other than 80. Second, specify the protocol to use with the correct URL on your request string.

Under normal circumstances, your code should work if it looks something like this one:

h = httplib.HTTPConnection("138.45.68.134", 8080)
h.connect()
h.request("GET", "http://www.google.com")
resp = h.getresponse()
page = resp.read()
h.close();

You can also use socket as an alternative but that's another issue and it's even more complicated than the one above.

Hope that helps! :-)

Jhourlad Estrella
Did you have this solution up and running with TOR nodes?
Eric
This solution works with conventional proxies but does not with TOR nodes, I think I would have to encapsulate the whole TOR protocol
Eric