我们如何在任何浏览器中捕获客户端计算机的mac和IP地址 [英] How can we capture the mac and IP address of client machine in any browser

查看:232
本文介绍了我们如何在任何浏览器中捕获客户端计算机的mac和IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我如何从任何浏览器从客户端机器捕获MAC和IP地址。为了安全目的我想在程序中实现完全基于Web应用程序



我尝试过的事情:



我试过但没做过。

Please Help me how can we capture the MAC and IP Address from Client Machine from Any Browser.For Security Purpose i want to implement in the Program which is totally based on Web Application

What I have tried:

I Tried but not done .

 <script type="text/javascript">
        var macAddress = "";
        var ipAddress = "";
        var computerName = "";
        var wmi = GetObject("webmgmt:{impersonationLevel=impersonate}");
        e = new Enumerator(wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"));
        for (; !e.atEnd() ; e.moveNext()) {
            var s = e.item();
            macAddress = s.MACAddress;
            ipAddress = s.IPAddress(0);
            computerName = s.DNSHostName;
        }
</script>

推荐答案

简单的答案是,你不能。如果你能做到这一点,那将是一个重大的安全漏洞。您正在使用的语法依赖于启用ActiveX脚本,幸运的是,大多数浏览器都不支持,即使他们这样做,如果您在公司环境中运行它,本地安全策略可能会禁用它们。
Simple answer is, you can't. It would be a major security hole if you could do that. The syntax you are using relies on ActiveX scripting being enabled which, fortunately, most browsers don't support and, even if they did, local security policies would probably disable them if you were running this in a corporate environment.


你不能。 MAC地址不会通过路由器(并且无论如何都不是唯一的,它们必须在本地段上足够独特才能设置IP地址)。



客户端的IP地址也完全无用 - 如果你能得到它,你不能 - 它几乎肯定会包含192.168.xxx.yyy,它是该段的本地IP地址,通常会更改每个你的电脑开启的时间。这些也没有通过路由器传输。



访问它们的唯一方法是通过ActiveX控件,大多数浏览器默认禁用它,因为它们是一个巨大的安全漏洞并且已经做了大约十年。



所以即使你能得到它们 - 实际上你也做不到 - 它们就像任何形式的安全一样无用为您的应用程序...
You can't. MAC addresses do not go past the router (and aren't unique anyway, they just have to be unique enough on a local segment to get an IP address set up).

The IP address of the client is also completely useless - if you could get it, which you can't - it would almost certainly consist of "192.168.xxx.yyy" which are local IP addresses for that segment and normally change each time your PC is turned on. These are also not transferred past the router.

The only way to access them is via an ActiveX control, which most browsers disable by default because they are a massive security hole, and have done for about a decade.

So even if you could get them - which in practice you can't - they would be useless as any form of security for your app...


这篇关于我们如何在任何浏览器中捕获客户端计算机的mac和IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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