04-16-2010, 02:18 PM
Well this is my first project in VB.bet.
I started following a tutorial on here. And realized it didn't look that hard.
So i started over editing the code from the original tutorial.
(thread i tuck references from http://www.supportforums.net/showthread.php?tid=6159)
Opinions and thoughts are welcome. Please bare in mind im new to VB so be gentle.
Its just a simple program to check if your ports are open.
VB source.
Download link.
http://funkyred.com/portscan.exe
I started following a tutorial on here. And realized it didn't look that hard.
So i started over editing the code from the original tutorial.
(thread i tuck references from http://www.supportforums.net/showthread.php?tid=6159)
Opinions and thoughts are welcome. Please bare in mind im new to VB so be gentle.
Its just a simple program to check if your ports are open.
VB source.
Quote:Public Class portscan
Dim host As String
Dim port As Integer
Dim counter As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CenterToScreen()
TextBox2.Text = "80"
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
host = TextBox1.Text
port = TextBox2.Text
Dim hostadd As System.Net.IPAddress = System.Net.Dns.GetHostEntry(host).AddressList(0)
Dim EPhost As New System.Net.IPEndPoint(hostadd, port)
Dim s As New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, _
System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp)
Try
s.Connect(EPhost)
Catch
End Try
If Not s.Connected Then
Label3.Text = ("Port " + port.ToString + " is closed")
Timer1.Stop()
Timer1.Enabled = False
Button1.Enabled = True
Else
Label3.Text = ("Port " + port.ToString + " is open")
Timer1.Stop()
Timer1.Enabled = False
Button1.Enabled = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label3.Text = ("Scanning:" + TextBox1.Text)
Button1.Enabled = False
Timer1.Enabled = True
Timer1.Start()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Download link.
http://funkyred.com/portscan.exe