15

I want to develop an application which allows users to also communicate over the Tor network. I have done some Googling but I can't seem to find an API or SDK. How does one develop a Tor application? Are there any libraries out there?

EDIT: I see there are no libraries or API's available to use Tor. What would I need to know in order to write this Tor application?

Jeroen
  • 15,257
  • 12
  • 59
  • 102
  • What do you mean by application that uses TOR network? TOR is simply a HTTP/S PROXY over BitTorrent protocol network. You can download sources from [here](https://www.torproject.org/projects/vidalia.html.en), and check how it is made. – Flash Thunder Apr 09 '14 at 17:55
  • 1
    @FlashThunder Then how do you control the Tor network? How do you do stuff like getting a new identity? – Jeroen Apr 09 '14 at 17:58
  • @JeroenBollen You authenticate against a proxy, check out the code snippet I linked to below. – photoionized Apr 09 '14 at 18:00
  • @JeroenBollen still don't understand what do you mean... you want to build TOR client? Or use TOR network? Those are two different things. You can't get new identity from application that uses original TOR client, as original TOR client does that. – Flash Thunder Apr 10 '14 at 08:34
  • @FlashThunder Sorry for my ignorance but are there any reference pages describing the differences? – Jeroen Apr 10 '14 at 10:22
  • @JeroenBollen you are connecting thorugh a TOR client? Vidalia? [This one?](https://www.torproject.org/images/Screenshot-Vidalia-Control-Panel.png) ? If so, then you can't change your identity from within your application. – Flash Thunder Apr 10 '14 at 13:05
  • @FlashThunder I'm connecting to through through the service... – Jeroen Apr 10 '14 at 13:10
  • @JeroenBollen there is `stem` a python library available at torproject – Marcel May 28 '14 at 18:24

2 Answers2

9

This is how:

https://stem.torproject.org/

from https://stem.torproject.org/faq.html#what-is-stem

"Stem is a Python controller library that you can use to interact with Tor. With it you can write scripts and applications with capabilities similar to Vidalia and arm.

From a technical standpoint, Stem is a Python implementation of Tor's directory and control specifications. To get started see our tutorials!"

Marcel
  • 1,266
  • 7
  • 18
4

To my knowledge Tor does not have an actual API or SDK.

Tor does come with a SOCKS interface though. So the simplest way of making an app work over the Tor network is to use a SOCKS proxy with the default Tor installation on a user's computer.

For an example using Go, check out Pond.

photoionized
  • 5,092
  • 20
  • 23
  • I'm browsing through the code but it's all very confusing to me as there is no documentation saying what every function does, and the fact it's using Go isn't helping... :s – Jeroen Apr 09 '14 at 18:02
  • Your code is going to be different based on whatever language you're using, but the basic gist is that you open up a connection to the SOCKS interface and use it for making your requests. The above link isn't an end-all-be-all, don't even know what language you're using, but just meant as an illustrative link--you see a connection established, authenticated against, and then all requests made through it. – photoionized Apr 09 '14 at 18:15
  • @JeroenBollen For example, using c and winsocks on a Windows machine: http://stackoverflow.com/questions/18150561/send-and-receive-via-socks5-c#answer-18155608 – photoionized Apr 09 '14 at 18:22
  • Well I tried connecting to TOR using the SOCKS5 protocol, on port 9050. Tor always seems to reply with authentication method 0, which means no authentication required. What is causing this? – Jeroen Apr 09 '14 at 19:50
  • 1
    Read the following, under 1.1 Extent of support, SOCKS5, third bullet point: https://gitweb.torproject.org/torspec.git?a=blob_plain;hb=HEAD;f=socks-extensions.txt authentication using SOCKS5 is not mandatory. – photoionized Apr 09 '14 at 20:02
  • But if I tell it I only want name/password authentication, why does it pick no authentication anyways? Can I simply ignore this? – Jeroen Apr 09 '14 at 20:04
  • @JeroenBollen in your program, during the login step, you have to specify which authentication methods you're going to use. – photoionized Apr 09 '14 at 20:04
  • @JeroenBollen You need to request username/password as your authentication method during the login step, use 0x02 as your authentication method and then read https://tools.ietf.org/html/rfc1929 to see how to handle the authentication negotiation. – photoionized Apr 09 '14 at 20:11
  • there is stem.torproject.org – Marcel May 28 '14 at 15:25