0

recently, I want to analysis the Tor source code,but I don't known how and where to begin. If any volunteer knows how to do it, please share some experience with me. I'd like to know the details of Tor's work through source code analysis, such as which part of the source code is the link selection, which part of the source code is the relay node from the directory server, which part of the source code is the exit node selection, and so on.There is also a question to make some changes about the Tor source code and to recompile. thank you very much if you can give me some suggestions

3
  • 1
    This is very broad. What do you hope to achieve that isn't in the documentation?
    – Chenmunka
    Commented Oct 11, 2019 at 14:26
  • I'd suggest starting at int main and working your way down from there.
    – womble
    Commented Oct 11, 2019 at 23:27
  • Through the analysis of the source code, I want to achieve similar to the relay node of Tor's selection,and exit node controllable's selection, increase the encryption algorithm of Tor link and so on.and I want to know if you have any Tor source analysis experience and useful tools, as a novice this is a huge project for me.
    – czxing
    Commented Oct 12, 2019 at 1:23

1 Answer 1

1

You can find Tor's source code on Github. Most of the cool stuff is in the src folder. Some parts of the code are accompanied by comments that tell you what it does. This is a sample code snippet from src/feature/relay/dns.h

/** How long do we cache/tell clients to cache DNS records when no TTL is
 * known? */
#define DEFAULT_DNS_TTL (30*60)

int dns_init(void);
int has_dns_init_failed(void);

Alternatively, check out this paper which analyses Tor's code step by step. Here, you can see functions and explanations of what they do. To see the code under each function, simply search it in Tor's Github repo. Here's an example screenshot from the paper:

Example description

To make edits to the code, you can either fork or download Tor's repo from Github.

1
  • Thank you very much!!! let me look at the paper first
    – czxing
    Commented Oct 12, 2019 at 11:58

Not the answer you're looking for? Browse other questions tagged .