亲宝软件园·资讯

展开

vbs 探测端口 用vbs来探测端口的代码 不用注册winsock

人气:0
想了解用vbs来探测端口的代码 不用注册winsock的相关内容吗,在本文为您仔细讲解vbs 探测端口的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:vbs,探测端口,下面大家一起来学习吧。
复制代码 代码如下:

On Error Resume Next
if (lcase(right(wscript.fullname,11))="wscript.exe") then
wscript.echo "Execute it under the cmd.exe Plz! Thx."
wscript.quit
end If

if Wscript.Arguments.count=0 Then
usage()
wscript.quit
End If

Set Arg=Wscript.Arguments
Sport= Split(arg(1),",")
For i=0 To UBound(Split(arg(1),","))
wsh.echo "scan "&Sport(i)&" ing……"
Set x=CreateObject("msxml2.serverXMLHTTP")
x.open "post","http://"&arg(0)&":"&Sport(i)
x.send("hello")
wsh.echo Space(3)&"error.NuMbEr:"& ERr.NuMbEr & Space(5)&"ERr.Description:"&ERr.Description
if ERr.NuMbEr=0 Or ERr.NuMbEr=-2147012866 Or ERr.NuMbEr=-2147012894 Or ERr.NuMbEr=-2147012744 Or ERr.NuMbEr=-2147467259 Then
wsh.echo Space(3)&" The "&Sport(i)&" port is OPEN"
End if
next

function usage()
wscript.echo "| 注意查看ERr.Description来判断端口开放,自动探测不一定准确 |"
wscript.echo "| |"
wscript.echo "|Useage: |"
wscript.echo "| cscript.exe this.vbs ip port |"
wscript.echo "|ex: |"
wscript.echo "| cscript.exe this.vbs ip 80 or 80,123,445…… |"
wscript.echo "+-------------------------------------------------------------------+"&chr(10)
end function

加载全部内容

相关教程
猜你喜欢
用户评论