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: https://github.com/sharpbrowser/Tor.NET

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: https://github.com/postworthy/SocksWebProxy

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: https://github.com/Zaczero/Tor4NET

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

Example:

// 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)
    tor.Install().Wait();

// 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).
tor.Uninstall();

4. TorSharp

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

Details:

  • 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.

Example:

// 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("http://api.ipify.org"));
await proxy.GetNewIdentityAsync();
Console.WriteLine(await httpClient.GetStringAsync("http://api.ipify.org"));
proxy.Stop();

5. Bookmarks for reading

TOR NEWNYM — автоматическая смена IP в TOR: https://www.evernote.com/l/AP2w9kuuAE9MfI8e0Z0w1XirITC3rOcJ2Os/

HOWTO use the Internet anonymously using Tor and Privoxy: https://www.evernote.com/l/AP1DcGmXndRJk749tCM0O_A2Q141t4Mgj38/

Прокси-сервер с помощью Tor. Основа для многопоточного парсинга: https://www.evernote.com/l/AP3QCtrV3E9JlZQh5cl0Mq_G84LGGQ2b1aI/

Включаем Tor на всю катушку: https://www.evernote.com/l/AP1EsKa8tS1E2aqdGAdJ4wz1w0Tc-vD2hhA/

No Comments
Comments to: Developments in C# under Tor

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

Good Reads

Worlwide

Trending

Advertiser

Login

Welcome to Typer

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join Typer
Registration is closed.