绕过代理获取访客真实IP| →『网络安全区』
Firefox 跟 Chrome支持WebRTC可以向STUN服务器请求,返回内外网IP,不同于XMLHttpRequest请求,STUN请求开发者工具当中看不到网络请求的。//get the IP addresses associated with an account
function getIPs(callback){
var ip_dups = {};
//compatibility for firefox and chrome
var RTCPeerConnection = window.RTCPeerConnection
|| window.mozRTCPeerConnection
|| window.webkitRTCPeerConnection;
var mediaConstraints = {
optional: [{RtpDataChannels: true}]
};
//firefox already has 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 = /({1,3}(\.{1,3}){3})/
var ip_addr = ip_regex.exec(ice.candidate.candidate);
//remove duplicates
if(ip_dups === undefined)
callback(ip_addr);
ip_dups = 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(){});
}
//Test: Print the IP addresses into the console
getIPs(function(ip){console.log(ip);}); 真的 好久都没有这么笑了~ 好开心哦 你这样的表现,就只配这几个字:窝囊废 激动了就不好办了.. 我起来了 哈哈 刚才迷了会 我不知道他说的是什么啊~~ 今天统计好像出了问题 机会就像水中的鱼,耐心等待就能上钩。 回来了 呵呵刚才在斗地主那 ~~~~ 你可是难得来坐坐啊~~~ 朕在自己的寝宫~~~~ 感觉楼主说的很不错,我也很赞同 如本人留言违反国家有关法律,请网络管理员及时删除本人跟贴。本回贴不暗示、鼓励、支持或映射读者作出生活方式、工作态度、婚姻交友、子女教育的积极或消极判断。 估计你是没见识过~` 呵呵 你可是难得来坐坐啊~~~
页:
[1]
2