D
D
Dmitry Choban2016-09-17 19:40:53
C++ / C#
Dmitry Choban, 2016-09-17 19:40:53

Tor.Net WebProxy example?

Guys, maybe someone worked with the library
www.codeproject.com/Articles/1072864/Tor-NET-A-man...
Here is my non-working code, tell me what I'm doing wrong?

Process[] previous = Process.GetProcessesByName("tor");
            if (previous != null && previous.Length > 0)
            {
                foreach (Process process in previous)
                    process.Kill();
            }
 
            ClientCreateParams createParameters = new ClientCreateParams();
            createParameters.ConfigurationFile = @"TorBrowser\Data\Tor\torrc";
            createParameters.ControlPassword = "";
            createParameters.ControlPort = 9051;
            createParameters.DefaultConfigurationFile = "";
            createParameters.Path = @"TorBrowser\Tor\tor.exe";
 
            createParameters.SetConfig(ConfigurationNames.AvoidDiskWrites, true);
            createParameters.SetConfig(ConfigurationNames.GeoIPFile, Path.Combine(Environment.CurrentDirectory, @"TorBrowser\Data\Tor\geoip"));
            createParameters.SetConfig(ConfigurationNames.GeoIPv6File, Path.Combine(Environment.CurrentDirectory, @"TorBrowser\Data\Tor\geoip6"));
 
            client = Client.Create(createParameters);
 

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://api.ipify.org/?format=json");
 
            if (client.Proxy.IsRunning)
                request.Proxy = client.Proxy.WebProxy;
 
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
 
                // Get the stream associated with the response.
                System.IO.Stream receiveStream = response.GetResponseStream();
                // Pipes the stream to a higher level stream reader with the required encoding format. 
                StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
                var html = readStream.ReadToEnd();
                var h = html;
            }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question