private void connectToolStripMenuItem_Click(object sender, EventArgs e) { // Attempt to connect IPEndPoint ip = new IPEndPoint(s.ip, s.port); try { serv.Connect(ip); } catch (Exception ex) // connect failed { MessageBox.Show(ex.Message); MessageBox.Show("Could not connect to tor client on " + s.ip.ToString() + ":" + s.port.ToString() + ". Please ensure that the tor client is running", "Connection failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // authenticate ServTools servTools = new ServTools(); servTools.Send(serv, commands.Login); // start the console update thread cThread = new Thread(new ThreadStart(cUpdate)); cThread.Name = "cThread"; cThread.Start(); }
private void newIdentityToolStripMenuItem_Click(object sender, EventArgs e) { ServTools st = new ServTools(); st.Send(serv, commands.NewIdentity); if (st.ReceiveData(serv).Contains("250 OK")) MessageBox.Show("New identity successfully requested", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("Failed to request new identity", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void btnConsoleSend_Click(object sender = null, EventArgs e = null) { ServTools st = new ServTools(); string cmd = txtConsoleCommand.Text; // write to command to console updateConsole("\r\n> " + cmd + "\r\n"); st.Send(serv, cmd + "\r\n"); if (cmd == "quit") st.ShutdownServer(serv, cThread); // results will be automatically displayed. all we need to do is clear the command buffer txtConsoleCommand.Text = null; }