How To Make A Proxy Grabber In VB.NET

How To Make A Proxy Grabber In VB.NET
Okay now we are going to make a proxy grabber , so what is this proxy grabber thing ? first of all proxy is something that covers your ip address(it's like you put a jacket when snow falls lol ) and grabber ? grabber is  meant for something that will fetch you things or whatever it's called . For this tutorial we are using websites that provides proxies so we use httpwebrequest and grab the proxies from the website and we check for the right format by using regex .

Let's start ,
First go ahead and create a new project and we need a ListBox and Three Buttons so just add them . After adding them to your form arrange as you see in the below picture.
How To Make A Proxy Grabber In VB.NET
Now coming to the coding point , first add Imports System.Text.RegularExpressions namespace because we use regex as i said before , first open the button click event which is the grab button and add this codes.
 'creating our httpwebrequest target NOTE: you can use any websites that use to provide proxies directly
        Dim the_request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://proxy-ip-list.com")
        'creating the httpwebresponce
        Dim the_response As System.Net.HttpWebResponse = the_request.GetResponse
        'defining the stream reader to read the data from the httpwebresponse
        Dim stream_reader As System.IO.StreamReader = New System.IO.StreamReader(the_response.GetResponseStream())
        'defining a string to stream reader fisnished streaming
        Dim code As String = stream_reader.ReadToEnd
        'haha here we use the regex
        Dim expression As New System.Text.RegularExpressions.Regex("[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{1,4}")
        'adding the proxies to the listbox
        Dim mtac As MatchCollection = expression.Matches(code)
        For Each itemcode As Match In mtac
            ListBox1.Items.Add(itemcode)
        Next
After the first button we will see the second button which save.
   If ListBox1.Items.Count = (0) Then
            MessageBox.Show("Please click grab to grab proxies and then try saving", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Else
            'defining a streamwriter
            Dim S_W As IO.StreamWriter
            'converting listbox items to string
            Dim itms() As String = {ListBox1.Items.ToString}
            ''defining a savefiledialog
            Dim save As New SaveFileDialog
            Dim it As Integer
            save.FileName = "Grabbed Proxies"
            save.Filter = "Grabbed Proxies (*.txt)|*.txt|ALL Files (*.*)|*.*"
            save.CheckPathExists = True
            save.ShowDialog(Me)
            S_W = New IO.StreamWriter(save.FileName)
            For it = 0 To ListBox1.Items.Count - 1
                S_W.WriteLine(ListBox1.Items.Item(it))
            Next
            S_W.Close()
        End If
At last we need to add a line of code to clear the listbox which is
        ListBox1.Items.Clear()

Finally debug your program and test test .. How To Make A Proxy Grabber In VB.NET
YAY it's working ,I have explained the code by commenting over the codes and i hope this is helpful . thanks

6 comments

Anonymous - Comment Edited mod

Working Working

Reply

Great tutorial! keep on..

Reply

Hello what if i want to grab fresh proxies from a blog or a website where they update fresh proxies daily to mah tool?

Reply

it's possible as long as you use the right regular expressions

Reply

would be cool to show how to get more then just the proxies on the first page as thats not enough to do much with , but nice basic example

Reply
This comment has been removed by the author.

Post a Comment

Note: Only a member of this blog may post a comment.