扫描常用端口
01
ip="127.0.0.1"
02
port="21,23,80,3306,1433,3389,43958"
03
arrport=Split(port,",")
04
For i=0 To Ubound(arrport)
05
If Isnumeric(arrport(i)) Then
06
Call Scan(ip, arrport(i))
07
end if
08
next
09
Sub Scan(scanip,theport)
10
on error resume next
11
set conn=server.createobject("Adodb.connection")
12
connstr="Provider=SQLOLEDB.1;Data Source="&scanip&","&theport&";User ID=yezi;Password=;"
13
conn.ConnectionTimeout=1
14
conn.open connstr
15
If Err Then
16
If Err.number=-2147217843 or Err.number=-2147467259 Then
17
If InStr(Err.description, "(Connect()).") > 0 Then
18
response.write scanip&":"&theport&":close"&chr(13)&chr(10)
19
Else
20
response.write scanip&":"&theport&":open."&chr(13)&chr(10)
21
End If
22
End If
23
End If
24
end sub
读取终端端口
1
set ws=createobject("wscript.shell")
2
port=ws.regread("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber")
3
response.write "Terminal port is "& port
浙公网安备 33010602011771号