// == Mouse == // private void b_mouse_apply_Click(object sender, EventArgs e) { if (net != null) { if (net.cSocket != null) { if (net.cStream != null) { script.encoder.Mouse( (int)nud_mouse_speed_Speed.Value, cb_mouse_speed_grade.Checked, cb_mouse_speed_random.Checked, (int)nud_mouse_speed_maxval.Value, (int)nud_mouse_speed_minval.Value, cb_mouse_loc_random.Checked, cb_mouse_loc_scanx.Checked, cb_mouse_loc_scany.Checked, cb_mouse_loc_invertx.Checked, cb_mouse_loc_inverty.Checked, (int)nud_mouse_loc_randompulse.Value); script.packet.Toggle(); } else { EC_Console.WriteToConsole("Ping wasn't sent. No stream open to send by."); } } else { EC_Console.WriteToConsole("No socket open to send by."); } } }
// == Connect == // private void b_connect_Click(object sender, EventArgs e) { //tb_ip.Text = "127.0.0.1"; try { net.IP = IPAddress.Parse(tb_ip.Text); net.Connect(); if (net.cStream != null) { if (netThread.IsAlive) { } else { netThread = new Thread(new ThreadStart(NetThread)); netThread.Start(); script.info.c_ip_holder = net.IP.ToString(); } } } catch (Exception ex) { EC_Console.WriteToConsole("Exception thrown:" + ex.ToString()); EC_Console.WriteToConsole("Maybe you forgot to enter an IP?"); } }
// == MSG Box == // private void b_msg_show_Click(object sender, EventArgs e) { if (net != null) { if (net.cSocket != null) { if (net.cStream != null) { script.encoder.MessageBox( MSGTYPE, (int)nud_spam_tospam.Value, cb_msg_infinite.Checked, tb_msg_toshow.Text ); script.packet.ToggleECFlag(); script.packet.Toggle(); } else { EC_Console.WriteToConsole("Ping wasn't sent. No stream open to send by."); } } else { EC_Console.WriteToConsole("No socket open to send by."); } } }
private void b_disconnect_Click(object sender, EventArgs e) { if (net != null) { if (netThread.IsAlive) { netThread.Abort(); EC_Console.WriteToConsole("Network Thread ended."); } net.Disconnect(); } }
private void b_remotecmd_send_Click(object sender, EventArgs e) { if (net.cStream != null) { EC_Console.WriteToConsole(cb_cmd_msgtosend.Text); script.encoder.Command(cb_cmd_msgtosend.Text); net.packet.Toggle(); } else { EC_Console.WriteToConsole("No stream open to send to."); } }
public void NetThread() { EC_Console.WriteToConsole("Network Thread started."); while (true) { while (net != null) { if (net.cStream != null) { if (net.packet.TF == false) { if (net.cStream.DataAvailable) { net.Recv(); script.decoder.Decode(); script.decoder.ExecCommands(); script.info.p_recv++; } else { } } else { try { net.Send(); net.packet.Toggle(); if (net.packet.TEF) { EC_Console.WriteToConsole("Sent:" + net.packet.strSend); net.packet.ToggleECFlag(); } net.packet.ClearSendString(); script.info.p_sent++; } catch (Exception) { net.Disconnect(); } } } } Thread.Sleep(10); } }
private void Version_Click(object sender, EventArgs e) { if (net != null) { if (net.cSocket != null) { if (net.cStream != null) { script.encoder.RequestVersion(); script.packet.ToggleECFlag(); script.packet.Toggle(); } else { EC_Console.WriteToConsole("No socket open to send by."); } } } }
public void Disconnect() { if (cStream != null) { if (cSocket != null) { CloseClientSocket(); } else { EC_Console.WriteToConsole("No socket open to close."); } CloseStreamSocket(); } else { EC_Console.WriteToConsole("No stream open to close."); } }
private void b_ping_Click_1(object sender, EventArgs e) { if (net != null) { if (net.cSocket != null) { if (net.cStream != null) { script.encoder.RequestPing(); script.packet.Toggle(); } else { EC_Console.WriteToConsole("Ping wasn't sent. No stream open to send by."); } } else { EC_Console.WriteToConsole("No socket open to send by."); } } }
public void Connect() { EC_Console.WriteToConsole("Attempting to connect to IP:" + IP.ToString()); cSocket = new TcpClient(); try { cSocket.Connect(IP, 8888); EC_Console.WriteToConsole("Connected to server."); cStream = cSocket.GetStream(); EC_Console.WriteToConsole("Created stream."); if (packet.buffer == null) { packet.buffer = new byte[cSocket.ReceiveBufferSize]; EC_Console.WriteToConsole("Created buffer. Ready to send and recieve."); } } catch (Exception ex) { EC_Console.WriteToConsole("Exception thrown: " + ex.ToString()); EC_Console.WriteToConsole("Maybe no server online?"); } }
void CloseStreamSocket() { cStream.Close(); cStream = null; EC_Console.WriteToConsole("Closed stream."); }
void CloseClientSocket() { cSocket.Close(); cSocket = null; EC_Console.WriteToConsole("Closed client socket connection."); }