What is a Port Scanner? - A port scanner is a simple program that scans a computer for open ports. The one we are going to make uses TCP. It uses the three way handshake to look for open ports. You can compare it to a thief going on his "scout-tour". e goes to a house before he breaks in and checks every door and window to see if anything is open so he can enter later that night without forcing something. Why would I need one? -A port scanner can serve many purposes, you can check to see if you are infected with a certain Trojan by checking your computer's open ports for specific Trojan ports. Or it can be used to see if a victim has any vulnerable ports open that can be used to gain further access to the machine. How can I create one with visual basic 6.0? - First we need to add the winsock control to our tool box so create a new project and go to the components screen (ctrl+t) then check the box next to Microsoft winsock control 6.0, and press ok. After that the control should be added to your toolbar on the left, just drag one to your form. Now create 2 textboxes, 2 buttons, 1 timer and 1 listbox. The first textbox is for the ip's, the second is for the starting port, the first button is for starting the scan, the second one is to stop the scanning. Then go to the timer and in the properties on the right change enabled to false and interval to 1000. If you like to fancy up your form with some warm colors and a fluffy border be my guest. Next go to the code window and type in the following. Private Sub Command1_Click() Winsock1.RemoteHost = Text1.Text ' The ip address or url to connect to Winsock1.RemotePort = Text2.Text ' The first port Winsock1.Connect Timer1.Enabled = True ' the rest of the ports. End Sub Private Sub Timer1_Timer() ' closes the last connection Winsock1.Close Text2.Text = Int(Text2.Text) + 1 'increases the port by one Winsock1.RemoteHost = Text1.Text Winsock1.RemotePort = Text2.Text Winsock1.Connect End Sub Now maybe you are wondering why I connected once an then enabled the timer to connect for the rest, well because of the line " Text2.Text = Int(Text2.Text) + 1 'increases the port by one " it doesn't scan the first port so you have to do it yourself . Now we have the scanning core of the port scanner, now we need something that says when it's open and when not. Private Sub Winsock1_Connect() List1.AddItem "Port " & Winsock1.RemotePort & " Is Open" End Sub This is why winsock is easy to use, everything you need is build in a nice sub. So we just code the connect sub so that when it is called by the winsock scanning for ports it puts the port number in the list. So that's basically it, but to make it complete we will code the stop button now, Private Sub Command2_Click() Timer1.Enabled = False ' stops the scanning timer Winsock1.Close ' closes any open winsock connection that was still open. End Sub That is it, you now have a simple working port scanner. Things you could do to make it better: - make a case statement in the winsock1.connect sub to recognize special ports. - make it multi threading so several sockets work with each other to scan faster. - make it output the scan result to a text file - etc |
Tag Cloud
CRM 2011
(161)
CRM 4.0
(144)
C#
(116)
JScript
(109)
Plugin
(92)
Registry
(90)
Techpedia
(77)
PyS60
(68)
WScript
(43)
Plugin Message
(31)
Exploit
(27)
ShellCode
(26)
FAQ
(22)
JavaScript
(21)
Killer Codes
(21)
Hax
(18)
VB 6.0
(17)
Commands
(16)
VBScript
(16)
Quotes
(15)
Turbo C++
(13)
WMI
(13)
Security
(11)
1337
(10)
Tutorials
(10)
Asp.Net
(9)
Safe Boot
(9)
Python
(8)
Interview Questions
(6)
video
(6)
Ajax
(5)
VC++
(5)
WebService
(5)
Workflow
(5)
Bat
(4)
Dorks
(4)
Sql Server
(4)
Aptitude
(3)
Picklist
(3)
Tweak
(3)
WCF
(3)
regex
(3)
Config
(2)
LINQ
(2)
PHP
(2)
Shell
(2)
Silverlight
(2)
TSql
(2)
flowchart
(2)
serialize
(2)
ASHX
(1)
CRM 4.0 Videos
(1)
Debug
(1)
FetchXml
(1)
GAC
(1)
General
(1)
Generics
(1)
HttpWebRequest
(1)
InputParameters
(1)
Lookup
(1)
Offline Plug-ins
(1)
OutputParameters
(1)
Plug-in Constructor
(1)
Protocol
(1)
RIA
(1)
Sharepoint
(1)
Walkthrough
(1)
Web.config
(1)
design patterns
(1)
generic
(1)
iframe
(1)
secure config
(1)
unsecure config
(1)
url
(1)
Pages
Monday, August 01, 2011
Basic PortScanner in VB6.0
Labels:
VB 6.0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment