Proxy Grabber 2014 [VB.NET]

Hi Mads, this is a simple tutorial on how to make a proxy grabber in VB.NET
The program uses:

1) Regex (Regular Expression)
2) Save File Dialog (For Saving As .txt File)
3) VB.NET ([-_-])
Here we go.....................
=============================================================
Alright First Add Two Group Boxes
Than In One Add 3 Buttons
Button 1 ===> Grab List
Button 2 ===> Save List
Button 3 ===> Clear List
& In The Other A List Box


IMAGE:
756x431http://i.imgur.com/o3rmcmF.gif?1?8947[/img]

The Program Is Still Under construction
=============================================================
CODING:
Add Some Name spaces Or Decelerations At The Top:

PHP Code:


Code:
Imports System.Net
Imports System.Threading.Tasks
Imports System.Text.RegularExpressions 


Then Under Public Class Form 1 We Add Some Functions, I Divided It Into Regions:

PHP Code:

Code:
#Region " Relative URLs "
    Private ReadOnly m_proxyUrlsFormatted As String = "http://www.samair.ru/proxy/proxy-{0}.htm"
    Private ReadOnly m_proxyUrlsWithPortFormatted As String = "http://www.samair.ru/proxy/ip-port/{0}.html"#End Region

#Region " Private Members "
   
    Private ReadOnly m_proxyUrls As New List(Of String)(GeneratePagesFormatted)#End Region

#Region " Regular Expressions "
    Private ReadOnly m_urlPattern As String = "port/(\d+).html"
    Private ReadOnly m_urlMatch As New Regex(m_urlPattern)

    Private ReadOnly m_proxyWithPortPattern As String = "([\d.]+:\d{2,4})"
    Private ReadOnly m_proxyWithPortMatch As New Regex(m_proxyWithPortPattern)#End Region

#Region " Methods "
 
    Private Sub ObtainProxyLists()
        Parallel.ForEach(Me.m_proxyUrls, Sub(p)
                                             Using webClient As New WebClient
                                                 Dim link As String = String.Format(m_proxyUrlsWithPortFormatted,
                                                                                    Me.m_urlMatch.Match(webClient.DownloadString(p)).Groups(1).Value)

                                                 Me.DisplayProxys(Me.m_proxyWithPortMatch _
                                                                  .Matches(webClient.DownloadString(link)) _
                                                                  .Cast(Of Match) _
                                                                  .Select(Function(m) m.Groups(1).Value))
                                             End Using
                                         End Sub)
    End Sub

    
    Private Sub DisplayProxys(ByVal proxysWithPort As IEnumerable(Of String))
        Me.BeginInvoke(Sub() Me.ListBox1.Items.AddRange(proxysWithPort.ToArray))
        
    End Sub

    Private Sub Initiaze()
        Dim t As New task(Sub() ObtainProxyLists())
        t.Start()
    End Sub#End Region

#Region " Functions "
 
    Private Function GeneratePagesFormatted() As IEnumerable(Of String)
        Return Enumerable.Range(1, 30).Select(Function(n) String.Format(Me.m_proxyUrlsFormatted, If(n 
Share on Google Plus

About Unknown

Hey there I'm Shahid Ayan Khan The Founder Owner Of This Blog.I don't Mind Being Called A CEO.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment