Пример #1
0
 public static void closeAll()
 {
     if (ProxyCore.__process != null)
     {
         try
         {
             ProxyCore.kill(ProxyCore.__process);
         }
         catch
         {
         }
         ProxyCore.__process = (Process)null;
     }
     ProxyCore.__currentVip72Handle = (Vip72Handle)null;
     ProxyCore.__selectedVip72IP.Clear();
     ProxyCore.__selectedVip72Index = -1;
     if (ProxyCore.proSSH != null)
     {
         try
         {
             ProxyCore.kill(ProxyCore.proSSH);
         }
         catch
         {
         }
         ProxyCore.proSSH = (Process)null;
     }
     LocalConfig.getCurrentConfig().refreshLiveSSHs();
 }
Пример #2
0
        private static void setupProxy(ProxyTool tool, IndexItem item, out string ip)
        {
            ip = (string)null;
            if (tool != ProxyTool.SSH)
            {
                return;
            }
            Dictionary <string, object> info = item.info;
            string str1  = info["host"].ToString();
            int    int32 = Convert.ToInt32(info["port"].ToString());
            string str2  = info["username"].ToString();
            string str3  = info["password"].ToString();

            if (ProxyCore.proSSH != null)
            {
                try
                {
                    ProxyCore.kill(ProxyCore.proSSH);
                }
                catch
                {
                }
                ProxyCore.proSSH = (Process)null;
            }
            LocalConfig.getCurrentConfig().updateBitviseProfileWithCurrentIP();
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.WorkingDirectory = GlobalConfig.executableDirectory() + "/Tools/bitvise";
            startInfo.FileName         = GlobalConfig.executableDirectory() + "/Tools/bitvise/BvSsh.exe";
            string str4 = LocalConfig.getCurrentConfig().configDirectory() + "\\ldefault.bscp";

            Console.WriteLine(item.hostKeyFp);
            startInfo.Arguments = "-profile=\"" + str4 + "\" -host=" + str1 + " -port=" + (object)int32 + " -user="******" -password="******" -hide=banner -hostKeyFp=\"" + item.hostKeyFp + "\" -openTerm=n -openSFTP=n -openRDP=n -loginOnStartup";
            ProxyCore.proSSH    = Process.Start(startInfo);
            ip = str1 + ", " + info["country"].ToString() + ", " + info["region"].ToString();
        }
Пример #3
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;
            }
        }