Jump to content




Recent Status Updates

View All Updates

Binpress - Cut your development time and costs in half
Photo
- - - - -

VB 6.0: Tutorial, Making a Port Scanner

timer port scanner

  • Please log in to reply
122 replies to this topic

#1 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7,563 posts

Posted 22 August 2006 - 08:10 AM

Introduction/Problem:-
Well I was searching the net for a port scanner and you know what! Some of them didn't work, others froze my PC, and others were soooo somplicated with alot of BS! So I decided to make mine and I decided to make a TUT for you my friends!

Usage:-
Well simple, scan an IP for open ports, you can scan your own PC so to see if you have any open ports, if you find any open ports you may be infected from or Virus or trojan and a hacker can connect and can control your PC by connecting to your PC from that port!

Requirements:-
Visual Basic (prefiribly 6.0)
Solution:-
Ok So as usual open VB, and choose Standars EXE, i will not post a picture of this step coz I posted this on other Tuts so if you dont know how see the other tuts!

What you need:-
2 Text boxes ( Text1,Text2 )
1 ListBox ( List1 )
3 Command Buttons ( Command1, Command2, Command3 )
1 Timer ( Timer1 )
1 Winsock Component ( Winsock1 )
If you can't find the Winsock do as below:-

Posted Image

And after a dialog box will be displayed scroll down till you find "Microsoft Winsock Control 6.0 (SP6)"
here is how:-

Posted Image

Ok so now we have everything setup here is the GUI I used, you can make your own, but I will just "inspire' you lol!:-

Posted Image

Ok now that you setup everything its time for the code( I know its a bit long but dont worry I will explain EVERYTHING!):-

Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = False
Text2.Text = "0"
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Winsock1.Close
Text2.Text = Text2.Text + 1
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Text2.Text
Winsock1.Connect
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()
List1.Clear
End Sub
Private Sub Winsock1_Connect()
List1.AddItem Winsock1.RemotePort & " is open!"
End Sub

Code Explanation:-
Private Sub Form_Load()
Timer1.Interval = 1
Timer1.Enabled = False
Text2.Text = "0"
End Sub
Here we are Disabling the timer so when we start our program the it will not start scanning!
and then we are setting Text2 to 0 ( this is the port number to start with )

Private Sub Timer1_Timer()
On Error Resume Next
Winsock1.Close
Text2.Text = Text2.Text + 1
Winsock1.RemoteHost = Text1.Text
Winsock1.RemotePort = Text2.Text
Winsock1.Connect
End Sub
Here is the main program, when an error is encountered it will still continue,Closes the conenction, increase the port number by 1, and tries to connect!

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Start Scanning

Private Sub Command2_Click()
Timer1.Enabled = False
Text2.Text = "0"
End Sub
Stop and reset the port number to 0

Private Sub Command3_Click()
List1.Clear
End Sub
Here it clears the list of the open ports that were found!

Private Sub Winsock1_Connect()
List1.AddItem Winsock1.RemotePort & " is open!"
End Sub
When an open port is found it adds the port number to the listbox!

How does this works?
Just enter an IP ( if you want to scan your own PC go on www.whatismyip.com ) and copy the IP and paste it in the Textbox ( text1 ) and hit the command1 button! text2 ( from what port to start scanning )is 0 by default but you can set it to any port number you want!

Complete Source Code:-
Well I included the FULL source code its an attachment, its the complete project just compile and have fun

Ending:-
If you have any questions/problems/feedback pls post here and I will sureley Help you!
So I'm waiting for your feedback
Ow and if you want me to make you some tutorials request what you want and I will see what I can do! I will be happy making some tuts here!

Tcm9669

Attached Files


  • 3

#2 falco85

falco85

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 105 posts

Posted 22 August 2006 - 03:59 PM

That is a nice tutorial, I think I'll use this software! I don't know VB that well so I may port this to C# or even C++. Very nice!
  • 0

#3 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7,563 posts

Posted 22 August 2006 - 11:38 PM

Thanks for your feedback! You are Welcome!
Well with this you can even play tricks on your friends!
Just ask them for their op or have their Ip from MSN or so, then scan their IP and for example if you find some port open google it and it CAN give you what prog uses that port, so then you tell your friends ow so you have the program ....... open! and he/she will be like HUH? how do you know that?

Lol its a funny thing to do!
  • 0

#4 Guest_gregpab_*

Guest_gregpab_*
  • Guest

Posted 26 December 2006 - 07:16 AM

Hi!
How can I get the full source code?
  • 0

#5 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7,563 posts

Posted 26 December 2006 - 07:57 AM

You need to at least post 5 posts on this CodeCall ( meaning post any other 4 posts where you want ) and then go to the end of the tutorial where you will find:-

Attached Files
File Type: zip PortScanner.zip (2.4 KB, 4 views)

Click there and you will download it!
  • 0

#6 xXHalfSliceXx

xXHalfSliceXx

    CC Leader

  • Retired Mod
  • PipPipPipPipPipPipPip
  • 1,560 posts

Posted 26 December 2006 - 08:00 AM

Yes. I think we might install a double post merge script
  • 0

Posted Image
Posted Image


#7 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 26 December 2006 - 08:01 AM

Just set the rule down to 1 post for downloads.
  • 0

#8 Gaurang

Gaurang

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 08 February 2007 - 09:37 PM

How do i Post? is this call a post?
  • 0

#9 Gaurang

Gaurang

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 08 February 2007 - 09:42 PM

Here i only found the word Message. nowhere i can c a word like a post. so how do i post so i can get the facility of downloading. is this message increment my post status? :confused:
  • 0

#10 Gaurang

Gaurang

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 08 February 2007 - 09:45 PM

Sorry for disturbing you guys. ok now i get it activated and downloaded. thx and sorry for abusing your spaces of good column
  • 0

#11 Guest_D3t0x_*

Guest_D3t0x_*
  • Guest

Posted 23 June 2007 - 12:17 AM

NIce... I like it!
  • 0

#12 Guest_Neo_dk_*

Guest_Neo_dk_*
  • Guest

Posted 29 June 2007 - 03:31 AM

will try this
  • 0





Also tagged with one or more of these keywords: timer, port scanner

Powered by binpress