Beispiel #1
0
        public static List <List <string> > GetListViewItems(IntPtr handle)
        {
            int itemCount = Vip72Handle.ListView_GetItemCount(handle);
            int num1      = Vip72Handle.ListViewColumnCount(handle);
            List <List <string> > stringListList = new List <List <string> >();
            uint   dwProcessId;
            int    windowThreadProcessId = (int)Vip72Handle.GetWindowThreadProcessId(handle, out dwProcessId);
            IntPtr num2 = Vip72Handle.OpenProcess(56U, false, dwProcessId);
            IntPtr num3 = Vip72Handle.VirtualAllocEx(num2, IntPtr.Zero, 16384U, 12288U, 4U);

            try
            {
                for (int index1 = 0; index1 < itemCount; ++index1)
                {
                    List <string> stringList = new List <string>();
                    for (int index2 = 0; index2 < num1; ++index2)
                    {
                        try
                        {
                            byte[] arr1 = new byte[256];
                            Vip72Handle.LVITEM[] arr2 = new Vip72Handle.LVITEM[1];
                            arr2[0].mask       = 1;
                            arr2[0].iItem      = index1;
                            arr2[0].iSubItem   = index2;
                            arr2[0].cchTextMax = arr1.Length;
                            arr2[0].pszText    = (IntPtr)((int)num3 + Marshal.SizeOf(typeof(Vip72Handle.LVITEM)));
                            uint vNumberOfBytesRead = 0;
                            Vip72Handle.WriteProcessMemory(num2, num3, Marshal.UnsafeAddrOfPinnedArrayElement <Vip72Handle.LVITEM>(arr2, 0), Marshal.SizeOf(typeof(Vip72Handle.LVITEM)), ref vNumberOfBytesRead);
                            Vip72Handle.SendMessage(handle, 4171U, 0, num3.ToInt32());
                            Vip72Handle.ReadProcessMemory(num2, (IntPtr)((int)num3 + Marshal.SizeOf(typeof(Vip72Handle.LVITEM))), Marshal.UnsafeAddrOfPinnedArrayElement <byte>(arr1, 0), arr1.Length, ref vNumberOfBytesRead);
                            string stringUni = Marshal.PtrToStringUni(Marshal.UnsafeAddrOfPinnedArrayElement <byte>(arr1, 0));
                            stringList.Add(stringUni);
                        }
                        catch (Exception ex)
                        {
                            stringList.Add("");
                            Console.WriteLine((object)ex);
                        }
                    }
                    stringListList.Add(stringList);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine((object)ex);
            }
            finally
            {
                Vip72Handle.VirtualFreeEx(num2, num3, 0U, 32768U);
                Vip72Handle.CloseHandle(num2);
            }
            return(stringListList);
        }
Beispiel #2
0
        public static Point scrollListViewToIndex(IntPtr handle, int index)
        {
            if (Vip72Handle.ListView_GetItemCount(handle) <= index)
            {
                return(Vip72Handle.InvalidPoint);
            }
            Size  windowSize        = Vip72Handle.GetWindowSize(handle);
            Point listViewItemPoint = Vip72Handle.GetListViewItemPoint(handle, index);

            if (listViewItemPoint != Vip72Handle.InvalidPoint)
            {
                int num = 0;
                if (listViewItemPoint.Y > windowSize.Height - 25)
                {
                    num = 1;
                }
                if (listViewItemPoint.Y < 25)
                {
                    num = -1;
                }
                for (int index1 = 30; num != 0 && index1 > 0; --index1)
                {
                    switch (num)
                    {
                    case -1:
                        int wParam1 = 2;
                        Vip72Handle.SendMessage(handle, 277U, wParam1, 0);
                        break;

                    case 1:
                        int wParam2 = 3;
                        Vip72Handle.SendMessage(handle, 277U, wParam2, 0);
                        break;
                    }
                    listViewItemPoint = Vip72Handle.GetListViewItemPoint(handle, index);
                    num = 0;
                    if (listViewItemPoint.Y > windowSize.Height - 25)
                    {
                        num = 1;
                    }
                    if (listViewItemPoint.Y < 25)
                    {
                        num = -1;
                    }
                }
            }
            return(listViewItemPoint);
        }
Beispiel #3
0
        public static bool selectNextIP(string referIP, out string nextIP)
        {
            if (ProxyCore.__tool == ProxyTool.Vip72)
            {
                nextIP = (string)null;
                GlobalConfig.currentSSH = (Dictionary <string, object>)null;
                if (ProxyCore.__allProxiesHandle != IntPtr.Zero && ProxyCore.__currentVip72Handle != null)
                {
                    ProxyCore.__currentVip72Handle.showWindow();
                    ProxyCore.__allProxiesHandle = ProxyCore.__currentVip72Handle.GetWindowHandle(Vip72Handle.Vip72Window.AllProxiesListView);
                    int itemCount = Vip72Handle.ListView_GetItemCount(ProxyCore.__allProxiesHandle);
                    int index1;
                    if (referIP != null)
                    {
                        ProxyCore.__currentVip72Handle.SendLeftClickToWindow(Vip72Handle.Vip72Window.MyProxies);
                        IntPtr windowHandle = ProxyCore.__currentVip72Handle.GetWindowHandle(Vip72Handle.Vip72Window.MyProxiesListView);
                        for (int count = Vip72Handle.GetListViewItems(windowHandle).Count; count > 0; --count)
                        {
                            Vip72Handle.deleteListViewItem(windowHandle, 0);
                        }
                        ProxyCore.__currentVip72Handle.SendLeftClickToWindow(Vip72Handle.Vip72Window.AllProxies);
                        ProxyCore.__vip72ProxiesList = Vip72Handle.GetListViewItems(ProxyCore.__allProxiesHandle);
                        int    num  = -1;
                        string text = (string)null;
                        for (int index2 = 0; index2 < ProxyCore.__vip72ProxiesList.Count; ++index2)
                        {
                            List <string> vip72Proxies = ProxyCore.__vip72ProxiesList[index2];
                            if (ProxyCore.compare_vip72ip(vip72Proxies[0], referIP))
                            {
                                num  = index2;
                                text = vip72Proxies[0];
                                break;
                            }
                        }
                        if (num == -1)
                        {
                            num = GlobalConfig.random.Next(ProxyCore.__vip72ProxiesList.Count);
                        }
                        string[] strArray = GlobalConfig.stringSplit(GlobalConfig.stringSplit(text, ",")[0].Trim(), ".");
                        ProxyCore.__selectedVip72IP.Remove(strArray[0] + "." + strArray[1] + "." + strArray[2] + ".***");
                        ProxyCore.__selectedVip72IP.Add(strArray[0] + "." + strArray[1] + "." + strArray[2] + ".***");
                        index1 = num;
                    }
                    else
                    {
                        ProxyCore.__currentVip72Handle.SendLeftClickToWindow(Vip72Handle.Vip72Window.MyProxies);
                        IntPtr windowHandle = ProxyCore.__currentVip72Handle.GetWindowHandle(Vip72Handle.Vip72Window.MyProxiesListView);
                        for (int count = Vip72Handle.GetListViewItems(windowHandle).Count; count > 0; --count)
                        {
                            Vip72Handle.deleteListViewItem(windowHandle, 0);
                        }
                        ProxyCore.__currentVip72Handle.SendLeftClickToWindow(Vip72Handle.Vip72Window.AllProxies);
                        ProxyCore.__vip72ProxiesList = Vip72Handle.GetListViewItems(ProxyCore.__allProxiesHandle);
                        string     text1   = (string)null;
                        List <int> intList = new List <int>();
                        for (int index2 = 0; index2 < ProxyCore.__vip72ProxiesList.Count; ++index2)
                        {
                            string[] strArray = GlobalConfig.stringSplit(ProxyCore.__vip72ProxiesList[index2][0], ".");
                            string   str      = strArray[0] + "." + strArray[1] + "." + strArray[2] + ".***";
                            if (!ProxyCore.__selectedVip72IP.Contains(str))
                            {
                                intList.Add(index2);
                            }
                        }
                        int index3;
                        if (intList.Count == 0)
                        {
                            index3 = -1;
                        }
                        else
                        {
                            index3 = intList[GlobalConfig.random.Next(intList.Count)];
                            string[] strArray = GlobalConfig.stringSplit(ProxyCore.__vip72ProxiesList[index3][0], ".");
                            text1 = strArray[0] + "." + strArray[1] + "." + strArray[2] + ".***";
                        }
                        if (index3 == -1)
                        {
                            ProxyCore.__selectedVip72IP.Clear();
                            index3 = GlobalConfig.random.Next(ProxyCore.__vip72ProxiesList.Count);
                            string[] strArray = GlobalConfig.stringSplit(ProxyCore.__vip72ProxiesList[index3][0], ".");
                            text1 = strArray[0] + "." + strArray[1] + "." + strArray[2] + ".***";
                        }
                        string   text2     = GlobalConfig.stringSplit(text1, ",")[0].Trim();
                        string[] strArray1 = GlobalConfig.stringSplit(text2, ".");
                        ProxyCore.__selectedVip72IP.Remove(strArray1[0] + "." + strArray1[1] + "." + strArray1[2] + ".***");
                        ProxyCore.__selectedVip72IP.Add(strArray1[0] + "." + strArray1[1] + "." + strArray1[2] + ".***");
                        index1 = index3;
                        ProxyCore.writeLog("\r\nWill select ip: " + text2 + " index: " + (object)index3);
                    }
                    if (itemCount <= index1)
                    {
                        return(false);
                    }
                    ProxyCore.__currentVip72Handle.SendLeftClickToWindow(Vip72Handle.Vip72Window.MyProxies);
                    IntPtr windowHandle1 = ProxyCore.__currentVip72Handle.GetWindowHandle(Vip72Handle.Vip72Window.MyProxiesListView);
                    for (int count = Vip72Handle.GetListViewItems(windowHandle1).Count; count > 0; --count)
                    {
                        Vip72Handle.deleteListViewItem(windowHandle1, 0);
                    }
                    ProxyCore.__currentVip72Handle.SendLeftClickToWindow(Vip72Handle.Vip72Window.AllProxies);
                    bool   flag          = false;
                    IntPtr windowHandle2 = ProxyCore.__currentVip72Handle.GetWindowHandle(Vip72Handle.Vip72Window.CurrentSock);
                    string b             = Vip72Handle.GetControlText(windowHandle2);
                    List <List <string> > listViewItems = Vip72Handle.GetListViewItems(ProxyCore.__allProxiesHandle);
                    ProxyCore.writeLog("\r\n*** IP1: " + listViewItems[index1][0]);
                    ProxyCore.writeLog("\r\n*** Begin select ***");
                    Vip72Handle.selectListViewItem(ProxyCore.__allProxiesHandle, index1, true);
                    ProxyCore.writeLog("\r\n*** End select ***");
                    string a = listViewItems[index1][0];
                    ProxyCore.writeLog("\r\n*** IP2: " + a);
                    while (!flag)
                    {
                        if (ProxyCore.__currentVip72Handle.GetWindowHandle(Vip72Handle.Vip72Window.CurrentSock).ToInt32() > 0)
                        {
                            string controlText = Vip72Handle.GetControlText(ProxyCore.__currentVip72Handle.GetWindowHandle(Vip72Handle.Vip72Window.Status));
                            b = Vip72Handle.GetControlText(windowHandle2);
                            if (controlText != null)
                            {
                                if (controlText.Contains("checked") && ProxyCore.compare_vip72ip(a, b))
                                {
                                    flag = true;
                                    b    = Vip72Handle.GetControlText(windowHandle2);
                                }
                                else if (controlText.Contains("ERROR") || controlText.Contains("DISCONNECT"))
                                {
                                    flag = true;
                                    b    = (string)null;
                                }
                                else
                                {
                                    Thread.Sleep(200);
                                }
                            }
                            else
                            {
                                flag = true;
                                b    = (string)null;
                            }
                        }
                        else
                        {
                            flag = true;
                            b    = (string)null;
                        }
                    }
                    ProxyCore.__currentVip72Handle.hideWindow();
                    if (b != null)
                    {
                        nextIP = b;
                        return(true);
                    }
                }
                return(false);
            }
            nextIP = (string)null;

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

            if (liveSsh == null)
            {
                return(false);
            }
            ProxyCore.setupProxy(ProxyCore.__tool, new IndexItem(0, liveSsh)
            {
                hostKeyFp = liveSsh["fp"].ToString()
            }, out nextIP);
            GlobalConfig.currentSSH = liveSsh;
            return(true);
        }