How can you make your own port scanner in easy way using Visual Basic . But Firstly you need to know
What is Port Scanner ?
With many new security threats arriving everyday, protecting your computer and digital files is even more important. One threat today is port scanning. Port scanning happens to most people whether they realize it or not. Protecting yourself against port scans can help you secure your system from malicious users.
All computers have ports, and services run on these ports. When your computer needs to connect to your mail server in order to check your email, it will open one of these ports and make a connection to download your new email. However sometimes these ports are always on and listening. A port scan occurs when an attacker scans a host to see which ports are open and which are closed or not in use.
Think of a port scan like checking doors and windows of your house to see if it is locked or not. While the attacker may not break into your house he may know that there is a window unlocked and entry can be achieved easily. A port scanner works in much the same way as it checks ports on your computer to see which is closed or open. It is not illegal in most places to do a port scan because basically your just checking if the connection can be made and not actually making a connection to the host.
Need to make Port Scanner :-
- Visual Basic
- Computer and your thinking
That's it
Ready to make Port Scanner:-
- Create a New Project
- Add the Following In their 3 Labels(Label 1,Label 2,Label 3), 1 Textbox, 1 Button, 1 List Box, 2 Numeric Up downs(on Label 2 and Label 3)
- Arrange them to how You Like
- Rename Your Items
Label 1= IP Address
Label 2= Start Port
Label 3= End Port
Button 1= Start
You will give any name what you want.....
- Double Click the Back to view The Code and Insert this
Imports System.Net.Sockets
Imports System.Net
Public Class Form1
Private Sub btnScan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScan.Click
Me.CheckForIllegalCrossThreadCalls = False 'Now you can Add items through a thread
For i As Integer = nudStart.Value To nudStop.Value
Dim tmpThread As New System.Threading.Thread(AddressOf ScanPort)
tmpThread.IsBackground = True
tmpThread.Start(i) 'i represents the current port
Next
End Sub
Private Sub ScanPort(ByVal port As Integer)
Try 'Always put your code [or more complicated code] in a Try Catch Block :]
Dim tmpClient As New TcpClient()
Dim tmpEndPoint As New IPEndPoint(IPAddress.Parse(TextBox1.Text), port)
tmpClient.Connect(tmpEndPoint)
Threading.Thread.Sleep(50) '50 is the Timeout in ms.
If tmpClient.Connected = True Then
Ports.Items.Add("Open Port: " & port) 'If Connected then it will be an open port
End If
Catch ex As Exception
End Try
End Sub
End Class
plz comment if you want any more information :-