Imports System
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Environment
Public Class Form1
Dim a As Integer
Dim Port As IPEndPoint
Dim Socket As Socket
Dim conta As Integer
Dim tick As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = (OpenFileDialog1.FileName)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
Dim sr As StreamReader = New StreamReader(TextBox1.Text)
Try
For a = 1 To 9999999
ListBox1.Items.Add(sr.ReadLine)
Next a
Catch b As Exception
Label1.Text = ListBox1.Items.Count
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ListBox1.SelectedIndex = 0
For a = 1 To ListBox1.Items.Count - 1
Application.DoEvents()
Try
Dim stringa As String = ListBox1.SelectedItem
Dim arr() As String
Dim ip As String
Dim porta As String
log.Text = "In Connessione..."
arr = Split(stringa, ":")
ip = arr(0)
porta = arr(1)
Port = New IPEndPoint(IPAddress.Parse(ip), Convert.ToInt32(porta))
Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
tick = Environment.TickCount
Socket.Connect(Port)
log.Text = "Connesso..."
Socket.Close()
conta = Environment.TickCount - tick
log.Text = "Disconnesso..."
Label3.Text += 1
Label12.Text = conta
If conta < NumericUpDown1.Value Then
ListBox2.Items.Add(ListBox1.SelectedItem)
End If
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
Catch f As SocketException
log.Text = "Socks non funzionante..."
ListBox3.Items.Add(ListBox1.SelectedItem)
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
Label4.Text += 1
End Try
Next a
MessageBox.Show("Controllo temrinato", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If File.
Exists(Application.
StartupPath & "\funzionanti.txt") = False Then
File.
Create(Application.
StartupPath & "\funzionanti.txt")
File.
Create(Application.
StartupPath & "\nonfunzionanti.txt")
MessageBox.Show("Creazione dei file completa l'applicazione verra riavviata", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Application.Restart()
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Label6.Text = ListBox1.SelectedIndex + 1
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim sw As StreamWriter = New StreamWriter(Application.StartupPath & "\funzionanti.txt")
For a = 0 To ListBox2.Items.Count - 1
sw.WriteLine(ListBox2.Items.Item(a))
Next a
sw.Close()
Dim sw2 As StreamWriter = New StreamWriter(Application.StartupPath & "\nonfunzionanti.txt")
For a = 0 To ListBox3.Items.Count - 1
sw2.WriteLine(ListBox3.Items.Item(a))
Next a
sw2.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
conta += 1
End Sub
End Class