浏览器唯一标识

微信提供的浏览器指纹:fbaa833f9f71edf80f23d205b75e1f2c

通过canvas生成指纹:1681af93

微信的,修改部分UA即可伪造指纹

<script src="https://wx.gtimg.com/wxpay_h5/fingerprint2.min.1.5.1.js"></script>
<script>
var fp=new Fingerprint2();
fp.get(function(result){
    //result即为获取到的浏览器指纹值
    document.getElementById("wxb").innerHTML=result;
 });
</script>

canvas,太短,在大量数据下出现重复

<script>
function bin2hex(s) {
  var i,l,o='',n;
  s += '';
  for (i = 0, l = s.length; i < l; i++) {
    n = s.charCodeAt(i).toString(16);
    o += n.length<2?'0'+n:n;
  }
  return o;
}
function getUUID(domain) {
    var canvas = document.createElement('canvas');
    var ctx = canvas.getContext("2d");
    var txt = domain;
    ctx.textBaseline = "top";
    ctx.font = "14px 'Arial'";
    ctx.textBaseline = "tencent";
    ctx.fillStyle = "#f60";
    ctx.fillRect(125,1,62,20);
    ctx.fillStyle = "#069";
    ctx.fillText(txt, 2, 15);
    ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
    ctx.fillText(txt, 4, 17);
    var b64 = canvas.toDataURL().replace("data:image/png;base64,","");
    var bin = atob(b64);
    var crc = bin2hex(bin.slice(-16,-12));
    return crc;
}
</script>

完整示例:

<meta charset="utf-8">
<title>浏览器唯一标识</title>
<script src="https://wx.gtimg.com/wxpay_h5/fingerprint2.min.1.5.1.js"></script>
<script>
var fp=new Fingerprint2();

fp.get(function(result){

    //result即为获取到的浏览器指纹值
    //document.write("浏览器指纹:"+result+ca);
    document.getElementById("wxb").innerHTML=result;
    document.getElementById("cab").innerHTML=getUUID("https://www.unique-liu.com/");
 });
</script>
<script>
function bin2hex(s) {
  var i,l,o='',n;
  s += '';
  for (i = 0, l = s.length; i < l; i++) {
    n = s.charCodeAt(i).toString(16);
    o += n.length<2?'0'+n:n;
  }
  return o;
}

function getUUID(domain) {
    var canvas = document.createElement('canvas');
    var ctx = canvas.getContext("2d");
    var txt = domain;
    ctx.textBaseline = "top";
    ctx.font = "14px 'Arial'";
    ctx.textBaseline = "tencent";
    ctx.fillStyle = "#f60";
    ctx.fillRect(125,1,62,20);
    ctx.fillStyle = "#069";
    ctx.fillText(txt, 2, 15);
    ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
    ctx.fillText(txt, 4, 17);

    var b64 = canvas.toDataURL().replace("data:image/png;base64,","");
    var bin = atob(b64);
    var crc = bin2hex(bin.slice(-16,-12));
    return crc;
}

</script>

<p>微信提供的浏览器指纹:<span id="wxb"></span></p>
<p>通过canvas生成指纹:<span id="cab"></span></p>
<br /><br />
微信的,修改部分UA即可伪造指纹
<br /><br />
canvas,太短,在大量数据下出现重复

<script>

</script>
View Code

 

posted @ 2021-01-04 16:32  笠航  阅读(1309)  评论(1编辑  收藏  举报