⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 一个简单的端口扫描程序: addstr = "发现端口" & Str(port) & "打开" & Space(5) Select Case port Case 7 plus = "ECHO服务"
💻 BAS
字号:
Attribute VB_Name = "Module1"
Public WckNum As Integer
Public StartPort As Integer
Public EndPort As Integer
Public RemoteIP As String
Public WCKcount As Integer
Public GoOnFlag As Boolean
Public Fengzi As Integer
Public Fengmu As Integer
Public Sub portscan(startpt As Integer, endpt As Integer, wck As Integer)
On Error Resume Next


Dim n, nowport, nextstart As Integer
portnum = endpt - startpt + 1
nextstart = nextstart + startpt
If portnum <> 0 Then
If Not GoOnFlag Then
OpenPortDlg.Show 1
FrmScaner.Command1.Enabled = True
FrmScaner.Command1.Caption = "开始"
Exit Sub
End If
If portnum <= wck And GoOnFlag Then
    
    FrmScaner.PgBar.Max = portnum
    nowport = startpt
    For n = 1 To portnum
        Load FrmScaner.Winsock(n)
        FrmScaner.Winsock(n).RemoteHost = RemoteIP
        FrmScaner.Winsock(n).RemotePort = nowport
         FrmScaner.STATUS.Text = FrmScaner.STATUS.Text + "线程" & Str(n) & "启动:连接远程端口:" & Str(nowport) & vbCrLf & vbCrLf
         FrmScaner.Winsock(n).Connect
         DoEvents
        FrmScaner.PgBar.Value = FrmScaner.PgBar.Value + 1
        Fengzi = Fengzi + 1
        FrmScaner.AllPg.Caption = Trim(Str(CInt(Fengzi / Fengmu * 100)))
        nowport = nowport + 1
    Next n
   Do While FrmScaner.Winsock(nowport - 1).State <> 7
           DoEvents
           Exit Do
   Loop
    For n = 1 To portnum
        FrmScaner.Winsock(n).Close
        Unload FrmScaner.Winsock(n)
    Next n
FrmScaner.Command1.Caption = "开始"
OpenPortDlg.Show 1
FrmScaner.PgBar.Value = 0
Call FrmScaner.paintstatus
Exit Sub
Else
If GoOnFlag Then
    nowport = startpt
    FrmScaner.PgBar.Max = wck
    For n = 1 To wck
        Load FrmScaner.Winsock(n)
        FrmScaner.Winsock(n).RemoteHost = RemoteIP
        FrmScaner.Winsock(n).RemotePort = nowport
         FrmScaner.STATUS.Text = FrmScaner.STATUS.Text + "线程" & Str(n) & "启动:连接远程端口:" & Str(nowport) & vbCrLf & vbCrLf
         FrmScaner.Winsock(n).Connect
         DoEvents
         Fengzi = Fengzi + 1
        FrmScaner.AllPg.Caption = Trim(Str(CInt(Fengzi / Fengmu * 100)))
        FrmScaner.PgBar.Value = FrmScaner.PgBar.Value + 1
        nowport = nowport + 1
    Next n
    Do While FrmScaner.Winsock(nowport - 1).State <> 7
           DoEvents
           Exit Do
   Loop
    For n = 1 To wck
        FrmScaner.Winsock(n).Close
        Unload FrmScaner.Winsock(n)
    Next n
    nextstart = nextstart + wck
    FrmScaner.PgBar.Value = 0
    portscan nextstart, EndPort, WckNum
End If

End If
End If
Exit Sub

msgboxerr:
MsgBox "有错误了!请告诉我,我会在后续版本中更新的!" & vbCrLf & "Mail:easthk@china.com", 16, "错误"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -