Exemplo n.º 1
0
        public TorHandler(bool block = false, string path = "tor", int httpsport = 8080)
        {
            this.httpsport = httpsport;
            this.torprocess.StartInfo.FileName               = path;
            this.torprocess.StartInfo.UseShellExecute        = false;
            this.torprocess.StartInfo.CreateNoWindow         = true;
            this.torprocess.StartInfo.RedirectStandardOutput = true;

            int[] ports = utils.get_random_available_ports(2);
            this.socksport   = ports[0];
            this.controlport = ports[1];

            this.torprocess.StartInfo.Arguments = string.Format("--socksport {0} --controlport {1}", this.socksport, this.controlport);
            this.torprocess.Start();

            if (!block)
            {
                new Thread(check_readiness).Start();
            }
            else
            {
                check_readiness();
            }

            this.torConnectionHandler = new TorConnectionHandler(this.socksport);
        }
Exemplo n.º 2
0
 public HttpsServer(TorConnectionHandler torConnectionHandler, int httpsport)
 {
     this.httpsport = httpsport;//= utils.get_random_available_ports(1)[0];
     this.startserver();
     this.torConnectionHandler = torConnectionHandler;
 }