Advertisement
ZeekoSec

Proxy Checker

Feb 6th, 2015
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.18 KB | None | 0 0
  1.  
  2.  
  3.     Imports System.IO
  4.     Imports System.Net
  5.     Public Class Form1
  6.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  7.     Dim fo As New OpenFileDialog
  8.     fo.RestoreDirectory = True
  9.     fo.Multiselect = False
  10.     fo.Filter = "txt files (*.txt)|*.txt"
  11.     fo.FilterIndex = 1
  12.     fo.ShowDialog()
  13.     If (Not fo.FileName = Nothing) Then
  14.     Dim proxies As New List(Of String)
  15.     Using sr As New StreamReader(fo.FileName)
  16.     While sr.Peek <> -1
  17.     proxies.Add(sr.ReadLine())
  18.     End While
  19.     End Using
  20.     Dim myProxy As WebProxy
  21.     For Each proxy As String In proxies
  22.     Try
  23.     myProxy = New WebProxy(proxy)
  24.     Dim r As HttpWebRequest = HttpWebRequest.Create("http://www.google.com")
  25.     r.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36"
  26.     r.Timeout = 3000
  27.     r.Proxy = myProxy
  28.     Dim re As HttpWebResponse = r.GetResponse()
  29.     ListBox1.Items.Add("Working Proxy: " & proxy)
  30.     Catch ex As Exception
  31.     ListBox1.Items.Add("Unresponsive Proxy: " & proxy)
  32.     End Try
  33.     Next
  34.     End If
  35.     End Sub
  36.      
  37.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  38.     If (ListBox1.Items.Count > 0) Then
  39.     Dim fs As New SaveFileDialog
  40.     fs.RestoreDirectory = True
  41.     fs.Filter = "txt files (*.txt)|*.txt"
  42.     fs.FilterIndex = 1
  43.     fs.ShowDialog()
  44.     If Not (fs.FileName = Nothing) Then
  45.     Using sw As New StreamWriter(fs.FileName)
  46.     For Each line As String In ListBox1.Items
  47.     sw.WriteLine(line)
  48.     Next
  49.     End Using
  50.     End If
  51.     End If
  52.     End Sub
  53.      
  54.     Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  55.     If (ListBox1.Items.Count > 0) Then
  56.     Dim fs As New SaveFileDialog
  57.     fs.RestoreDirectory = True
  58.     fs.Filter = "txt files (*.txt)|*.txt"
  59.     fs.FilterIndex = 1
  60.     fs.ShowDialog()
  61.     If Not (fs.FileName = Nothing) Then
  62.     Using sw As New StreamWriter(fs.FileName)
  63.     For Each line As String In ListBox1.Items
  64.     If (line.StartsWith("Working Proxy: ")) Then sw.WriteLine(line)
  65.     Next
  66.     End Using
  67.     End If
  68.     End If
  69.     End Sub
  70.     End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement