Hacking It: How To Make A Port Scanner/linksdirectory/hackernews
How To Make A Port Scanner

-Start by opening Visual Basic-& then starting a new - "Standard EXE"

Next place the following on your standard exe.

2 Text boxes

Name the two text boxes "Text1", and "Text2"

Next place a list box on your form, - name it "List1"

Now place 3 command buttons on your form & name them "Command1" "Command2" "Command3"

Now place a timer on your form and name it "Timer1"

Then place a winsock componet your form and name it "Winsock1" if you dont have the winsock button on your component bar, you can add it by right clicking on the bar & scrolling to components, adding it from the component list, it should be called "Microsoft Winsock Control 6.0 (SP6)"

Alright now put captions on our ****, caption command1 as "Start Scan" & caption command2 as "Stop Scan" & caption command3 as "Clear"

Now Add The Following Code:


Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = False
Text2.Text = "0"
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Text2.Text = Text2.Text + 1
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Text2.Text
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Text2.Text = "0"
End Sub
Private Sub Command3_Click()
End Sub
Private Sub Winsock1_Connect()
List1.AddItem Winsock1.RemotePort & " is open!"
End Sub


Visit the Site