📄 frmmain.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx"
Begin VB.Form frmMain
Caption = "Port Scanner"
ClientHeight = 5055
ClientLeft = 60
ClientTop = 345
ClientWidth = 7290
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5055
ScaleWidth = 7290
StartUpPosition = 3 'Windows Default
Begin MSComctlLib.ProgressBar pgbrPorts
Height = 375
Left = 3840
TabIndex = 5
Top = 1560
Visible = 0 'False
Width = 2415
_ExtentX = 4260
_ExtentY = 661
_Version = 393216
Appearance = 1
End
Begin MSComctlLib.StatusBar sbMain
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 18
Top = 4680
Width = 7290
_ExtentX = 12859
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 3
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 7223
Text = "Ready"
TextSave = "Ready"
Key = "Info"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 6
TextSave = "12/4/2001"
Key = "Date"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
TextSave = "7:30 PM"
Key = "Time"
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = "# of Winsocks"
Height = 615
Index = 1
Left = 5880
TabIndex = 13
Top = 120
Width = 1335
Begin VB.TextBox txtWinsocks
Alignment = 1 'Right Justify
Height = 285
Left = 120
TabIndex = 14
Text = "200"
Top = 240
Width = 1095
End
End
Begin VB.Frame framePortsToScan
Caption = "What Ports To Check"
Height = 1335
Left = 2760
TabIndex = 3
Top = 120
Width = 3015
Begin VB.OptionButton optPortOptions
Caption = "Manual"
Height = 255
Index = 2
Left = 120
TabIndex = 11
Top = 960
Value = -1 'True
Width = 855
End
Begin VB.OptionButton optPortOptions
Caption = "Known Trojan/Backdoors"
Height = 255
Index = 1
Left = 120
TabIndex = 10
Top = 600
Width = 2775
End
Begin VB.TextBox txtToPort
Height = 285
Left = 2160
TabIndex = 9
Text = "32000"
Top = 960
Width = 735
End
Begin VB.TextBox txtFromPort
Height = 285
Left = 1080
TabIndex = 8
Text = "0"
Top = 960
Width = 735
End
Begin VB.OptionButton optPortOptions
Caption = "Registered"
Height = 255
Index = 0
Left = 120
TabIndex = 4
Top = 240
Width = 1095
End
Begin VB.Label Label1
Caption = "to"
Height = 255
Index = 0
Left = 1920
TabIndex = 12
Top = 960
Width = 255
End
End
Begin MSComctlLib.ImageList imglst
Left = 6600
Top = 1920
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
MaskColor = 12632256
_Version = 393216
End
Begin MSWinsockLib.Winsock tcpClient
Index = 0
Left = 6720
Top = 1440
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "IP Range"
Height = 1335
Index = 0
Left = 120
TabIndex = 2
Top = 120
Width = 2535
Begin VB.TextBox txtEndIP
Height = 285
Left = 720
TabIndex = 15
Top = 600
Width = 1695
End
Begin VB.CheckBox chkJustMyComputer
Caption = "Just My Computer"
Height = 255
Left = 240
TabIndex = 7
Top = 960
Value = 1 'Checked
Width = 1575
End
Begin VB.TextBox txtStartIP
Height = 285
Left = 720
TabIndex = 0
Top = 240
Width = 1695
End
Begin VB.Label Label1
Caption = "to"
Height = 255
Index = 2
Left = 120
TabIndex = 17
Top = 600
Width = 495
End
Begin VB.Label Label1
Caption = "From"
Height = 255
Index = 1
Left = 120
TabIndex = 16
Top = 240
Width = 495
End
End
Begin VB.CommandButton cmdScan
Caption = "Start Scan"
Height = 375
Left = 6000
TabIndex = 1
Top = 960
Width = 1095
End
Begin MSComctlLib.TreeView tvwScans
Height = 1815
Left = 120
TabIndex = 6
Top = 1560
Width = 3615
_ExtentX = 6376
_ExtentY = 3201
_Version = 393217
LineStyle = 1
Style = 7
Appearance = 1
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const NumberOfWinsocks = 1000
Const TimeOut = 0.125 'Timeout in seconds
Dim blRefreshing As Boolean
Dim iphDNS As New IPHostResolver
Dim cn As ADODB.Connection
Dim rsPorts As ADODB.Recordset
Dim rsTroj As ADODB.Recordset
Dim rsReg As ADODB.Recordset
Dim blStop As Boolean
Dim lngCurrentWinsock As Long
Private Sub chkJustMyComputer_Click()
If Me.chkJustMyComputer Then
Me.txtStartIP.Text = Me.tcpClient(0).LocalIP
Me.txtEndIP.Text = Me.tcpClient(0).LocalIP
End If
Me.txtStartIP.Enabled = IIf(Me.chkJustMyComputer, False, True)
Me.txtEndIP.Enabled = IIf(Me.chkJustMyComputer, False, True)
End Sub
Private Sub Form_Load()
Me.txtStartIP.Text = Left(Me.tcpClient(0).LocalIP, InStrRev(Me.tcpClient(0).LocalIP, ".")) & "0"
Me.txtEndIP.Text = Left(Me.tcpClient(0).LocalIP, InStrRev(Me.tcpClient(0).LocalIP, ".")) & "255"
Set cn = MakeConnection
Set rsTroj = New ADODB.Recordset
Set rsPorts = New ADODB.Recordset
Set rsReg = New ADODB.Recordset
rsTroj.CursorLocation = adUseClient
rsTroj.CursorType = adOpenDynamic
rsTroj.Open "SELECT DISTINCT fldID,fldPort, fldTrojanName FROM tblTrojanPorts WHERE fldType = 'TCP' ORDER BY fldPort, fldTrojanName", cn, adOpenDynamic, adLockReadOnly
rsPorts.CursorLocation = adUseClient
rsPorts.CursorType = adOpenDynamic
rsReg.CursorLocation = adUseClient
rsReg.CursorType = adOpenDynamic
rsReg.Open "SELECT DISTINCT fldID, fldPort, fldRegisterName FROM tblRegisteredPorts WHERE fldType = 'TCP' ORDER BY fldPort, fldRegisterName", cn, adOpenDynamic, adLockReadOnly
With Me.tvwScans.Nodes
.Clear
.Add , , "H", "Open Hosts"
.Add , , "R", "Possible Registed Ports"
.Add , , "T", "Possible Trojans/Backdoors"
End With
chkJustMyComputer_Click
End Sub
Private Sub ScanPorts()
Dim strSub As String
Dim lngHex As Long
Dim lngStartTime As Long
Dim lngPort As Long
Dim lstItems As ListItems
Dim strKey As String
Dim lngTime As Long
Dim lngPortCount As Long
Dim lngPortMax As Long
Dim lngWinSocks As Long
Dim lngStartHex As Long
Dim lngEndHex As Long
Dim lngStartPort As Long
Dim lngEndPort As Long
Dim rs As ADODB.Recordset
If blRefreshing Then Exit Sub
strSub = Left(Me.txtStartIP, InStrRev(Me.txtStartIP, "."))
lngStartHex = Val(Mid(Me.txtStartIP, Len(strSub) + 1))
lngEndHex = Val(Mid(Me.txtEndIP, Len(strSub) + 1))
lngStartPort = Val(Me.txtFromPort.Text)
lngEndPort = Val(Me.txtToPort.Text)
If lngStartHex > lngEndHex Then Exit Sub
blRefreshing = True
Me.Frame1(0).Enabled = False
Me.Frame1(1).Enabled = False
Me.framePortsToScan.Enabled = False
Progbar True
Me.cmdScan.Caption = "Halt"
lngWinSocks = Val(Me.txtWinsocks)
Me.MousePointer = vbArrowHourglass
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -