星空软件

 找回密码
 立即注册

队长模块谷歌浏览器JS注入实现指纹修改,分辨率、cpu数量,画布指纹

ibytijihi | 2024-2-26 23:44:58 | 显示全部楼层 |阅读模式

// 定义20种常用的分辨率组合
const resolutions = [
  { width: 1024, height: 768 },
  { width: 1280, height: 720 },
  { width: 1280, height: 800 },
  { width: 1366, height: 768 },
  { width: 1440, height: 900 },
  { width: 1536, height: 864 },
  { width: 1600, height: 900 },
  { width: 1680, height: 1050 },
  { width: 1920, height: 1080 },
  { width: 1920, height: 1200 },
  { width: 2560, height: 1440 },
  { width: 2560, height: 1600 },
  { width: 3840, height: 2160 }, // 4K
  { width: 3200, height: 1800 },
  { width: 2880, height: 1800 },
  { width: 2048, height: 1536 },
  { width: 2560, height: 1080 },
  { width: 3440, height: 1440 },
  { width: 5120, height: 2880 }, // 5K
  { width: 7680, height: 4320 }  // 8K
];

// 随机选择一个分辨率组合
const randomResolution = resolutions[Math.floor(Math.random() * resolutions.length)];

// 使用Object.defineProperty来伪装screen.width和screen.height
Object.defineProperty(screen, 'width', { value: randomResolution.width, writable: false });
Object.defineProperty(screen, 'height', { value: randomResolution.height, writable: false });

console.log(screen.width); // 输出:随机选择的宽度值
console.log(screen.height); // 输出:随机选择的高度值

// 生成4到32之间的随机值,且为2的倍数
const fakeCPUCores = Math.round((Math.random() * (16 - 2) + 2)) * 2;

// 使用Object.defineProperty来重写navigator.hardwareConcurrency
Object.defineProperty(navigator, 'hardwareConcurrency', {
  value: fakeCPUCores,
  writable: false // 将其设置为不可写,以防止后续修改
});

// 测试伪装是否成功
console.log(navigator.hardwareConcurrency); // 输出:一个在4到32之间的随机数,且为2的倍数

  const toBlob = HTMLCanvasElement.prototype.toBlob;
  const toDataURL = HTMLCanvasElement.prototype.toDataURL;

  HTMLCanvasElement.prototype.manipulate = function() {
    const {width, height} = this;
    const context = this.getContext('2d');
    const shift = {
      'r': Math.floor(Math.random() * 10) - 5,
      'g': Math.floor(Math.random() * 10) - 5,
      'b': Math.floor(Math.random() * 10) - 5
    };
    const matt = context.getImageData(0, 0, width, height);
    for (let i = 0; i < height; i += Math.max(1, parseInt(height / 10))) {
      for (let j = 0; j < width; j += Math.max(1, parseInt(width / 10))) {
        const n = ((i * (width * 4)) + (j * 4));
        matt.data[n + 0] = matt.data[n + 0] + shift.r;
        matt.data[n + 1] = matt.data[n + 1] + shift.g;
        matt.data[n + 2] = matt.data[n + 2] + shift.b;
      }
    }
    context.putImageData(matt, 0, 0);

  };

  Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {
    value: function() {

        try {
          this.manipulate();
        }
        catch(e) {
          console.warn('manipulation failed', e);
        }

      return toBlob.apply(this, arguments);
    }
  });
  Object.defineProperty(HTMLCanvasElement.prototype, 'toDataURL', {
    value: function() {

        try {
          this.manipulate();
        }
        catch(e) {
          console.warn('manipulation failed', e);
        }

      return toDataURL.apply(this, arguments);
    }
  });

这个怎么用呢,其实非常简单,在初始化的时候注入到浏览器就行了“调试输出 (标签A [1].注入_添加 (#常量2, ))”
截图202402262346369613.png




上一篇:微博超话批量发布工具,支持定时签到关注,指定评论ID批量点赞脚本
下一篇:队长谷歌填表浏览器提取cookie和置入还原cookie例子
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

全站声明【必看】|小黑屋|新库软件 |网站地图

GMT+8, 2024-4-29 17:43 , Processed in 0.065249 second(s), 29 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.