Ejemplo n.º 1
0
        private void timerUpdate_Tick(object sender, EventArgs e)
        {
            // Check for changes in connectivity and apply the relevant UI changes
            disconnectToolStripMenuItem.Enabled = (serv.Connected) ? true : false;
            connectToolStripMenuItem.Enabled = (serv.Connected) ? false : true;
            lblSummary_status.ForeColor = (serv.Connected) ? Color.Green : Color.Red;
            lblSummary_status.Text = (serv.Connected) ? "Connected" : "Disconnected";
            torToolStripMenuItem.Enabled = (serv.Connected) ? true : false;
            btnConsoleSend.Enabled = (serv.Connected) ? true : false;

            // If connected run the update commands
            if (serv.Connected)
            {
                ServTools st = new ServTools();
                //st.Send("
            }
        }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ServTools st = new ServTools();
     st.ShutdownServer(serv, cThread);
     Application.Exit();
 }
Ejemplo n.º 4
0
 private void disconnectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ServTools st = new ServTools();
     st.ShutdownServer(serv, cThread);
 }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
 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;
 }