[tor-bugs] #8971 [Tor]: how to get through a proxy variable C#

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun May 26 18:32:59 UTC 2013


#8971: how to get through a proxy variable C#
-----------------------+----------------------------------------------------
 Reporter:  Kreol2013  |          Owner:     
     Type:  defect     |         Status:  new
 Priority:  normal     |      Milestone:     
Component:  Tor        |        Version:     
 Keywords:             |         Parent:     
   Points:             |   Actualpoints:     
-----------------------+----------------------------------------------------
 Greetings!
 Lord, help me to deal with the question of tor proxy.
 I found on the code. But it does not work. When trying to connect through
 a proxy request tor-a 501 error or incorrect address or proxy.

 Who faced please help.
 Sorry if wrote something wrong


 {{{
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Net;
 using System.Net.Sockets;
 using System.IO;
 using System.Text.RegularExpressions;
 using System.Threading;
 using System.Diagnostics;

 namespace Tor_console
 {
     class Program
     {
         static void Main(string[] args)
         {
             Process p = new Process();
             p.StartInfo = new ProcessStartInfo(@"d:\Tor\App\tor.exe",
 "ControlPort 9051 CircuitBuildTimeout 10");

             //p.StartInfo.WindowSt yle = ProcessWindowStyle.Hidden;
             p.Start();

             Thread.Sl eep(5000);

             Regex regex = new
 Regex("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}",
 RegexOptions.Multiline);

             do
             {

                 HttpWebRequest request =
 (HttpWebRequest)WebRequest.Create("http://2ip.ru");
                 request.Proxy = new WebProxy("127.0.0.1",9050);
                 //request.Proxy = new WebProxy("127.0.0.1:8118");
                 request.KeepAlive = false;

                 using (HttpWebResponse response =
 (HttpWebResponse)request.GetResponse())
                 {

                     using (var reader = new
 StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")))
                     {

                         string contenu = reader.ReadToEnd();
 Console.WriteLine(regex.Match(contenu).Groups[0].Value);

                     }

                 }

                 Console.Write("en attente : continuez ?");
                 string line = Console.ReadLine();

                 if (line != "y")
                     break;
             }
             while (true);

             p.Kill();
             Console.ReadLine();
         }
     }
 }
 }}}

 The idea of ​​the program to receive a proxy variable or a text file

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8971>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list