private void button1_Click(object sender, EventArgs e) { comboBox1.Items.Clear(); sshNet sshnet = new sshNet(iStatic.ipIphone); sshnet.OpenApp(iStatic.nameApp9); Thread.Sleep(1000); comboBox1.Enabled = false; string text = string.Empty; ThuVienDll.FuncFolder file = new ThuVienDll.FuncFolder(); foreach (string str in sshnet.GetAppList()) { string[] arrnameapp = str.Split('='); if (arrnameapp.Length - 1 > 0) { text += arrnameapp[1] + "|"; comboBox1.Items.Add(arrnameapp[1].Trim()); } } File.WriteAllText(iStatic.diraidIphone + "/Applist.txt", text); comboBox1.Enabled = true; }
public static bool ConnectSSH(string ipaddress, int portaddress, List <SSH> lssh, int sshline, Label lbl) { Form1 frm = new Form1(); sshLine = sshline; ConnectSSH: ThuVienDll.BvSshIOS.closebitvise(portaddress); sshNet sshnet = new sshNet(iStatic.ipIphone); SSH sshproxy = nextSSH(lssh); if (sshproxy == null) { iStatic.setStatus("SSH Het", lbl); return(false); } iStatic.setStatus("Kết Nối SSH : " + sshproxy.IP + "|" + sshproxy.username + "|" + sshproxy.password, lbl); ThuVienDll.FuncFolder tvfile = new ThuVienDll.FuncFolder(); if (!ThuVienDll.BvSshIOS.SetSSH(sshproxy.IP, sshproxy.username, sshproxy.password, ipaddress, portaddress.ToString(), 15)) { ThuVienDll.BvSshIOS.closebitvise(portaddress); Console.WriteLine(sshline); lssh[sshLine].live = "dead"; goto ConnectSSH; } lssh[sshLine].live = "live"; SaveSSH(lssh); iStatic.setStatus("Kết Nối SSH Thành Công ", lbl); return(true); }
//Script------------------------------------------------------------------------------- public bool script(string[] arr) { int nsleepMouse = 0; int cTouchUp = 0; Thread.Sleep(2000); ThuVienDll.FuncFolder file = new ThuVienDll.FuncFolder(); foreach (string str in arr) { Console.WriteLine(nsleepMouse); if (str.Contains("usleep")) { string[] arrsleep = str.Split(new string[] { "usleep(", ")" }, StringSplitOptions.None); double nsleep = 0; if (double.TryParse(arrsleep[1], out nsleep)) { nsleepMouse += (int)(nsleep / 1000); } } if (str.Contains("touchDown")) { cTouchUp = 0; nsleepMouse = 0; File.WriteAllText(iStatic.diraidIphone + "/Script.lua", str + "\r\n"); } else { if (str.Contains("touchMove")) { file.wireData(str, iStatic.diraidIphone + "/Script.lua"); } else { if (str.Contains("touchUp")) { cTouchUp = 1; file.wireData(str, iStatic.diraidIphone + "/Script.lua"); ssh.UploadFile("/var/mobile/Library/AutoTouch/Scripts/", "./" + iStatic.diraidIphone + "/Script.lua"); ThuVienDll.RequestServer.HTTP_GET("http://" + iStatic.ipIphone + ":8080/control/start_playing?path=Script.lua", ""); Thread.Sleep(nsleepMouse); } else { if (cTouchUp == 0) { if (str.Contains("usleep")) { file.wireData(str, iStatic.diraidIphone + "/Script.lua"); } } else { File.WriteAllText(iStatic.diraidIphone + "/Script.lua", str); ssh.UploadFile("/var/mobile/Library/AutoTouch/Scripts/", "./" + iStatic.diraidIphone + "/Script.lua"); ThuVienDll.RequestServer.HTTP_GET("http://" + iStatic.ipIphone + ":8080/control/start_playing?path=Script.lua", ""); if (str.Contains("usleep")) { string[] arrsleep = str.Split(new string[] { "usleep(", ")" }, StringSplitOptions.None); double nsleep = 0; if (double.TryParse(arrsleep[1], out nsleep)) { Thread.Sleep((int)(nsleep / 1000)); } } } } } } } return(true); }