欢迎来到 黑吧安全网聚焦网络安全前沿资讯,精华内容,交流技术心得!

VB打造端口扫描器

  • 软件大小:2.40 MB
  • 软件语言:简体中文
  • 软件类型:综合教程
  • 软件授权:免费教程
  • 更新时间:2006-10-29
  • 标签:
  • 开 发 商:http://www.myhack58.com
  • 应用平台:WinXP, Win7, Win8, WinAll
软件评分
网友评分:3

同类人气软件

立即下载

VB打造端口扫描器软件介绍

----------------------------------------------------------
           黑客动画吧 http://www.hack58.com

           致力于中国最专业的黑客安全站点

           黑客动画吧,有你更精彩
-----------------------------------------------------------

大家好,我是傻小子,今天给大家讲一下 如果用VB做一个端口扫描软件

txtIp

txtPort1

txtPort2

txtResult


首先打开VB的编辑画面,加入扫描软件的主角winsock控件

(加入步骤:点“工程”->“部件”找到并选中“Microsoft Winsock Control 6.0”,然后在左侧的工具箱内即可见到它的小图标)

在界面上添加两个文本框,一个用于输入想扫描的IP,另一个用于输入想扫描的端口范围;添加一个按钮用于控制何时开始扫描,

添加一个winsock控件,添加的方法:双击欲使用的控件即可,注意设置winsock控件时在index处需要加一个0,这是因为同时启动多个

winsock控件的实例,第一系数为0

然后简单设置一下,节约时间我已经做好了,以下为代码部分:
--------------------------------------------------------
'代码如下,看不懂的也可以联系我

Public Ip
Public Port1
Public Port2

Private Sub Command1_Click()
    Dim iport
    If ChkIp And ChkPort Then
        For iport = Port1 To Port2
            Load Winsock1(iport)
            If Winsock1(iport).State <> sckClosed Then Winsock1(iport + 1).Close
            Winsock1(iport).Connect Ip, iport
            txtResult = txtResult & "Scan:" & iport & ":" & _
            Winsock1.Count & " > " & Winsock1(iport).State & vbNewLine
        Next iport
    End If
End Sub


Private Sub Winsock1_Connect(Index As Integer)
    txtResult = txtResult & "Remote Port " & Winsock1(Index).RemotePort & " is open" & vbNewLine
    Winsock1(Index).SendData "Quit"
    Winsock1(Index).Close
    Destroy Winsock1(Index)
End Sub

Private Sub Winsock1_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    Destroy Winsock1(Index)
End Sub
Sub Destroy(obj As Object)
    Unload obj
    TimeOut 1
End Sub

Private Function ChkIp() As Boolean
    ChkIp = False
    If Trim(txtIP) = "" Then
        Msgbox2 "Ip can not be Null!"
        Exit Function
    Else
        Ip = Trim(txtIP)
    End If
    ChkIp = True
End Function

Private Function ChkPort() As Boolean
    On Error GoTo ErrHandle
    ChkPort = False
    If Trim(txtPort1) = "" Or Trim(txtPort2) = "" Then
        Msgbox2 "The Port area can not be Null!"
        Exit Function
    Else
        Port1 = CLng(txtPort1)
        Port2 = CLng(txtPort2)
    End If
    ChkPort = True
    Exit Function
ErrHandle:
    Msgbox2 Err.Description
    Err.Clear
End Function

Sub Msgbox2(msg)
    MsgBox msg, vbOKOnly, "Alert!"
End Sub

Public Sub TimeOut(Duration As Double)
    ' standard timeout sub, causes a short pause in the code
    Dim StartTime As Double, x As Integer
    StartTime = Timer
    Do While Timer - StartTime < Duration
        x = DoEvents()
    Loop
End Sub

  • 热门下载