Toon posts:

C# laat gevonden ip adressen in listbox zien en gebruik ip's

Pagina: 1
Acties:
  • 426 views

Onderwerpen

Vraag


  • Relicant
  • Registratie: Augustus 2019
  • Laatst online: 23-10-2019
Ik maak een proxyscraper in Nu wil ik alleen nog dat de gevonden proxys in me listbox worden getoond, want nu zijn ze alleen nog maar te zien in een txt file.

En dat de gevonden proxies gebruikt kunnen worden in een webbrowser control misschien door de textfile te linken met een webbrowser maar ik heb geen idee hoe ik dat kan doen en of dat mogelijk is om die ip adressen gerandomized te kunnen gebruiken in een webbrowser. Kan iemand me misschien verder helpen?


Dit is mijn code:

C#:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace YoutubeProxy
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string[] querys = { "fresh proxies", "pastebin proxies", "grayhatforum proxylist", "pastebin proxylist", ".txt proxylist", "pastebin proxy ip port" };

            label1.Text = "Proxyscraper";
            int count = 15;//pages to scrape (all on first page npt looping this time)
            Regex linkRegex = new Regex("<a href=\"(.*?)\" h=");
            Regex proxyRegex = new Regex(@"\d{1,3}(\.\d{1,3}){3}:\d{1,5}");
            Regex proxyRegex2 = new Regex(@"\d{1,3}(\.\d{1,3}){3}</td><td>\d{1,5}");
            WebClient webClient = new WebClient();
            List<string> alreadyFound = new List<string>();
            string filename = "scraped_proxylist.txt";
            File.WriteAllText(filename, "");
            int counter = 0;
            foreach (string tofind in querys)
            {
                string url = "https://www.bing.com/search?q=" + tofind + "\"&count=#count#";
                try
                {
                    string code = webClient.DownloadString(url.Replace("#count#", count.ToString()));
                    MatchCollection matches1 = linkRegex.Matches(code);
                    foreach (Match match in matches1)
                    {
                        try
                        {
                            string s = match.Groups[1].Value;

                            if (s.StartsWith("http") & !s.Contains("amp") & !s.Contains("microsoft"))//amp & microsoft to avoid shit from Bing
                            {
                                string html = webClient.DownloadString(s);
                                MatchCollection matches = proxyRegex.Matches(html);
                                foreach (Match m in matches)
                                {
                                    string proxy = m.Groups[0].Value;
                                    if (!alreadyFound.Contains(proxy))
                                    {
                                        counter++;
                                        alreadyFound.Add(proxy);
                                        listBox1.Items.Add(proxy);
                                        File.AppendAllText(filename, proxy + Environment.NewLine);
                                    }
                                }
                                matches = proxyRegex2.Matches(html);
                                foreach (Match m in matches)
                                {
                                    string proxy = m.Groups[0].Value.Replace("</td><td>", ":");
                                    if (!alreadyFound.Contains(proxy))
                                    {
                                        counter++;
                                        alreadyFound.Add(proxy);
                                        listBox1.Items.Add(proxy);
                                        File.AppendAllText(filename, proxy + Environment.NewLine);
                                    }
                                }
                                label1.Text = "ProxyScraper " + "\"" + tofind + "\" Proxys = " + counter + " Url: " + s;
                            }
                        }
                        catch { }
                    }
                }
                catch { }
            }
            listBox1.Items.Add("Done!");
            label1.Text = "Proxyscraper" + counter + " proxies found.";
            while (true) { }
        }
    }
}


Zal iemand me verder op weg kunnen helpen?

Alvast bedankt :)

[Voor 0% gewijzigd door RobIII op 16-08-2019 17:10. Reden: Code tags gefixed]

Alle reacties


  • Kheos
  • Registratie: Juni 2011
  • Laatst online: 18:53
Relicant schreef op vrijdag 16 augustus 2019 @ 17:01:
Ik maak een proxyscraper in Nu wil ik alleen nog dat de gevonden proxys in me listbox worden getoond, want nu zijn ze alleen nog maar te zien in een txt file.

En dat de gevonden proxies gebruikt kunnen worden in een webbrowser control misschien door de textfile te linken met een webbrowser maar ik heb geen idee hoe ik dat kan doen en of dat mogelijk is om die ip adressen gerandomized te kunnen gebruiken in een webbrowser. Kan iemand me misschien verder helpen?


