All Projects → joelverhagen → Torsharp

joelverhagen / Torsharp

Licence: mit
Use Tor for your C# HTTP clients. Tor + Privoxy = ❤️

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Torsharp

Abot
Cross Platform C# web crawler framework built for speed and flexibility. Please star this project! +1.
Stars: ✭ 1,961 (+989.44%)
Mutual labels:  netcore
Omnixaml
The freakin' awesome Cross-platform XAML Framework
Stars: ✭ 163 (-9.44%)
Mutual labels:  netcore
Hei.captcha
一个跨平台的图形验证码生成工具包/.net core
Stars: ✭ 172 (-4.44%)
Mutual labels:  netcore
Safe Chat
IRC-style chat demo featuring full-stack F#, Akka.Streams, Akkling, Fable, Elmish, Websockets and .NET Core
Stars: ✭ 157 (-12.78%)
Mutual labels:  netcore
Aurora Api Project
Aurora is a project developed in .NET Core, where it aims to show how to create something using an architecture, in layers, simple and approaching, in a simplistic way, some concepts such as DDD.
Stars: ✭ 162 (-10%)
Mutual labels:  netcore
Netcorecms
NetCoreCMS is a modular theme supported Content Management System developed using ASP.Net Core 2.0 MVC. Which is also usable as web application framework. This project is still under development. Please do not use before it's first release.
Stars: ✭ 165 (-8.33%)
Mutual labels:  netcore
Sharpbgfx
C# bindings for the bgfx graphics library
Stars: ✭ 154 (-14.44%)
Mutual labels:  netcore
Torrequest
Simple Python interface for HTTP(s) requests over Tor
Stars: ✭ 175 (-2.78%)
Mutual labels:  tor
Dockerize.net
.NET Cli Tool to package your .NET Core Application into a docker image: 'dotnet dockerize'
Stars: ✭ 162 (-10%)
Mutual labels:  netcore
Mqttnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 2,486 (+1281.11%)
Mutual labels:  netcore
Discord.net
An unofficial .Net wrapper for the Discord API (http://discordapp.com)
Stars: ✭ 2,253 (+1151.67%)
Mutual labels:  netcore
Box2dsharp
A C# port of Box2D
Stars: ✭ 161 (-10.56%)
Mutual labels:  netcore
Dockerfile
some personally made dockerfile
Stars: ✭ 2,021 (+1022.78%)
Mutual labels:  tor
Nacos Sdk Csharp
🌹 nacos csharp sdk
Stars: ✭ 157 (-12.78%)
Mutual labels:  netcore
Magicpad
MagicPad is an encryption suite for beginners. It is designed to be run standalone via the browser or executable (Electron).
Stars: ✭ 174 (-3.33%)
Mutual labels:  tor
Helloabp
ABP vNext + vue-element-admin入门级项目实战
Stars: ✭ 153 (-15%)
Mutual labels:  netcore
Revo
Event Sourcing, CQRS and DDD framework for C#/.NET Core.
Stars: ✭ 162 (-10%)
Mutual labels:  netcore
Civone
An open source implementation of Sid Meier's Civilization.
Stars: ✭ 176 (-2.22%)
Mutual labels:  netcore
Ormi
A Light-ORM for accesing WMI
Stars: ✭ 176 (-2.22%)
Mutual labels:  netcore
Ansible Relayor
An Ansible Role for Tor Relay Operators
Stars: ✭ 165 (-8.33%)
Mutual labels:  tor

TorSharp

Use Tor for your C# HTTP clients. Tor + Privoxy = ❤️

All you need is client code that can use a simple HTTP proxy.

NuGet version NuGet downloads

Build

Notice

This product is produced independently from the Tor® anonymity software and carries no guarantee from The Tor Project about quality, suitability or anything else.

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
    • ❌ Mac OS X support is not planned. I don't have a Mac 😕
  • 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.

Install

Install-Package Knapcode.TorSharp

Example

// configure
var settings = new TorSharpSettings
{
   ZippedToolsDirectory = Path.Combine(Path.GetTempPath(), "TorZipped"),
   ExtractedToolsDirectory = Path.Combine(Path.GetTempPath(), "TorExtracted"),
   PrivoxySettings = { Port = 1337 },
   TorSettings =
   {
      SocksPort = 1338,
      ControlPort = 1339,
      ControlPassword = "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.PrivoxySettings.Port))
};
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();

FAQ

The tool fetcher is throwing an exception. What do I do?

This most likely is happening because the URLs where we fetch Tor or Privoxy from are down or have changed. I would recommend:

  1. Open an issue so I can look into it.

  2. Work around the issue by setting up the tools manually and not using TorSharpToolFetcher. See below.

  3. Investigate the issue yourself. The TorSharp.Sandbox project is helpful for this. Pull requests accepted 🏆.

How do I set up the tools manually?

If you don't want to use the TorSharpToolFetcher to download the latest version of the tools for you or if you want to use a specific version of Tor and Privoxy, follow these steps.

  1. Make a directory that will hold the zipped Tor and Privoxy binaries.
  2. Put a Tor Win32 ZIP in that folder with the file name like: tor-win32-{version}.zip
    • {version} must be parsable as a System.Version meaning it is major.minor[.build[.revision]].
    • Example: tor-win32-0.3.5.8.zip
    • The ZIP is expected to have Tor\tor.exe.
  3. Put a Privoxy Win32 ZIP in that folder with a file name like: privoxy-win32-{version}.zip
    • Again, {version} must be parsable as a System.Version.
    • Example: privoxy-win32-3.0.26.zip
    • The ZIP is expected to have privoxy.exe.
  4. Initialize a TorSharpSettings instance where ZippedToolsDirectory is the directory created above.
  5. Pass this settings instance to the TorSharpProxy constructor.

Privoxy fetched by TorSharp fails to start? Try installing missing dependencies.

It's possible some expected shared libraries aren't there. Try to look at the error message and judge which library needs to be installed from your distro's package repository.

Debian 10

This includes Microsoft's .NET Core 3.1 runtime image mcr.microsoft.com/dotnet/core/runtime:3.1 and Microsoft's .NET 5.0 runtime image mcr.microsoft.com/dotnet/runtime:5.0.

Problem: On Debian 10 the following errors may appear:

/tmp/TorExtracted/privoxy-linux64-3.0.29/usr/sbin/privoxy: error while loading shared libraries: libbrotlidec.so.1: cannot open shared object file: No such file or directory

/tmp/TorExtracted/privoxy-linux64-3.0.29/usr/sbin/privoxy: error while loading shared libraries: libmbedtls.so.12: cannot open shared object file: No such file or directory

Solution: install two missing dependencies. Thanks for the heads up, @cod3rshotout!

[[email protected]]$ sudo apt-get install -y libbrotli1 libmbedtls-dev

Privoxy fetched by TorSharp fails to start? Try ExecutablePathOverride.

On Linux, the Privoxy binaries fetched seem to be built for the latest Debian and Ubuntu distributions. I can confirm that some other distributions don't work.

I'm no Linux expert but my guess is that there are missing shared libraries that are different on the running platform than the Debian platform that Privoxy was compiled for. The easiest workaround is to install Privoxy to your system and set the TorSharpSettings.PrivoxySetting.ExecutablePathOverride configuration setting to "privoxy" (i.e. use Privoxy from PATH).

After you install it, make sure privoxy is in the PATH.

[[email protected]]$ which privoxy
/usr/sbin/privoxy

After this is done, just configure TorSharp to use the system Privoxy with the ExecutablePathOverride setting:

var settings = new TorSharpSettings();
settings.PrivoxySettings.ExecutablePathOverride = "privoxy";

Note that you may encounter warning or error messages in the output due to new configuration being used with an older executable. I haven't ran into any problems with this myself but it's possible things could get weird.

CentOS 7

Problem: the following error appears:

/tmp/TorExtracted/privoxy-linux64-3.0.28/usr/sbin/privoxy: error while loading shared libraries: libpcre.so.3: cannot open shared object file: No such file or directory

Solution: install Privoxy. It is available on epel-release.

[[email protected]]$ sudo yum install epel-release -y
...
[[email protected]]$ sudo yum install privoxy -y

Debian 9

This includes Microsoft's .NET Core 2.1 runtime image: mcr.microsoft.com/dotnet/core/runtime:2.1.

Problem: the following errors may appear:

/tmp/TorExtracted/privoxy-linux64-3.0.29/usr/sbin/privoxy: error while loading shared libraries: libbrotlidec.so.1: cannot open shared object file: No such file or directory

/tmp/TorExtracted/privoxy-linux64-3.0.29/usr/sbin/privoxy: error while loading shared libraries: libmbedtls.so.12: cannot open shared object file: No such file or directory

Solution: install Privoxy. It is available in the default source lists.

[[email protected]]$ sudo apt-get install privoxy -y
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].