vbs版IP地理位置查询小偷
程序员文章站
2022-04-29 09:18:14
msg="请输入你要查询的ip或域名:" ip=inputbox(msg,"ip地理位置查询小偷") if ip = ""&nbs...
msg="请输入你要查询的ip或域名:"
ip=inputbox(msg,"ip地理位置查询小偷")
if ip = "" then ip = "127.0.0.1"
url = "http://www.ip.cn/?q="& ip &""
body = gethttppage(url)
set re = new regexp
re.pattern = "(查询结果为:.+)"
set matches = re.execute(body)
if matches.count>0 then body = matches(0)
're.pattern = "\[[\s\s]*\]"
'body = re.replace(body, "")
'wscript.echo ip & body
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, "utf-8")
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
ip=inputbox(msg,"ip地理位置查询小偷")
if ip = "" then ip = "127.0.0.1"
url = "http://www.ip.cn/?q="& ip &""
body = gethttppage(url)
set re = new regexp
re.pattern = "(查询结果为:.+)"
set matches = re.execute(body)
if matches.count>0 then body = matches(0)
're.pattern = "\[[\s\s]*\]"
'body = re.replace(body, "")
'wscript.echo ip & body
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, "utf-8")
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
下一篇: 一个查看局域网在线IP的vbs脚本