利用vb写的扫描本机开放端口的小程序.
2007-09-16 18:49
274 查看
利用vb写的扫描本机开放端口的小程序.
4个text 两个按钮.和一个Winsock1控件
Dim portnum As Long
Dim start As String
Sub scanningports()
Dim porttwo As Long
portnum = Text1.Text
porttwo = Text2.Text
Command2.Enabled = True
On Error GoTo viriio
Do
portnum = portnum + 1
DoEvents
If start = True Then
Winsock1.Close
DoEvents
Winsock1.LocalPort = portnum
DoEvents
Text3.Text = portnum
Winsock1.Listen
DoEvents
Else
portnum = 0
Command1.Enabled = True
Text1.Locked = False
Text2.Locked = False
Exit Sub
End If
Winsock1.Close
DoEvents
Loop Until portnum >= porttwo
portnum = 0
Command1.Enabled = True
logport.Text = logport.Text & vbCrLf & "Scanning Ports Done!" & vbCrLf
Text1.Locked = False
Text2.Locked = False
viriio:
If Err.Number = 10048 Then
logport.Text = logport.Text & vbCrLf & "端口" & Winsock1.LocalPort & " 开启中"
Resume Next
End If
End Sub
Private Sub Command1_Click()
Command2.Enabled = True
If Text1.Text = "" Then
MsgBox "你必须指定开始端口号!"
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "你必须指定一个结束端口号"
Exit Sub
End If
Text1.Locked = True
Text2.Locked = True
Command1.Enabled = False
Winsock1.Close
start = True
Call scanningports
logport.Text = logport.Text & vbCrLf & "端口" & Text1.Text & "- " & Text3.Text & " 已经成功扫描!"
End Sub
Private Sub Command2_Click()
Command2.Enabled = False
start = False
End Sub
4个text 两个按钮.和一个Winsock1控件
Dim portnum As Long
Dim start As String
Sub scanningports()
Dim porttwo As Long
portnum = Text1.Text
porttwo = Text2.Text
Command2.Enabled = True
On Error GoTo viriio
Do
portnum = portnum + 1
DoEvents
If start = True Then
Winsock1.Close
DoEvents
Winsock1.LocalPort = portnum
DoEvents
Text3.Text = portnum
Winsock1.Listen
DoEvents
Else
portnum = 0
Command1.Enabled = True
Text1.Locked = False
Text2.Locked = False
Exit Sub
End If
Winsock1.Close
DoEvents
Loop Until portnum >= porttwo
portnum = 0
Command1.Enabled = True
logport.Text = logport.Text & vbCrLf & "Scanning Ports Done!" & vbCrLf
Text1.Locked = False
Text2.Locked = False
viriio:
If Err.Number = 10048 Then
logport.Text = logport.Text & vbCrLf & "端口" & Winsock1.LocalPort & " 开启中"
Resume Next
End If
End Sub
Private Sub Command1_Click()
Command2.Enabled = True
If Text1.Text = "" Then
MsgBox "你必须指定开始端口号!"
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "你必须指定一个结束端口号"
Exit Sub
End If
Text1.Locked = True
Text2.Locked = True
Command1.Enabled = False
Winsock1.Close
start = True
Call scanningports
logport.Text = logport.Text & vbCrLf & "端口" & Text1.Text & "- " & Text3.Text & " 已经成功扫描!"
End Sub
Private Sub Command2_Click()
Command2.Enabled = False
start = False
End Sub
相关文章推荐
- 一个简单的端口扫描程序
- 利用命令查看端口及对应程序
- 端口扫描程序nmap使用手册
- 扫描服务器开放了哪些端口
- 利用中断16H,显示按下的某个键的扫描码和ASCII码(以十六进制形式),以及这个字符(如果存在可显示的形式),直到按下ESC键后程序退出。(别人的作业,我帮着做的)
- 端口扫描程序NMAP使用手册
- 今天是国庆节,顺便写了个端口扫描程序
- 一个用来扫描主机端口的AIR 程序 (在Flex 4+AIR 2.0/Beta 2 下实现)
- Python端口扫描简单程序
- .NET 异常捕获机制的小技巧应用(实例:端口扫描程序)
- 利用VB开发SAP接口程序初探
- 今天把以前的端口扫描程序改了下,主要是易用性和界面部分
- 易速端口扫描程序
- Python端口扫描程序原理解析
- 利用DOS命令扫描网段的端口
- C#编写的多线程端口扫描程序
- Linux下端口扫描程序nmap介绍
- CentOS7查询端口占用,清除端口占用的程序,开放端口,打开防火墙
- 利用扫描工具和冰河木马程序做一次小实验
- 端口扫描程序nmap使用手册 zz