public static int reloadNetwork()
 {
     AutoLeadClientHelper.connect();
     if (AutoLeadClientHelper.connected)
     {
         LocalConfig.getCurrentConfig().getStringForKey("ProxyTool");
         string ip = LocalConfig.getCurrentConfig().myIP;
         int    sshAndVip72Port = LocalConfig.getCurrentConfig().getSSHAndVip72Port();
         if (AutoLeadClientHelper.send(new JavaScriptSerializer().Serialize((object)new Dictionary <string, object>()
         {
             ["cmd"] = (object)nameof(reloadNetwork),
             ["pac"] = (object)("function FindProxyForURL(url, host) {\r\nreturn \"SOCKS " + ip + ":" + (object)sshAndVip72Port + "\";\r\n}")
         })))
         {
             if (AutoLeadClientHelper.receive() != null)
             {
                 AutoLeadClientHelper.close();
                 return(1);
             }
             AutoLeadClientHelper.close();
         }
         else
         {
             AutoLeadClientHelper.close();
         }
     }
     return(1);
 }
示例#2
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     this.isRunning = false;
     AutoLeadClientHelper.stopRecordingEU();
     this.result = (string)null;
     this.Close();
 }
示例#3
0
 public static bool connect(string host, string key, out int error, out string serial)
 {
     try
     {
         AutoLeadClient.connected = false;
         error = 0;
         AutoLeadClientHelper.setHostAndPort(host, 6800);
         int port = AutoLeadClientHelper.reset(key, out serial, out AutoLeadClient._license);
         if (port > 0)
         {
             AutoLeadClient.connectDone.Reset();
             IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse(host), port);
             AutoLeadClient.client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
             AutoLeadClient.client.BeginConnect((EndPoint)ipEndPoint, new AsyncCallback(AutoLeadClient.ConnectCallback), (object)AutoLeadClient.client);
             AutoLeadClient.connectDone.WaitOne();
             AutoLeadClient._host   = host;
             AutoLeadClient._key    = key;
             AutoLeadClient._serial = serial;
             return(true);
         }
         error = port;
         return(false);
     }
     catch (Exception ex)
     {
         error  = -1;
         serial = "";
         Console.WriteLine(ex.ToString());
         return(false);
     }
 }
示例#4
0
        public static bool reconnect()
        {
            int num = 0;

            try
            {
                AutoLeadClient.connected = false;
                num = 0;
                AutoLeadClientHelper.setHostAndPort(AutoLeadClient._host, 6800);
                int port = AutoLeadClientHelper.reconnect(AutoLeadClient._key, AutoLeadClient._license);
                if (port > 0)
                {
                    AutoLeadClient.connectDone.Reset();
                    IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Parse(AutoLeadClient._host), port);
                    AutoLeadClient.client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    AutoLeadClient.client.BeginConnect((EndPoint)ipEndPoint, new AsyncCallback(AutoLeadClient.ConnectCallback), (object)AutoLeadClient.client);
                    AutoLeadClient.connectDone.WaitOne();
                    return(true);
                }
                num = port;
                return(false);
            }
            catch (Exception ex)
            {
                num = -1;
                Console.WriteLine(ex.ToString());
                return(false);
            }
        }
示例#5
0
 private void btnDone_Click(object sender, EventArgs e)
 {
     this.isRunning = false;
     AutoLeadClientHelper.stopRecordingEU();
     this.result = (string)null;
     if (this.lvScript.Items.Count > 0)
     {
         this.result = "";
         for (int index = 0; index < this.lvScript.Items.Count; ++index)
         {
             this.result = this.result + this.lvScript.Items[index].Text + "\r\n";
         }
     }
     this.Close();
 }
示例#6
0
 public static void restoreIP(ProxyTool tool, string _ip, string country, string region, out string result)
 {
     result = (string)null;
     if (tool == ProxyTool.SSH)
     {
         LocalConfig.getCurrentConfig().changeSSHPort();
         ProxyCore.doChangeIP(tool, country, region, _ip, out result);
         AutoLeadClientHelper.reloadNetwork();
     }
     else
     {
         LocalConfig.getCurrentConfig().changeVip72Port();
         ProxyCore.doChangeIP(tool, country, region, _ip, out result);
         AutoLeadClientHelper.reloadNetwork();
     }
 }
示例#7
0
 public static void doChangeIP(ProxyTool tool, string country, out string ip)
 {
     ip = (string)null;
     if (tool == ProxyTool.SSH)
     {
         LocalConfig.getCurrentConfig().changeSSHPort();
         ProxyCore.doChangeIP(tool, country, (string)null, (string)null, out ip);
         Thread.Sleep(3000);
         AutoLeadClientHelper.reloadNetwork();
     }
     else
     {
         LocalConfig.getCurrentConfig().changeVip72Port();
         ProxyCore.doChangeIP(tool, country, (string)null, (string)null, out ip);
         Thread.Sleep(3000);
         AutoLeadClientHelper.reloadNetwork();
     }
 }
 public static int reset(string key, out string serial, out string _license)
 {
     AutoLeadClientHelper.connect();
     serial   = "";
     _license = "";
     if (AutoLeadClientHelper.connected)
     {
         if (AutoLeadClientHelper.send("{\"cmd\":\"reset\", \"key\":\"" + key + "\"}"))
         {
             string input = AutoLeadClientHelper.receive();
             if (input != null)
             {
                 Console.WriteLine(input);
                 Dictionary <string, object> dictionary = new JavaScriptSerializer().Deserialize <Dictionary <string, object> >(input);
                 if (dictionary.ContainsKey("license") && dictionary.ContainsKey(nameof(serial)))
                 {
                     string license = dictionary["license"].ToString();
                     serial = dictionary[nameof(serial)].ToString();
                     if (AutoLeadClientHelper.verify(license, serial))
                     {
                         AutoLeadClientHelper.close();
                         _license = license;
                         return(Convert.ToInt32(dictionary["port"]));
                     }
                     AutoLeadClientHelper.close();
                     return(-2);
                 }
                 if (dictionary.ContainsKey(nameof(serial)))
                 {
                     serial = dictionary[nameof(serial)].ToString();
                 }
                 AutoLeadClientHelper.close();
                 return(-2);
             }
             AutoLeadClientHelper.close();
         }
         else
         {
             AutoLeadClientHelper.close();
         }
     }
     return(-1);
 }
 public static void stopRecordingEU()
 {
     AutoLeadClientHelper.connect();
     if (!AutoLeadClientHelper.connected)
     {
         return;
     }
     if (AutoLeadClientHelper.send("{\"cmd\":\"stopGetUE\"}"))
     {
         string str = AutoLeadClientHelper.receive();
         if (str != null)
         {
             Console.WriteLine(str);
         }
         AutoLeadClientHelper.close();
     }
     else
     {
         AutoLeadClientHelper.close();
     }
 }
 public static int removeProxy()
 {
     AutoLeadClientHelper.connect();
     if (AutoLeadClientHelper.connected)
     {
         if (AutoLeadClientHelper.send(new JavaScriptSerializer().Serialize((object)new Dictionary <string, object>()
         {
             ["cmd"] = (object)"reloadNetwork"
         })))
         {
             if (AutoLeadClientHelper.receive() != null)
             {
                 AutoLeadClientHelper.close();
                 return(1);
             }
             AutoLeadClientHelper.close();
         }
         else
         {
             AutoLeadClientHelper.close();
         }
     }
     return(-1);
 }
示例#11
0
        private static void changeIP(ProxyTool tool, string country, string region, string preferIp, out string ip)
        {
            if (preferIp != null)
            {
                LocalConfig.getCurrentConfig().refreshLiveSSHs(country);
                ProxyCore.__selectedVip72Index = -1;
                ProxyCore.__selectedVip72IP.Clear();
            }
            ip = (string)null;
            ProxyCore.__preferIp = preferIp;
            ProxyCore.__country  = country;
            ProxyCore.__region   = region;
            ProxyCore.__tool     = tool;
            switch (tool)
            {
            case ProxyTool.Vip72:
                GlobalConfig.currentSSH = (Dictionary <string, object>)null;
                Array array = (Array)LocalConfig.getCurrentConfig().allVip72s().ToArray();
                for (int index1 = 0; index1 < array.Length; ++index1)
                {
                    if (index1 > ProxyCore.__selectedVip72Index)
                    {
                        ProxyCore.__selectedVip72Index = index1;
                        bool   flag = false;
                        string str1 = (string)null;
                        if (ProxyCore.__process == null || ProxyCore.__process.HasExited)
                        {
                            Dictionary <string, object> dictionary = (Dictionary <string, object>)array.GetValue(index1);
                            ProxyCore.handle = new IntPtr(-1);
                            if (ProxyCore.__process != null)
                            {
                                try
                                {
                                    ProxyCore.kill(ProxyCore.__process);
                                }
                                catch
                                {
                                }
                                ProxyCore.__process = (Process)null;
                            }
                            string      str2         = dictionary["username"].ToString();
                            string      str3         = dictionary["password"].ToString();
                            RegistryKey registryKey1 = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", true);
                            if (registryKey1 != null)
                            {
                                registryKey1.SetValue(GlobalConfig.executableDirectory() + "\\Tools\\vip72socks\\vip72socks.exe", (object)"HIGHDPIAWARE", RegistryValueKind.String);
                                registryKey1.Close();
                            }
                            else
                            {
                                Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers");
                                RegistryKey registryKey2 = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", true);
                                if (registryKey2 != null)
                                {
                                    registryKey2.SetValue(GlobalConfig.executableDirectory() + "\\Tools\\vip72socks\\vip72socks.exe", (object)"HIGHDPIAWARE", RegistryValueKind.String);
                                    registryKey2.Close();
                                }
                            }
                            ProxyCore.__process = Process.Start(new ProcessStartInfo()
                            {
                                WorkingDirectory = GlobalConfig.executableDirectory() + "/Tools/vip72socks",
                                FileName         = GlobalConfig.executableDirectory() + "/Tools/vip72socks/vip72socks.exe",
                                Arguments        = "-login;" + str2 + ":" + str3 + "; -mp:" + (object)LocalConfig.getCurrentConfig().getSSHAndVip72Port()
                            });
                            while (ProxyCore.handle.ToInt32() <= 0)
                            {
                                ProxyCore.handle = ProxyCore.__process.MainWindowHandle;
                                Thread.Sleep(200);
                            }
                            Console.WriteLine((object)ProxyCore.handle);
                            ProxyCore.vip72h = new Vip72Handle(ProxyCore.handle);
                            Thread.Sleep(200);
                            ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.Login);
                            while (!flag)
                            {
                                IntPtr windowHandle = ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status);
                                if (windowHandle.ToInt32() > 0)
                                {
                                    string controlText = Vip72Handle.GetControlText(windowHandle);
                                    if (controlText.Length > 0)
                                    {
                                        if (controlText.Contains("ERROR") || controlText.Contains("DISCONNECT"))
                                        {
                                            ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.Exit);
                                            str1 = (string)null;
                                            break;
                                        }
                                        if (controlText.Contains("ready"))
                                        {
                                            str1 = Vip72Handle.GetControlText(ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Info));
                                            flag = true;
                                        }
                                    }
                                    Thread.Sleep(200);
                                }
                                else
                                {
                                    str1 = (string)null;
                                    flag = true;
                                }
                            }
                            if (str1 != null)
                            {
                                if (flag)
                                {
                                    ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.SelectCountry);
                                    flag = false;
                                }
                                while (!flag)
                                {
                                    IntPtr windowHandle = ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status);
                                    if (windowHandle.ToInt32() > 0)
                                    {
                                        string controlText = Vip72Handle.GetControlText(windowHandle);
                                        if (controlText.Length > 0)
                                        {
                                            if (controlText.Contains("ERROR") || controlText.Contains("DISCONNECT"))
                                            {
                                                ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.Exit);
                                                str1 = (string)null;
                                                break;
                                            }
                                            if (controlText.Contains("Total"))
                                            {
                                                str1 = Vip72Handle.GetControlText(ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status));
                                                flag = true;
                                            }
                                        }
                                        Thread.Sleep(200);
                                    }
                                    else
                                    {
                                        str1 = (string)null;
                                        flag = true;
                                    }
                                }
                                if (str1 == null)
                                {
                                    ProxyCore.__process = (Process)null;
                                    continue;
                                }
                            }
                            else
                            {
                                continue;
                            }
                        }
                        else
                        {
                            flag = false;
                            str1 = "Reuse";
                            ProxyCore.__currentVip72Handle.showWindow();
                            ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.SelectCountry);
                            while (!flag)
                            {
                                IntPtr windowHandle = ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status);
                                if (windowHandle.ToInt32() > 0)
                                {
                                    string controlText = Vip72Handle.GetControlText(windowHandle);
                                    if (controlText.Length > 0)
                                    {
                                        if (controlText.Contains("ERROR") || controlText.Contains("DISCONNECT"))
                                        {
                                            ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.Exit);
                                            str1 = (string)null;
                                            break;
                                        }
                                        if (controlText.Contains("Total"))
                                        {
                                            str1 = Vip72Handle.GetControlText(ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status));
                                            flag = true;
                                        }
                                    }
                                    Thread.Sleep(200);
                                }
                                else
                                {
                                    str1 = (string)null;
                                    flag = true;
                                }
                            }
                            if (str1 == null)
                            {
                                ProxyCore.__process = (Process)null;
                                continue;
                            }
                        }
                        if (flag)
                        {
                            IntPtr windowHandle = ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.SelectCountryListView);
                            Console.WriteLine(Vip72Handle.GetWindowClassName(windowHandle));
                            int index2 = 0;
                            int num    = 0;
                            List <List <string> > listViewItems1 = Vip72Handle.GetListViewItems(windowHandle);
                            for (int index3 = 0; index3 < listViewItems1.Count; ++index3)
                            {
                                List <string> stringList = listViewItems1[index3];
                                if (stringList[0].Equals(country))
                                {
                                    index2 = index3;
                                    num    = Convert.ToInt32(stringList[1]);
                                    break;
                                }
                            }
                            Vip72Handle.selectListViewItem(windowHandle, index2, true);
                            if (region != null && num > 170)
                            {
                                ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.SelectRegion);
                                IntPtr handle = windowHandle;
                                List <List <string> > listViewItems2;
                                for (listViewItems2 = Vip72Handle.GetListViewItems(handle); listViewItems2.Count == listViewItems1.Count || listViewItems2.Count == 0; listViewItems2 = Vip72Handle.GetListViewItems(handle))
                                {
                                    Thread.Sleep(1000);
                                }
                                for (int index3 = 0; index3 < listViewItems2.Count; ++index3)
                                {
                                    List <string> stringList = listViewItems2[index3];
                                    if (stringList.Count > 0 && stringList[0].Equals(region))
                                    {
                                        Vip72Handle.selectListViewItem(handle, index3, true);
                                        break;
                                    }
                                }
                            }
                            ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.GetProxyByGEO);
                            flag = false;
                        }
                        while (!flag)
                        {
                            IntPtr windowHandle = ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status);
                            if (windowHandle.ToInt32() > 0)
                            {
                                string controlText = Vip72Handle.GetControlText(windowHandle);
                                if (controlText.Length > 0)
                                {
                                    if (controlText.ToUpper().Contains("ERROR") || controlText.ToUpper().Contains("DISCONNECT"))
                                    {
                                        ProxyCore.vip72h.SendLeftClickToWindow(Vip72Handle.Vip72Window.Exit);
                                        str1 = (string)null;
                                        break;
                                    }
                                    if (controlText.Contains("Ok"))
                                    {
                                        str1 = Vip72Handle.GetControlText(ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status));
                                        flag = true;
                                    }
                                    else if (controlText.Contains("ONLY"))
                                    {
                                        str1 = Vip72Handle.GetControlText(ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.Status));
                                        flag = true;
                                    }
                                }
                                Thread.Sleep(200);
                            }
                            else
                            {
                                str1 = (string)null;
                                flag = true;
                            }
                        }
                        if (str1 != null)
                        {
                            if (!flag)
                            {
                                break;
                            }
                            List <IntPtr>          allChildHandles  = ProxyCore.vip72h.GetAllChildHandles();
                            Vip72Handle.WINDOWINFO childWindowInfo1 = Vip72Handle.GetChildWindowInfo(ProxyCore.handle);
                            for (int index2 = 0; index2 < allChildHandles.Count; ++index2)
                            {
                                IntPtr num1        = allChildHandles[index2];
                                string controlText = Vip72Handle.GetControlText(num1);
                                Vip72Handle.WINDOWINFO childWindowInfo2 = Vip72Handle.GetChildWindowInfo(num1);
                                int num2 = childWindowInfo2.rcWindow.top - childWindowInfo1.rcWindow.top;
                                int num3 = childWindowInfo2.rcWindow.left - childWindowInfo1.rcWindow.left;
                                int num4 = childWindowInfo2.rcWindow.bottom - childWindowInfo2.rcWindow.top;
                                int num5 = childWindowInfo2.rcWindow.right - childWindowInfo2.rcWindow.left;
                                Console.WriteLine("*** [" + Vip72Handle.GetWindowClassName(num1) + "] : " + controlText + " " + (object)num2 + " : " + (object)num3 + " : " + (object)num4 + " : " + (object)num5);
                            }
                            IntPtr windowHandle = ProxyCore.vip72h.GetWindowHandle(Vip72Handle.Vip72Window.AllProxiesListView);
                            Console.WriteLine("All Proxies visible:" + Vip72Handle.IsWindowVisible(windowHandle).ToString());
                            ProxyCore.__vip72ProxiesList = Vip72Handle.GetListViewItems(windowHandle);
                            Thread.Sleep(1000);
                            ProxyCore.__currentVip72Handle = ProxyCore.vip72h;
                            ProxyCore.__allProxiesHandle   = windowHandle;
                            ProxyCore.selectNextIP(preferIp, out ip);
                            AutoLeadClientHelper.reloadNetwork();
                            break;
                        }
                    }
                }
                break;

            case ProxyTool.SSH:
                if (ProxyCore.previousSshInfo != null)
                {
                    Dictionary <string, object> previousSshInfo = ProxyCore.previousSshInfo;
                    LocalConfig.getCurrentConfig().getLiveSSH(ProxyCore.__country, true, GlobalConfig.SSHRefresh);
                    ProxyCore.previousSshInfo = (Dictionary <string, object>)null;
                    if (previousSshInfo == null)
                    {
                        break;
                    }
                    ProxyCore.setupProxy(ProxyCore.__tool, new IndexItem(0, previousSshInfo)
                    {
                        hostKeyFp = previousSshInfo["fp"].ToString()
                    }, out ip);
                    GlobalConfig.currentSSH = previousSshInfo;
                    break;
                }
                Dictionary <string, object> liveSsh = LocalConfig.getCurrentConfig().getLiveSSH(ProxyCore.__country, true, GlobalConfig.SSHRefresh);
                if (liveSsh != null)
                {
                    ProxyCore.setupProxy(ProxyCore.__tool, new IndexItem(0, liveSsh)
                    {
                        hostKeyFp = liveSsh["fp"].ToString()
                    }, out ip);
                    GlobalConfig.currentSSH = liveSsh;
                }
                break;
            }
        }