Example #1
0
 public void AddProxy(MyProxy proxy)
 {
     if (ProxiesScraped.Add(proxy.ToString()))                                                //if added to hashset and not a duplicate
     {
         scrapedListBox.Invoke(new Action(() => scrapedListBox.Items.Add(proxy.ToString()))); //add to listbox UI
         UpdateScraperUI();
     }
 }
Example #2
0
        private void importProxiesBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title       = "Proxies";
            ofd.Filter      = "Text Files|*.txt";
            ofd.Multiselect = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                ProxyMgr.Clear();
                uint badProxies       = 0;
                uint duplicateProxies = 0;
                uint dangerousProxies = 0;
                foreach (string file in ofd.FileNames)
                {
                    using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                        using (StreamReader sr = new StreamReader(fs, Encoding.Default))
                        {
                            string proxy;
                            while ((proxy = sr.ReadLine()) != null)
                            {
                                MyProxy myProxy = new MyProxy(proxy, true);
                                if (myProxy.isMalformed)
                                {
                                    badProxies++;
                                }
                                else
                                {
                                    if (removeDangCheck.Checked)
                                    {
                                        if (filter.isDangerous(myProxy.ToString()))
                                        {
                                            dangerousProxies++;
                                            continue;
                                        }
                                    }
                                    if (!ProxyMgr.Add(myProxy.ToString())) //adding to hashset
                                    {
                                        duplicateProxies++;
                                    }
                                }
                            }
                        }
                }

                //Update UI
                EnableScanUI();

                MessageBox.Show(string.Format("A total of {0} Proxies have been imported for scanning.{1}{2}", ProxyMgr.Count.ToString(),
                                              (badProxies + duplicateProxies) > 0 ? string.Format("{0} - {1} bad proxies and {2} duplicates were removed!",
                                                                                                  Environment.NewLine, badProxies.ToString(), duplicateProxies.ToString()):"", dangerousProxies > 0? string.Concat(Environment.NewLine,
                                                                                                                                                                                                                   " - ", dangerousProxies.ToString(), " DANGEROUS Proxies were also removed!"):""),
                                "Import Proxies", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #3
0
        private void ImportProxiesBtn_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog();

            ofd.Title       = "Proxies";
            ofd.Filter      = "Text Files|*.txt";
            ofd.Multiselect = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                ProxyMgr.Clear();
                uint badProxies       = 0;
                uint duplicateProxies = 0;
                uint dangerousProxies = 0;
                foreach (var file in ofd.FileNames)
                {
                    using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                        using (var sr = new StreamReader(fs, Encoding.Default)) {
                            string proxy;
                            while ((proxy = sr.ReadLine()) != null)
                            {
                                var myProxy = new MyProxy(proxy, true);
                                if (myProxy.IsMalformed)
                                {
                                    badProxies++;
                                }
                                else
                                {
                                    if (removeDangCheck.Checked)
                                    {
                                        if (filter.IsDangerous(myProxy.ToString()))
                                        {
                                            dangerousProxies++;
                                            continue;
                                        }
                                    }
                                    if (!ProxyMgr.Add(myProxy.ToString())) //adding to hashset
                                    {
                                        duplicateProxies++;
                                    }
                                }
                            }
                        }
                }

                //Update UI
                EnableScanUI();

                MessageBox.Show(string.Concat($"A total of {ProxyMgr.Count} Proxies have been imported for scanning.",
                                              (badProxies + duplicateProxies) > 0 ? $"\n - {badProxies} bad proxies and {duplicateProxies} duplicates were removed!" : string.Empty,
                                              dangerousProxies > 0 ? $"\n - {dangerousProxies} DANGEROUS Proxies were also removed!" : string.Empty),
                                "Import Proxies", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #4
0
        public void AddToListView(MyProxy p)
        {
            //0=Proxy 1=Latency 2=Type 3=Level
            var type = p.Type.ToString().ToUpper();// == xNet.ProxyType.Http ? "HTTP" : (p.Type == xNet.ProxyType.Socks5 ? "SOCKS5" : "SOCKS4");

            string[] row = { p.ToString(), p.Latency.ToString(),
                             type,         p.AnonLevel.ToString() };
            var      item = new ListViewItem(row);

            item.UseItemStyleForSubItems = false;

            Color col = Color.Black;

            if (p.Latency > MyProxy.Timeout)
            {
                col = Color.DarkGray;
            }
            else if (p.Latency <= MyProxy.Timeout && p.Latency > timeout75)
            {
                col = Color.Red;
            }
            else if (p.Latency < timeout75 && p.Latency > timeout50)
            {
                col = Color.Orange;
            }
            else if (p.Latency < timeout50 && p.Latency > timeout25)
            {
                col = Color.Blue;
            }
            else if (p.Latency < timeout25)
            {
                col = Color.Green;
            }

            item.Font = new Font(FontFamily.GenericSansSerif, 8.0F, FontStyle.Regular);;
            item.SubItems[1].ForeColor = col;
            item.SubItems[1].Font      = new Font(FontFamily.GenericSansSerif, 8.0F, FontStyle.Italic);
            item.SubItems[2].Font      = new Font(FontFamily.GenericSansSerif, 8.0F, FontStyle.Bold);
            item.SubItems[2].Font      = new Font(FontFamily.GenericSansSerif, 7.0F, FontStyle.Bold);
            item.SubItems[3].Font      = new Font(FontFamily.GenericSansSerif, 8.0F, FontStyle.Bold);

            proxyView.Invoke(new Action(() => proxyView.Columns[1].TextAlign = HorizontalAlignment.Center));     //centre latency
            proxyView.Invoke(new Action(() => proxyView.Columns[2].TextAlign = HorizontalAlignment.Center));     //centre type

            if (p.AnonLevel == Anonymity.Transparent)
            {
                item.SubItems[3].Font      = new Font(FontFamily.GenericSansSerif, 7.0F, FontStyle.Bold);
                item.SubItems[3].ForeColor = Color.DarkGray;
            }
            else if (p.AnonLevel == Anonymity.High)
            {
                item.SubItems[3].ForeColor = Color.Blue;
            }
            if (p.AnonLevel == Anonymity.Elite)
            {
                item.SubItems[3].ForeColor = Color.Purple;
            }

            if (type == "HTTP")
            {
                item.SubItems[2].ForeColor = Color.Cyan;
            }
            else //SOCKS
            {
                item.SubItems[2].ForeColor = Color.Lime;
            }

            proxyView.Invoke(new Action(() => proxyView.Items.Add(item)));
            proxyView.Invoke(new Action(() => proxyView.Items[proxyView.Items.Count - 1].EnsureVisible()));
            // proxyView.Invoke(new Action(() => proxyView.Items[proxyView.Items.Count - 1].Selected = true));
            //proxyView.Invoke(new Action(() => proxyView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)));
            //proxyView.Invoke(new Action(() => proxyView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)));
        }