Through the JS to get your real external network IP and intranet IP, even if the agent is not used, think it is too scary, but also can be happy to install force!
Code:
Get the IP addresses associated with a account
function Getips (callback) {
var ip_dups = {};
Compatibility for Firefox and Chrome
var rtcpeerconnection = window. Rtcpeerconnection
|| Window.mozrtcpeerconnection
|| Window.webkitrtcpeerconnection;
Bypass naive WEBRTC blocking
if (! Rtcpeerconnection) {
var iframe = document.createelement (' iframe ');
Invalidate content Script
Iframe.sandbox = ' Allow-same-origin ';
Iframe.style.display = ' None ';
Document.body.appendChild (IFRAME);
var win = Iframe.contentwindow;
Window. Rtcpeerconnection = win. Rtcpeerconnection;
Window.mozrtcpeerconnection = win.mozrtcpeerconnection;
Window.webkitrtcpeerconnection = win.webkitrtcpeerconnection;
rtcpeerconnection = window. Rtcpeerconnection
|| Window.mozrtcpeerconnection
|| Window.webkitrtcpeerconnection;
}
Minimal requirements for data connection
var mediaconstraints = {
Optional: [{rtpdatachannels:true}]
};
Firefox already have a default stun server in About:config
Media.peerconnection.default_iceservers =
[{"url": "Stun:stun.services.mozilla.com"}]
var servers = undefined;
Add same stun server for Chrome
if (window.webkitrtcpeerconnection)
Servers = {iceservers: [{urls: ' stun:stun.services.mozilla.com '}]};
Construct a new rtcpeerconnection
var pc = new Rtcpeerconnection (servers, mediaconstraints);
Listen for candidate events
Pc.onicecandidate = function (ICE) {
Skip Non-candidate Events
if (ice.candidate) {
Match just the IP address
var Ip_regex =/([0-9]{1,3} (\.[ 0-9]{1,3}) {3})/
var ip_addr = ip_regex.exec (Ice.candidate.candidate) [1];
Remove Duplicates
if (ip_dups[ip_addr] = = = undefined)
Callback (IP_ADDR);
IP_DUPS[IP_ADDR] = true;
}
};
Create a bogus data channel
Pc.createdatachannel ("");
Create an offer SDP
Pc.createoffer (function (result) {
Trigger the STUN server request
Pc.setlocaldescription (result, function () {}, function () {});
}, function () {});
}
Test:print the IP addresses into the console
Getips (function (IP) {console.log (IP);});
Because Firefox and Chrome support WEBRTC, can request to the stun server, return the internal and external network IP, different from XMLHttpRequest request, stun Request Developer tool not see the network request.
Solutions
So do we have a way to keep pretending? The answer is yes. We can close the WEBRTC.
Chrome
Installing the plugin https://chrome.google.com/webstore/detail/webrtc-block/nphkkbaidamjmhfanlpblblcadhfbkdm?hl=en
Can't download must be your online posture is unscientific.
Firefox
Disabled with media.peerconnection.enabled.
How to obtain an IP address via JS