Internet Explorer 抓取内部IP地址

编程入门 行业动态 更新时间:2024-10-28 06:22:07
本文介绍了Internet Explorer 抓取内部IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在寻找一种在 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.InetSocketAddress('0.0.0.0', 0));
this.sock.connect(new java.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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-28 00:19:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1164459.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地址   Internet   Explorer   IP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!