vbs版IP地理位置查询小偷
vbs版IP地理位置查询小偷
发布时间:2016-12-28 来源:查字典编辑
摘要:msg="请输入你要查询的IP或域名:"IP=Inputbox(msg,"IP地理位置查询小偷")IfIP=""ThenIP="127.0....

msg="请输入你要查询的IP或域名:"

IP=Inputbox(msg,"IP地理位置查询小偷")

IfIP=""ThenIP="127.0.0.1"

url="http://www.ip.cn/?q="&IP&""

Body=getHTTPPage(url)

SetRe=NewRegExp

Re.Pattern="(查询结果为:.+)"

SetMatches=Re.Execute(Body)

IfMatches.Count>0ThenBody=Matches(0)

'Re.Pattern="[[sS]*]"

'Body=Re.Replace(Body,"")

'wscript.echoIP&Body

SetoXMLHttpRequest=Nothing

SetobjExplorer=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

SetobjExplorer=nothing

'函数区

FunctiongetHTTPPage(Path)

t=GetBody(Path)

getHTTPPage=BytesToBstr(t,"UTF-8")

EndFunction

FunctionGetBody(url)

OnErrorResumeNext

SetRetrieval=CreateObject("Microsoft.XMLHTTP")

WithRetrieval

.Open"Get",url,False,"",""

.Send

GetBody=.ResponseBody

EndWith

SetRetrieval=Nothing

EndFunction

FunctionBytesToBstr(Body,Cset)

Dimobjstream

Setobjstream=CreateObject("adodb.stream")

objstream.Type=1

objstream.Mode=3

objstream.Open

objstream.WriteBody

objstream.Position=0

objstream.Type=2

objstream.Charset=Cset

BytesToBstr=objstream.ReadText

objstream.Close

Setobjstream=Nothing

EndFunction

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新vbs学习
热门vbs学习
脚本专栏子分类