Git Product home page Git Product logo

tor4net's Introduction

Zaczero/Tor4NET logo

Build Status GitHub Release NuGet Release License

An all-in-one solution to fulfill your .NET dark web needs.

Learn more about Tor here.
This library is built over Tor.NET - thanks to Chris Copeland.

๐ŸŒค๏ธ Installation

Install with NuGet (recommended)

Install-Package Tor4NET

Install with dotnet

dotnet add PROJECT package Tor4NET

Install manually

Browse latest GitHub release

๐Ÿ Getting started

Sample code

// 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 with 64-bit process.
// It's *very* important for the architecture of Tor process match the one used by your app.
// If no parameter is given Tor constructor will check Environment.Is64BitProcess property (the same one as below).
var is32Bit = !Environment.Is64BitProcess;

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();

Footer

๐Ÿ“ง Contact

๐Ÿ“ƒ License

tor4net's People

Contributors

zaczero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tor4net's Issues

Tor Exception

Hello, thanks for fixing previous bug.
I have another problem here:

SCENARIO
Need to download multiple contents multiple urls using Tor4Net and HTTPClient (not WebClient)

EXCEPTION
Tor.TorException: 'A command cannot be dispatched to a client which is no longer running'
at line
using (var client = tor.InitializeClient())

CODE

                var torDirectory = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Tor4NET");
            
    is32Bit = !Environment.Is64BitOperatingSystem;

                var tor = new Tor4NET.Tor(torDirectory, is32Bit);

                bool needInstall = tor.CheckForUpdates().Result;

                if (needInstall)
                {
                    tor.Install().Wait(); 
                }

                using (var client = tor.InitializeClient())  // <------EXCEPTION HERE
                {
                    HttpClientHandler httpClientHandler = new HttpClientHandler() { Proxy = client.Proxy.WebProxy };

                    for (int i = 1; i <= 100; i++)
                    {
                        using (HttpClient httpClient = new HttpClient(httpClientHandler))
                        {
                            string text= await httpClient.GetStringAsync(URL);
                            Console.WriteLine(text);
                        }
                    }
                }

STACKTRACE

   at Tor.Controller.Command`1.Dispatch(Client client)
   at Tor.Config.Configuration.SetValue(ConfigurationNames name, Object value)
   at Tor.Config.Configuration.set_ClientUseIPv6(Boolean value)
   at Tor4NET.Tor.InitializeClient(Boolean killExistingTor)
   at OperazioneEpausa.MainWindow.<<Esegui>b__1_0>d.MoveNext() in C:\Users\Gersis\source\repos\OperazioneEpausa\OperazioneEpausa\MainWindow.xaml.cs:line 57

Am I missing something or is it a bug? It works no more even on first run after compile.

Thank you.

Linux support

This repository is awesome, and yes it does support .NET Core and all but it only works for Windows since Tor is looking for Tor.exe.

Not Working

Hello,
first of all thank you for this lib.
I wish to use your library because of ease of use.
CONTEXT
I have Tor Browser installed in a folder on desktop.
I'm using VS2019 Community Edition on Win10 x64
I'm doing a WPF app targeting Framework 4.8

MINIBUG
in your Sample code I had to change Tor(torDirectory, is32Bit) with Tor4NET.Tor(torDirectory, is32Bit) this is a minimal problem but is quite confusing for very first useres because of "Tor is a namespace" error message by Intellisense)

BUG?
Your code:

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

throws an exception "404 not found".

Am I doing something wrong or is there some bug to fix?

Thank you

Client not initializing

when trying to use tor.InitializeClient(); i get the error "A command cannot be dispatched to a client which is no longer running", help?

Change client identity

How do I get a new identity?
After using the first identity created, I would like to switch to a different identity.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.