Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #8971

Closed (moved)
(moved)
Open
Created May 26, 2013 by Trac@tracbot

how to get through a proxy variable C#

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

Trac:
Username: Kreol2013

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking