用vbs实现虚拟主机和域名查循的脚本
程序员文章站
2022-04-29 09:18:08
if wscript.arguments.count <> 1 then wscript.echo "exam...
if wscript.arguments.count <> 1 then
wscript.echo "example: cscript " & wscript.scriptname & " www.sohu.com"
wscript.quit
end if
url="http://www.seologs.com/ip-domains.html?domainname="&wscript.arguments(0)
set oxmlhttprequest = createobject("msxml2.xmlhttp")
oxmlhttprequest.open "get", url, false, false
oxmlhttprequest.send
str=oxmlhttprequest.responsetext
ipos=instr(str,"<font face="&chr(34)&"arial"&chr(34)&">")
ipend=instr(str,"<!---end loop--->")
str=mid(str,ipos+19,ipend-ipos-139)
str=replace(str,"<b>","")
str=replace(str,"</b>","")
str=replace(str,"<small>","")
str=replace(str,"</small>","")
str=replace(str,"</font><font face="&chr(34)&"arial"&chr(34)&" size="&chr(34)&"-1"&chr(34)&">","")
str=replace(str,"found"," found")
iposa=instr(str,"with")
iposb=instr(str,"1)")
stra=mid(str,iposa,iposb-iposa)
str=replace(str,stra,"lcx")
str=replace(str,"lcx1)","<br>1)")
'wscript.echo str
set oxmlhttprequest=nothing
set objexplorer = wscript.createobject("internetexplorer.application")
objexplorer.navigate "about:blank"
objexplorer.toolbar = 0
objexplorer.statusbar = 0
objexplorer.visible = 1
objexplorer.height=600
objexplorer.width=500
objexplorer.left=400
objexplorer.resizable=0
objexplorer.document.body.innerhtml = str
objexplorer.document.parentwindow.clipboarddata.setdata "text", str
set objexplorer=nothing
========================正则:
msg="请输入你要查询的ip或域名:"
ip=inputbox(msg,"域名查询","www.haiyangtop.net")
if ip = "" then ip = "www.haiyangtop.net"
url = "http://www.seologs.com/ip-domains.html?domainname="& ip &""
body = gethttppage(url)
set re = new regexp
re.pattern = "(<font face=""arial"">[\s\s]+</font> </td></tr></table>)"
set matches = re.execute(body)
if matches.count>0 then body = matches(0).value
set oxmlhttprequest=nothing
set objexplorer = wscript.createobject("internetexplorer.application")
objexplorer.navigate "about:blank"
objexplorer.toolbar = 0
objexplorer.statusbar = 0
objexplorer.visible = 1
objexplorer.height=300
objexplorer.width=400
objexplorer.left=400
objexplorer.resizable=0
objexplorer.document.body.innerhtml =ip & body
'objexplorer.document.parentwindow.clipboarddata.setdata "text", ip & body
set objexplorer=nothing
'函数区
function gethttppage(path)
t = getbody(path)
gethttppage = bytestobstr(t, "gb2312")
end function
function getbody(url)
on error resume next
set retrieval = createobject("microsoft.xmlhttp")
with retrieval
.open "get", url, false, "", ""
.send
getbody = .responsebody
end with
set retrieval = nothing
end function
function bytestobstr(body, cset)
dim objstream
set objstream = createobject("adodb.stream")
objstream.type = 1
objstream.mode = 3
objstream.open
objstream.write body
objstream.position = 0
objstream.type = 2
objstream.charset = cset
bytestobstr = objstream.readtext
objstream.close
set objstream = nothing
end function
wscript.echo "example: cscript " & wscript.scriptname & " www.sohu.com"
wscript.quit
end if
url="http://www.seologs.com/ip-domains.html?domainname="&wscript.arguments(0)
set oxmlhttprequest = createobject("msxml2.xmlhttp")
oxmlhttprequest.open "get", url, false, false
oxmlhttprequest.send
str=oxmlhttprequest.responsetext
ipos=instr(str,"<font face="&chr(34)&"arial"&chr(34)&">")
ipend=instr(str,"<!---end loop--->")
str=mid(str,ipos+19,ipend-ipos-139)
str=replace(str,"<b>","")
str=replace(str,"</b>","")
str=replace(str,"<small>","")
str=replace(str,"</small>","")
str=replace(str,"</font><font face="&chr(34)&"arial"&chr(34)&" size="&chr(34)&"-1"&chr(34)&">","")
str=replace(str,"found"," found")
iposa=instr(str,"with")
iposb=instr(str,"1)")
stra=mid(str,iposa,iposb-iposa)
str=replace(str,stra,"lcx")
str=replace(str,"lcx1)","<br>1)")
'wscript.echo str
set oxmlhttprequest=nothing
set objexplorer = wscript.createobject("internetexplorer.application")
objexplorer.navigate "about:blank"
objexplorer.toolbar = 0
objexplorer.statusbar = 0
objexplorer.visible = 1
objexplorer.height=600
objexplorer.width=500
objexplorer.left=400
objexplorer.resizable=0
objexplorer.document.body.innerhtml = str
objexplorer.document.parentwindow.clipboarddata.setdata "text", str
set objexplorer=nothing
========================正则:
msg="请输入你要查询的ip或域名:"
ip=inputbox(msg,"域名查询","www.haiyangtop.net")
if ip = "" then ip = "www.haiyangtop.net"
url = "http://www.seologs.com/ip-domains.html?domainname="& ip &""
body = gethttppage(url)
set re = new regexp
re.pattern = "(<font face=""arial"">[\s\s]+</font> </td></tr></table>)"
set matches = re.execute(body)
if matches.count>0 then body = matches(0).value
set oxmlhttprequest=nothing
set objexplorer = wscript.createobject("internetexplorer.application")
objexplorer.navigate "about:blank"
objexplorer.toolbar = 0
objexplorer.statusbar = 0
objexplorer.visible = 1
objexplorer.height=300
objexplorer.width=400
objexplorer.left=400
objexplorer.resizable=0
objexplorer.document.body.innerhtml =ip & body
'objexplorer.document.parentwindow.clipboarddata.setdata "text", ip & body
set objexplorer=nothing
'函数区
function gethttppage(path)
t = getbody(path)
gethttppage = bytestobstr(t, "gb2312")
end function
function getbody(url)
on error resume next
set retrieval = createobject("microsoft.xmlhttp")
with retrieval
.open "get", url, false, "", ""
.send
getbody = .responsebody
end with
set retrieval = nothing
end function
function bytestobstr(body, cset)
dim objstream
set objstream = createobject("adodb.stream")
objstream.type = 1
objstream.mode = 3
objstream.open
objstream.write body
objstream.position = 0
objstream.type = 2
objstream.charset = cset
bytestobstr = objstream.readtext
objstream.close
set objstream = nothing
end function
上一篇: VBS基础编程教程 (第5篇)
下一篇: 用vbs实现zip功能的脚本