Internet Explorer 抓取内部IP地址 [英] Internet explorer grab internal ip address

查看:34
本文介绍了Internet Explorer 抓取内部IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在 IE 中获取人们内部 IP 地址的解决方案(不使用 java 或 java 小程序).Java 中的等效项如下所示:

I'm looking for a solution to grab people's internal ip addresses in IE (not using java or java applets). The equivalent in Java looks like that:

this.sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
this.sock.connect(new java.net.InetSocketAddress(document.domain, (!document.location.port)?80:document.location.port));
return this.sock.getLocalAddress().getHostAddress();

这在 vbscript 或 jscript 中是可能的吗?你能给我举个例子吗?

Is that something possible in vbscript or jscript? Could you provide me with an example?

感谢您的时间.

推荐答案

我认为根据 IE 中的安全设置,您或许可以使用 WMI.如果是这样,您可以使用 Win32_NetworkAdapterConfiguration 和它是 IPAddress 属性.

I think that depending on the security settings in IE you might be able to use WMI. If so you could just use the Win32_NetworkAdapterConfiguration and it's IPAddress property.

vbscript 中的以下示例:

The following sample in vbscript:

strComputer = "."
Set objWMIService = GetObject( _ 
    "winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
    ("Select IPAddress from Win32_NetworkAdapterConfiguration ")

For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then 
        For i=LBound(IPConfig.IPAddress) _
            to UBound(IPConfig.IPAddress)
                WScript.Echo IPConfig.IPAddress(i)
        Next
    End If
Next

取自 this MSDN 页面.

Is taken from this MSDN page.

这篇关于Internet Explorer 抓取内部IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