Jump to content
Ras

[VB6] Port Scanner

Recommended Posts

Intra in VB fa un proiect nou.

Adauga Winsock Control (apesti CTRL + T si selectezi acolo).

Creeaza 2 textboxes, 2 buttons, 1 timer, 1 listbox, 1 winsock

Primul Textbox este pt IP, al doilea pt port, primul buton pt start, al doilea pt stop.

Pune timerul False si pune intervalu 1.

In primul buton scrii:
Private Sub Command1_Click()
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Text2.Text
Winsock1.Connect
Timer1.Enabled = True
End Sub


In timer scrii:
Private Sub Timer1_Timer()
Winsock1.Close ' closes the last connection
Text2.Text = Int(Text2.Text) + 1
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Text2.Text
Winsock1.Connect
End Sub


In winsock scrii:
Private Sub Winsock1_Connect()
List1.AddItem "Port " & Winsock1.RemotePort & " is having a yard sale."
End Sub


In al doilea buton scrii:
Private Sub Command2_Click()
Timer1.Enabled = False ' stops the scanning timer
Winsock1.Close ' closes any open winsock connection that was still open.
End Sub

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...