Dit is mijn code:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace YoutubeProxy
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string[] querys = { "fresh proxies", "pastebin proxies", "grayhatforum proxylist", "pastebin proxylist", ".txt proxylist", "pastebin proxy ip port" };

            label1.Text = "Proxyscraper";
            int count = 15;//pages to scrape (all on first page npt looping this time)
            Regex linkRegex = new Regex("<a href=\"(.*?)\" h=");
            Regex proxyRegex = new Regex(@"\d{1,3}(\.\d{1,3}){3}:\d{1,5}");
            Regex proxyRegex2 = new Regex(@"\d{1,3}(\.\d{1,3}){3}</td><td>\d{1,5}");
            WebClient webClient = new WebClient();
            List<string> alreadyFound = new List<string>();
            string filename = "scraped_proxylist.txt";
            File.WriteAllText(filename, "");
            int counter = 0;
            foreach (string tofind in querys)
            {
                string url = "https://www.bing.com/search?q=" + tofind + "\"&count=#count#";
                try
                {
                    string code = webClient.DownloadString(url.Replace("#count#", count.ToString()));
                    MatchCollection matches1 = linkRegex.Matches(code);
                    foreach (Match match in matches1)
                    {
                        try
                        {
                            string s = match.Groups[1].Value;

                            if (s.StartsWith("http") & !s.Contains("amp") & !s.Contains("microsoft"))//amp & microsoft to avoid shit from Bing
                            {
                                string html = webClient.DownloadString(s);
                                MatchCollection matches = proxyRegex.Matches(html);
                                foreach (Match m in matches)
                                {
                                    string proxy = m.Groups[0].Value;
                                    if (!alreadyFound.Contains(proxy))
                                    {
                                        counter++;
                                        alreadyFound.Add(proxy);
                                        listBox1.Items.Add(proxy);
                                        File.AppendAllText(filename, proxy + Environment.NewLine);
                                    }
                                }
                                matches = proxyRegex2.Matches(html);
                                foreach (Match m in matches)
                                {
                                    string proxy = m.Groups[0].Value.Replace("</td><td>", ":");
                                    if (!alreadyFound.Contains(proxy))
                                    {
                                        counter++;
                                        alreadyFound.Add(proxy);
                                        listBox1.Items.Add(proxy);
                                        File.AppendAllText(filename, proxy + Environment.NewLine);
                                    }
                                }
                                label1.Text = "ProxyScraper " + "\"" + tofind + "\" Proxys = " + counter + " Url: " + s;
                            }
                        }
                        catch { }
                    }
                }
                catch { }
            }
            listBox1.Items.Add("Done!");
            label1.Text = "Proxyscraper" + counter + " proxies found.";
            while (true) { }
        }
    }
}


Zal iemand me verder op weg kunnen helpen?

Alvast bedankt :)
lees je post nog eens na, en corrigeer waar nodig want ik kan er nu geen vis van pellen. Of chocola van maken.

  • RobIII
  • Registratie: December 2001
  • Laatst online: 18:26

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

Sorry, maar zo werkt 't hier niet. Neem even onze Quickstart door en open dan een nieuw topic met enkel relevante(!) code a.u.b.

Oh, en als je [code=c#] gebruikt i.p.v. [code] krijg je extra-gratis syntax-highlighting erbij ;)

[Voor 20% gewijzigd door RobIII op 16-08-2019 17:11]

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Roses are red Violets are blue, Unexpected ‘{‘ on line 32.

Over mij


Dit topic is gesloten.


Tweakers maakt gebruik van cookies

Tweakers plaatst functionele en analytische cookies voor het functioneren van de website en het verbeteren van de website-ervaring. Deze cookies zijn noodzakelijk. Om op Tweakers relevantere advertenties te tonen en om ingesloten content van derden te tonen (bijvoorbeeld video's), vragen we je toestemming. Via ingesloten content kunnen derde partijen diensten leveren en verbeteren, bezoekersstatistieken bijhouden, gepersonaliseerde content tonen, gerichte advertenties tonen en gebruikersprofielen opbouwen. Hiervoor worden apparaatgegevens, IP-adres, geolocatie en surfgedrag vastgelegd.

Meer informatie vind je in ons cookiebeleid.

Sluiten

Toestemming beheren

Hieronder kun je per doeleinde of partij toestemming geven of intrekken. Meer informatie vind je in ons cookiebeleid.

Functioneel en analytisch

Deze cookies zijn noodzakelijk voor het functioneren van de website en het verbeteren van de website-ervaring. Klik op het informatie-icoon voor meer informatie. Meer details

janee

    Relevantere advertenties

    Dit beperkt het aantal keer dat dezelfde advertentie getoond wordt (frequency capping) en maakt het mogelijk om binnen Tweakers contextuele advertenties te tonen op basis van pagina's die je hebt bezocht. Meer details

    Tweakers genereert een willekeurige unieke code als identifier. Deze data wordt niet gedeeld met adverteerders of andere derde partijen en je kunt niet buiten Tweakers gevolgd worden. Indien je bent ingelogd, wordt deze identifier gekoppeld aan je account. Indien je niet bent ingelogd, wordt deze identifier gekoppeld aan je sessie die maximaal 4 maanden actief blijft. Je kunt deze toestemming te allen tijde intrekken.

    Ingesloten content van derden

    Deze cookies kunnen door derde partijen geplaatst worden via ingesloten content. Klik op het informatie-icoon voor meer informatie over de verwerkingsdoeleinden. Meer details

    janee