public void ConsoleChecker(string s) { if (s == null) { return; } if (!grabbedIP) { if (s.Contains("] | https://") || s.Contains(".trycloudflare.com")) { int ind = s.IndexOf("] | https://"); string str2 = s.Substring(ind); str2 = str2.Replace("] | https://", ""); int ind2 = str2.IndexOf(".trycloudflare.com"); string ipString = str2.Substring(0, ind2); StatusUpdate.AddressData(ipString); StatusUpdate.SetStatus("Connected to Cloudflare network! Clients can now connect to the generated id."); grabbedIP = true; } } if (s.Contains("Sec-Websocket-Protocol:[chisel-v3]")) { clientsconnected++; StatusUpdate.SetStatus("Status: " + clientsconnected + " clients are now connected!"); } }
public void ProgramStarter() { if (!File.Exists(Path.GetTempPath() + "chisel.temp")) { Utils.WriteResourceToFile("chisel", "chisel.temp"); } chiselProcess = new Process { StartInfo = new ProcessStartInfo() { FileName = Path.GetTempPath() + "chisel.temp", UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true, Arguments = "client https://" + _ip + ".trycloudflare.com " + _port, } }; chiselProcess.OutputDataReceived += StandardUpdate; chiselProcess.ErrorDataReceived += StandardUpdate; chiselProcess.Start(); chiselProcess.BeginOutputReadLine(); chiselProcess.BeginErrorReadLine(); chiselProcess.WaitForExit(); if (!stop) { StatusUpdate.SetStatus("Status: Chisel Client Stopped!"); processParentThread = null; StatusUpdate.ErrorState(); } }
public void ProgramStarter() { if (!File.Exists(Path.GetTempPath() + "cloudflared.temp")) { Utils.WriteResourceToFile("cloudflared", "cloudflared.temp"); } cloudflaredProcess = new Process { StartInfo = new ProcessStartInfo() { FileName = Path.GetTempPath() + "cloudflared.temp", UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true, Arguments = "tunnel --url localhost:27463 --proxy-keepalive-timeout 24h" + " --proxy-tcp-keepalive 24h --proxy-connection-timeout 24h --proxy-expect-continue-timeout 24h" + " --compression-quality 10 --loglevel debug" } }; cloudflaredProcess.OutputDataReceived += StandardUpdate; cloudflaredProcess.ErrorDataReceived += StandardUpdate; cloudflaredProcess.Start(); cloudflaredProcess.BeginOutputReadLine(); cloudflaredProcess.BeginErrorReadLine(); cloudflaredProcess.WaitForExit(); if (!stop) { StatusUpdate.SetStatus("Status: Error, Cloudflare Service stopped! Check Debug Console."); processParentThread = null; StatusUpdate.ErrorState(); } }
private void button3_Click(object sender, EventArgs e) { cc.Stop(); StatusUpdate.SetStatus("Status: Offline."); this.button2.Enabled = true; this.textBox1.Enabled = true; this.address.ReadOnly = false; this.button1.Enabled = true; button4.Enabled = false; button3.Enabled = false; }
private void Error(string line) { StatusUpdate.SetStatus("Status: Offline."); this.button2.Enabled = true; this.textBox1.Enabled = true; this.address.ReadOnly = false; this.button1.Enabled = true; button4.Enabled = false; button3.Enabled = false; ct?.Stop(); cm?.Stop(); cc?.Stop(); }
private void button4_Click(object sender, EventArgs e) { cm.Stop(); ct.Stop(); StatusUpdate.SetStatus("Status: Server Stopped!"); this.button2.Enabled = true; this.textBox1.Enabled = true; this.address.ReadOnly = false; this.address.Text = ""; this.textBox1.Text = ""; this.button1.Enabled = true; button4.Enabled = false; button3.Enabled = false; }
public void ConsoleChecker(string s) { if (s == null) { return; } if (s.Contains("Connected (Latency ")) { string tem = s.Substring(s.IndexOf("Connected (Latency ")); tem = tem.Substring(0, tem.IndexOf("ms)")).Replace("Connected (Latency ", ""); StatusUpdate.SetStatus("Status: Connected to tunnel! Latency " + tem + " miliseconds. Specified ports mapped to localhost:<port>"); } if (s.Contains("Retrying in")) { StatusUpdate.SetStatus("Status: Disconnected from server! Attempting to reconnect!"); } }
private void button1_Click(object sender, EventArgs e) { //Client this.label2.Text = "Status: Connecting..."; this.button2.Enabled = false; this.textBox1.Enabled = false; this.address.ReadOnly = true; this.button1.Enabled = false; if (address.Text == "" || textBox1.Text == "") { MessageBox.Show("Please specify a Tunnel ID and/or ports to connect to!"); this.button2.Enabled = true; this.textBox1.Enabled = true; this.address.ReadOnly = false; this.button1.Enabled = true; button4.Enabled = false; button3.Enabled = false; StatusUpdate.SetStatus("Status: Offline."); return; } cc = new ChiselConnector(); cc.Start(address.Text, textBox1.Text); button3.Enabled = true; }
private void StandardUpdate(object sender, DataReceivedEventArgs e) { StatusUpdate.UpdateConsole(e.Data + "\n"); ConsoleChecker(e.Data); }