By:nowake

    中国菜刀的两个小插件(asp),扫描常用端口,读取终端端口(3389、Mstsc)。

Asp 扫描常用端口

扫描常用端口:

ip="127.0.0.1"
port="21,23,80,3306,1433,3389,43958"
arrport=Split(port,",")

For i=0 To Ubound(arrport)
    If Isnumeric(arrport(i)) Then
        Call Scan(ip, arrport(i))
    end if
next

Sub Scan(scanip,theport)
    on error resume next
    set conn=server.createobject("Adodb.connection")
    connstr="Provider=SQLOLEDB.1;Data Source=" & scanip & "," & theport & ";User ID=yezi;Password=;"
    conn.ConnectionTimeout=1
    conn.open connstr
    If Err Then
        If Err.number=-2147217843 or Err.number=-2147467259 Then
            If InStr(Err.description, "(Connect()).") > 0 Then
                response.write scanip & ":" & theport & ":close" & chr(13) & chr(10)
            Else
                response.write scanip & ":" & theport & ":open." & chr(13) & chr(10)
            End If
        End If
    End If
end sub

Asp 读取终端端口(3389、Mstsc)

读取终端端口:

set ws=createobject("wscript.shell")
port=ws.regread("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber")
response.write "Terminal port is "& port