[php]Imports System.Net.Sockets
Imports System.Threading
Imports System.IO
Imports system.Text
Imports System.Net
Public Class Form1
Dim rscan As Integer = 1
Dim threads As Integer
Dim tmpThreadZ As New System.Threading.Thread(AddressOf Strt)
Dim port As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If String.IsNullOrEmpty(TextBox1.Text) Or String.IsNullOrEmpty(TextBox2.Text) Then
MessageBox.Show("Verifica Setarile !", "Error")
Else
port = TextBox1.Text
tmpThreadZ.IsBackground = True
If (tmpThreadZ.ThreadState And ThreadState.Unstarted) Then
tmpThreadZ.Start()
Else
tmpThreadZ.Resume()
End If
Button1.Enabled = False
Button2.Enabled = True
End If
End Sub
Public Sub Strt()
Do Until rscan = 2
If threads > TextBox2.Text Then
Thread.Sleep(50)
Application.DoEvents()
Else
Dim A As String = GetRandomNumber(1, 255)
Dim B As String = GetRandomNumber(1, 255)
Dim C As String = GetRandomNumber(1, 255)
Dim D As String = GetRandomNumber(1, 255)
Dim tmpThread As New System.Threading.Thread(AddressOf RangeScan)
tmpThread.IsBackground = True
tmpThread.Start(A & "." & B & "." & C & "." & D) 'i represents the current port
threads += 1
End If
Loop
End Sub
Private Sub RangeScan(ByVal i As Object)
Dim tmpClient As New TcpClient()
Dim tmpEndPoint As New IPEndPoint(IPAddress.Parse(i), port)
Try
tmpClient.Connect(tmpEndPoint)
Threading.Thread.Sleep(500) ' Timeout
If tmpClient.Connected = True Then
ListBox1.Items.Add(i)
threads -= 1
tmpClient.Close()
End If
Catch ex As Exception
threads -= 1
tmpClient.Close()
End Try
End Sub
Dim objRandom As New System.Random( _
CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))
Public Function GetRandomNumber( _
Optional ByVal Low As Integer = 1, _
Optional ByVal High As Integer = 100) As Integer
Return objRandom.Next(Low, High + 1)
End Function
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If tmpThreadZ.IsAlive Then
tmpThreadZ.Suspend()
Button1.Enabled = True
Button2.Enabled = False
Else
Button1.Enabled = True
Button2.Enabled = False
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
Button2.Enabled = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim coco As New StreamWriter(TextBox3.Text, True)
For Each item As String In ListBox1.Items
coco.WriteLine(item.ToString)
Next
coco.Close()
End Sub
End Class
================================================== ====
*Tnx to
Mr.XpR -UnknowN- Syamak Black - Samim.s
FarbodEZRaeL-Sianor-All iranian Hackerz
================================================== ====[/php]
Imports System.Threading
Imports System.IO
Imports system.Text
Imports System.Net
Public Class Form1
Dim rscan As Integer = 1
Dim threads As Integer
Dim tmpThreadZ As New System.Threading.Thread(AddressOf Strt)
Dim port As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If String.IsNullOrEmpty(TextBox1.Text) Or String.IsNullOrEmpty(TextBox2.Text) Then
MessageBox.Show("Verifica Setarile !", "Error")
Else
port = TextBox1.Text
tmpThreadZ.IsBackground = True
If (tmpThreadZ.ThreadState And ThreadState.Unstarted) Then
tmpThreadZ.Start()
Else
tmpThreadZ.Resume()
End If
Button1.Enabled = False
Button2.Enabled = True
End If
End Sub
Public Sub Strt()
Do Until rscan = 2
If threads > TextBox2.Text Then
Thread.Sleep(50)
Application.DoEvents()
Else
Dim A As String = GetRandomNumber(1, 255)
Dim B As String = GetRandomNumber(1, 255)
Dim C As String = GetRandomNumber(1, 255)
Dim D As String = GetRandomNumber(1, 255)
Dim tmpThread As New System.Threading.Thread(AddressOf RangeScan)
tmpThread.IsBackground = True
tmpThread.Start(A & "." & B & "." & C & "." & D) 'i represents the current port
threads += 1
End If
Loop
End Sub
Private Sub RangeScan(ByVal i As Object)
Dim tmpClient As New TcpClient()
Dim tmpEndPoint As New IPEndPoint(IPAddress.Parse(i), port)
Try
tmpClient.Connect(tmpEndPoint)
Threading.Thread.Sleep(500) ' Timeout
If tmpClient.Connected = True Then
ListBox1.Items.Add(i)
threads -= 1
tmpClient.Close()
End If
Catch ex As Exception
threads -= 1
tmpClient.Close()
End Try
End Sub
Dim objRandom As New System.Random( _
CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))
Public Function GetRandomNumber( _
Optional ByVal Low As Integer = 1, _
Optional ByVal High As Integer = 100) As Integer
Return objRandom.Next(Low, High + 1)
End Function
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If tmpThreadZ.IsAlive Then
tmpThreadZ.Suspend()
Button1.Enabled = True
Button2.Enabled = False
Else
Button1.Enabled = True
Button2.Enabled = False
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
Button2.Enabled = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim coco As New StreamWriter(TextBox3.Text, True)
For Each item As String In ListBox1.Items
coco.WriteLine(item.ToString)
Next
coco.Close()
End Sub
End Class
================================================== ====
*Tnx to
Mr.XpR -UnknowN- Syamak Black - Samim.s
FarbodEZRaeL-Sianor-All iranian Hackerz
================================================== ====[/php]