webrtc获取源代码


<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
  <h3>你的代理IP是:<div id=1></div></h3>
  <h3>你的真实IP是:<div id=2></div></h3>
  <script>
    const config = {
      iceServers: [{
           urls: "stun:stun.l.google.com:19302" // stun.voippro.com  stun.voipraider.com  这里使用谷歌,线上部署直接替换
       }]
   };
   let pc = new RTCPeerConnection(config);
   
   pc.onicecandidate = function(event) {
     if(event.candidate)
       handleCandidate(event.candidate.candidate);
   }
   
   function handleCandidate(candidate) { 
     if (candidate.indexOf("srflx") != -1) {
       console.log(candidate)
       var regex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/
       var ip_addr = regex.exec(candidate)[0];
           //alert("Your public network ip: "+ ip_addr)
           document.getElementById('2').innerHTML = ip_addr;
           var xhr = new XMLHttpRequest();
           xhr.onload = function () {
             document.getElementById("demo").innerHTML=xhr.responseText;
           }
           xhr.onerror = function () {
             document.getElementById("demo").innerHTML="请求出错";
           }
           xhr.open("GET", "a.php?rip="+ip_addr, true);
           xhr.send();
       }  
   }
   pc.createDataChannel("");
   pc.createOffer(function(result){
     pc.setLocalDescription(result);
   }, function(){});
</script>
<script src='http://pv.sohu.com/cityjson?ie=utf-8'></script>
<script>
  var ip=returnCitySN["cip"];
  document.getElementById('1').innerHTML = ip;
</script>
</body>
</html>

通过WEBRTC、STUN获取IP地址,异步加密传输到后台进行分析,具体可以干什么,举个栗子:嵌入到某个蜜罐页面,通过收集到的IP指纹判断是否为同一个攻击者。

免费可用的stun服务器:

stun.minisipserver.com 
stun.zoiper.com
stun.voipbuster.com  
stun.sipgate.net  
stun.schlund.de
stun.voipstunt.com
stun.1und1.de
stun.gmx.net
stun.callwithus.com
stun.internetcalls.com
stun.voip.aebc.com
stun.internetcalls.com
stun.callwithus.com
stun.gmx.net
stun.1und1.de
stun.voxgratia.org

声明:GhostKylin‘S BLOG|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - webrtc获取源代码


你好!世界!XladminShell箱子仅供个人学习使用务必遵守《网络安全法》