当前位置: 移动技术网 > IT编程>脚本编程>VBScript > 用vbs来探测端口的代码 不用注册winsock

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

2017年12月08日  | 移动技术网IT编程  | 我要评论

王海相声,办理建筑资质,复婚手续

复制代码 代码如下:

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网