javascript 检测 VPN 连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29474328/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 10:35:39  来源:igfitidea点击:

Detecting VPN connection

javascriptvpn

提问by Coding active

Is it possible to check if a user is connected to a VPN and retrieve internal IP address through Javascript?

是否可以检查用户是否连接到 VPN 并通过 Javascript 检索内部 IP 地址?

回答by HassenPy

You can't check for VPN usage nor get the IP address of a user with just JavaScript on the browser.

您无法仅通过浏览器上的 JavaScript 来检查 VPN 使用情况,也无法获取用户的 IP 地址。

Your best bet would be to look for VPN IP blacklists to integrate with your server configuration, these will block most free VPNs and some paid ones but the paid ones will always keep expanding their IP address base.
One thing to add, these will cost you money, and you will restrict some users that only have access to your website via a VPN service for privacy reasons.

您最好的选择是寻找 VPN IP 黑名单以与您的服务器配置集成,这些将阻止大多数免费 VPN 和一些付费 VPN,但付费 VPN 将始终不断扩展其 IP 地址库。
要补充的一件事是,这些将花费您金钱,并且出于隐私原因,您将限制一些只能通过 VPN 服务访问您网站的用户。



The webRTC leak doesn't work on all browsers and it already have extensions to prevent it, it's just a leak and the webRTC technology itself isn't implemented on IE yet!

webRTC 泄漏并不适用于所有浏览器,它已经有扩展程序来防止它,这只是一个泄漏,而且 webRTC 技术本身还没有在 IE 上实现!

Hope this helps.

希望这可以帮助。

回答by at15

Maybe you can see this repo https://github.com/diafygi/webrtc-ips. it won't get block by browser plugins. But the user can disable webrtc

也许你可以看到这个 repo https://github.com/diafygi/webrtc-ips。它不会被浏览器插件阻止。但是用户可以禁用 webrtc

EDIT:

编辑:

From: http://thehackernews.com/2015/02/webrtc-leaks-vpn-ip-address.html

来自:http: //thehackernews.com/2015/02/webrtc-leaks-vpn-ip-address.html

HOW DOES THE WebRTC FLAW WORK
WebRTC allows requests to be made to STUN (Session Traversal Utilities for NAT) servers which return the "hidden" home IP-address as well as local network addresses for the system that is being used by the user.

The results of the requests can be accessed using JavaScript, but because they are made outside the normal XML/HTTP request procedure, they are not visible in the developer console. This means that the only requirement for this to work is WebRTC support in the browser and JavaScript.

WebRTC 缺陷如何工作
WebRTC 允许向 STUN(NAT 会话遍历实用程序)服务器发出请求,这些服务器返回用户正在使用的系统的“隐藏”家庭 IP 地址以及本地网络地址。

可以使用 JavaScript 访问请求的结果,但由于它们是在正常的 XML/HTTP 请求过程之外生成的,因此它们在开发人员控制台中是不可见的。这意味着要使其工作的唯一要求是浏览器和 JavaScript 中的 WebRTC 支持。