Developments in C# under Tor

The task was to make a proxy through the tor, and I will keep interesting findings. Maybe they will be useful.

1. Tor.Net

Reference to the repository:

A managed library to use the Tor network for SOCKS5 communications.

Launching a new Tor process:

ClientCreateParams createParams = new ClientCreateParams();
createParams.ConfigurationFile = "/path/to/config/file";
createParams.DefaultConfigurationFile = "/path/to/default/config/file";
createParams.ControlPassword = ""; // Tor does not use a control password by default, so this can be null or blank
createParams.ControlPort = 9051;
createParams.Path = "/path/to/tor/exe";

Client client = Client.Create(createParams);

2. SocksWebProxy

Reference to the repository:

SocksWebProxy is a C# project build to make http communication over the Tor network simple and easy for C# projects.

Project Features

  • C#
  • .NET Standard & .NET Core
  • Simple Interface for WebClient & WebRequest (Just assign a new SocksWebProxy to the *.Proxy attribute)
  • No Need for Privoxy or similar service to translate http traffic to tor
  • Easily Communicate over Tor with C#

3. Tor4NET

Reference to repository:

An all-in-one solution to fulfill your .NET dark web needs. This library is built over Tor.NET 


// Directory where Tor files are going to be stored.
// If the directory does not exist, it will create one.
var torDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Tor4NET");

// Use 64-bit Tor on 64-bit system (optional).
var is32Bit = !Environment.Is64BitOperatingSystem;

var tor = new Tor(torDirectory, is32Bit);

// Check for updates and install latest version.
if (tor.CheckForUpdates().Result)

// Disposing the client will exit the Tor process automatically.
using (var client = tor.InitializeClient())
    var http = new WebClient
        // And now let's use Tor as a proxy.
        Proxy = client.Proxy.WebProxy

    var html = http.DownloadString("http://facebookcorewwwi.onion");

// Finally, you can remove all previously downloaded Tor files (optional).

4. TorSharp

Use Tor for your C# HTTP clients. Tor + Privoxy = ❤️ All you need is client code that can use a simple HTTP proxy.


  • Supports:
    • .NET Core (.NET Standard 2.0 and later)
    • .NET Framework (.NET Framework 4.5 and later)
    • Windows
      • ✔️ Windows 10 version 1903
      • Older Windows should work too
    • Linux
      • ✔️ Ubuntu 18.04
      • ✔️ Ubuntu 16.04
      • ✔️ Debian 10
      • ✔️ Debian 9 (confirmed by user)
      • ⚠️ CentOS 7 supported via ExecutablePathOverride (see below)
    • ❌ Mac OS X support is not planned.
  • Uses Privoxy to redirect HTTP proxy traffic to Tor.
  • Uses virtual desktops to manage Tor and Privoxy processes.
  • Optionally downloads the latest version of Tor and Privoxy.


// configure
var settings = new TorSharpSettings
    ZippedToolsDirectory = Path.Combine(Path.GetTempPath(), "TorZipped"),
    ExtractedToolsDirectory = Path.Combine(Path.GetTempPath(), "TorExtracted"),
    PrivoxyPort = 1337,
    TorSocksPort = 1338,
    TorControlPort = 1339,
    TorControlPassword = "foobar"

// download tools
await new TorSharpToolFetcher(settings, new HttpClient()).FetchAsync();

// execute
var proxy = new TorSharpProxy(settings);
var handler = new HttpClientHandler
    Proxy = new WebProxy(new Uri("http://localhost:" + settings.PrivoxyPort))
var httpClient = new HttpClient(handler);
await proxy.ConfigureAndStartAsync();
Console.WriteLine(await httpClient.GetStringAsync(""));
await proxy.GetNewIdentityAsync();
Console.WriteLine(await httpClient.GetStringAsync(""));

5. Bookmarks for reading

TOR NEWNYM — автоматическая смена IP в TOR:

HOWTO use the Internet anonymously using Tor and Privoxy:

Прокси-сервер с помощью Tor. Основа для многопоточного парсинга:

Включаем Tor на всю катушку:

About: Morozov Dmitry

My specialisation is software engineer. I am 35 years old and have been working in the IT field for over 15 years. I have accumulated experience in programming, project management, training and administration.