├── .gitignore
├── .yo-rc.json
├── README.md
├── docs
├── index.html
└── main.7166fb11c739f2dbf654.js
├── package.json
├── record.md
├── src
├── core
│ ├── audioFP.js
│ ├── canvasFP.js
│ ├── netFP.js
│ └── webglFP.js
└── index.js
├── webpack.config.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | .idea
3 | node_modules
4 | dist
5 |
--------------------------------------------------------------------------------
/.yo-rc.json:
--------------------------------------------------------------------------------
1 | {
2 | "fingerprintDemo": {
3 | "configuration": {
4 | "config": {
5 | "topScope": [
6 | "const webpack = require('webpack')",
7 | "const path = require('path')",
8 | "\n",
9 | "/*\n * SplitChunksPlugin is enabled by default and replaced\n * deprecated CommonsChunkPlugin. It automatically identifies modules which\n * should be splitted of chunk by heuristics using module duplication count and\n * module category (i. e. node_modules). And splits the chunks…\n *\n * It is safe to remove \"splitChunks\" from the generated configuration\n * and was added as an educational example.\n *\n * https://webpack.js.org/plugins/split-chunks-plugin/\n *\n */",
10 | "/*\n * We've enabled UglifyJSPlugin for you! This minifies your app\n * in order to load faster and run less javascript.\n *\n * https://github.com/webpack-contrib/uglifyjs-webpack-plugin\n *\n */",
11 | "const UglifyJSPlugin = require('uglifyjs-webpack-plugin');",
12 | "\n"
13 | ],
14 | "webpackOptions": {
15 | "module": {
16 | "rules": [
17 | {
18 | "include": [
19 | "path.resolve(__dirname, 'src')"
20 | ],
21 | "loader": "'babel-loader'",
22 | "options": {
23 | "plugins": [
24 | "'syntax-dynamic-import'"
25 | ],
26 | "presets": [
27 | [
28 | "'@babel/preset-env'",
29 | {
30 | "'modules'": false
31 | }
32 | ]
33 | ]
34 | },
35 | "test": "/\\.js$/"
36 | },
37 | {
38 | "test": "/\\.(less|css)$/",
39 | "use": [
40 | {
41 | "loader": "'css-loader'",
42 | "options": {
43 | "sourceMap": true
44 | }
45 | },
46 | {
47 | "loader": "'less-loader'",
48 | "options": {
49 | "sourceMap": true
50 | }
51 | }
52 | ]
53 | }
54 | ]
55 | },
56 | "output": {
57 | "chunkFilename": "'[name].[chunkhash].js'",
58 | "filename": "'[name].[chunkhash].js'"
59 | },
60 | "mode": "'development'",
61 | "plugins": [
62 | "new UglifyJSPlugin()"
63 | ],
64 | "optimization": {
65 | "splitChunks": {
66 | "cacheGroups": {
67 | "vendors": {
68 | "priority": -10,
69 | "test": "/[\\\\/]node_modules[\\\\/]/"
70 | }
71 | },
72 | "chunks": "'async'",
73 | "minChunks": 1,
74 | "minSize": 30000,
75 | "name": true
76 | }
77 | }
78 | },
79 | "configName": "config"
80 | }
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### 浏览器指纹Demo
2 |
3 | > 知乎文章:[浏览器属性检测那些事](https://zhuanlan.zhihu.com/p/67923680)
4 |
5 | > 在线演示地址: https://ajlovechina.github.io/fingerprintDemo/
6 |
7 | ### 你应该知道的事
8 |
9 | > Chrome一直在阻止网页技术捕获用户的指纹,这是出于对于用户隐私与安全性的考虑,所以现在可用的技术可能在未来的某个版本中就不可用了。但是浏览器指纹帮助我们了解到`原来还可以这么玩?`。而且未来Chrome也有可能授权用户给JS赋能唯一ID的能力,当然目前来看Chrome还没打算这么做。
10 |
11 | ### 源码如何本地开发
12 | ```bash
13 | npm install
14 | npm run dev
15 |
16 |
17 | # How to build ?
18 | npm run build
19 | ```
20 |
21 | ### 每个指纹算法的JS源文件
22 | [audio指纹 查看源码](./src/core/audioFP.js)
23 | [canvas指纹 查看源码](./src/core/canvasFP.js)
24 | [webgl指纹 查看源码](./src/core/webglFP.js)
25 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Development
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/main.7166fb11c739f2dbf654.js:
--------------------------------------------------------------------------------
1 | /******/ (function(modules) { // webpackBootstrap
2 | /******/ // The module cache
3 | /******/ var installedModules = {};
4 | /******/
5 | /******/ // The require function
6 | /******/ function __webpack_require__(moduleId) {
7 | /******/
8 | /******/ // Check if module is in cache
9 | /******/ if(installedModules[moduleId]) {
10 | /******/ return installedModules[moduleId].exports;
11 | /******/ }
12 | /******/ // Create a new module (and put it into the cache)
13 | /******/ var module = installedModules[moduleId] = {
14 | /******/ i: moduleId,
15 | /******/ l: false,
16 | /******/ exports: {}
17 | /******/ };
18 | /******/
19 | /******/ // Execute the module function
20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 | /******/
22 | /******/ // Flag the module as loaded
23 | /******/ module.l = true;
24 | /******/
25 | /******/ // Return the exports of the module
26 | /******/ return module.exports;
27 | /******/ }
28 | /******/
29 | /******/
30 | /******/ // expose the modules object (__webpack_modules__)
31 | /******/ __webpack_require__.m = modules;
32 | /******/
33 | /******/ // expose the module cache
34 | /******/ __webpack_require__.c = installedModules;
35 | /******/
36 | /******/ // define getter function for harmony exports
37 | /******/ __webpack_require__.d = function(exports, name, getter) {
38 | /******/ if(!__webpack_require__.o(exports, name)) {
39 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40 | /******/ }
41 | /******/ };
42 | /******/
43 | /******/ // define __esModule on exports
44 | /******/ __webpack_require__.r = function(exports) {
45 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47 | /******/ }
48 | /******/ Object.defineProperty(exports, '__esModule', { value: true });
49 | /******/ };
50 | /******/
51 | /******/ // create a fake namespace object
52 | /******/ // mode & 1: value is a module id, require it
53 | /******/ // mode & 2: merge all properties of value into the ns
54 | /******/ // mode & 4: return value when already ns object
55 | /******/ // mode & 8|1: behave like require
56 | /******/ __webpack_require__.t = function(value, mode) {
57 | /******/ if(mode & 1) value = __webpack_require__(value);
58 | /******/ if(mode & 8) return value;
59 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60 | /******/ var ns = Object.create(null);
61 | /******/ __webpack_require__.r(ns);
62 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64 | /******/ return ns;
65 | /******/ };
66 | /******/
67 | /******/ // getDefaultExport function for compatibility with non-harmony modules
68 | /******/ __webpack_require__.n = function(module) {
69 | /******/ var getter = module && module.__esModule ?
70 | /******/ function getDefault() { return module['default']; } :
71 | /******/ function getModuleExports() { return module; };
72 | /******/ __webpack_require__.d(getter, 'a', getter);
73 | /******/ return getter;
74 | /******/ };
75 | /******/
76 | /******/ // Object.prototype.hasOwnProperty.call
77 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78 | /******/
79 | /******/ // __webpack_public_path__
80 | /******/ __webpack_require__.p = "";
81 | /******/
82 | /******/
83 | /******/ // Load entry module and return exports
84 | /******/ return __webpack_require__(__webpack_require__.s = "./src/index.js");
85 | /******/ })
86 | /************************************************************************/
87 | /******/ ({
88 |
89 | /***/ "./node_modules/blueimp-md5/js/md5.js":
90 | /*!********************************************!*\
91 | !*** ./node_modules/blueimp-md5/js/md5.js ***!
92 | \********************************************/
93 | /*! no static exports found */
94 | /***/ (function(module, exports, __webpack_require__) {
95 |
96 | eval("var __WEBPACK_AMD_DEFINE_RESULT__;/*\n * JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\n\n/* global define */\n\n;(function ($) {\n 'use strict'\n\n /*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n function safeAdd (x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff)\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16)\n return (msw << 16) | (lsw & 0xffff)\n }\n\n /*\n * Bitwise rotate a 32-bit number to the left.\n */\n function bitRotateLeft (num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt))\n }\n\n /*\n * These functions implement the four basic operations the algorithm uses.\n */\n function md5cmn (q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)\n }\n function md5ff (a, b, c, d, x, s, t) {\n return md5cmn((b & c) | (~b & d), a, b, x, s, t)\n }\n function md5gg (a, b, c, d, x, s, t) {\n return md5cmn((b & d) | (c & ~d), a, b, x, s, t)\n }\n function md5hh (a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t)\n }\n function md5ii (a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t)\n }\n\n /*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n function binlMD5 (x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << (len % 32)\n x[((len + 64) >>> 9 << 4) + 14] = len\n\n var i\n var olda\n var oldb\n var oldc\n var oldd\n var a = 1732584193\n var b = -271733879\n var c = -1732584194\n var d = 271733878\n\n for (i = 0; i < x.length; i += 16) {\n olda = a\n oldb = b\n oldc = c\n oldd = d\n\n a = md5ff(a, b, c, d, x[i], 7, -680876936)\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586)\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819)\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330)\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897)\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426)\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341)\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983)\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416)\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417)\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063)\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162)\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682)\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101)\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290)\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329)\n\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510)\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632)\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713)\n b = md5gg(b, c, d, a, x[i], 20, -373897302)\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691)\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083)\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335)\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848)\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438)\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690)\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961)\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501)\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467)\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784)\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473)\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734)\n\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558)\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463)\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562)\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556)\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060)\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353)\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632)\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640)\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174)\n d = md5hh(d, a, b, c, x[i], 11, -358537222)\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979)\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189)\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487)\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835)\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520)\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651)\n\n a = md5ii(a, b, c, d, x[i], 6, -198630844)\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415)\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905)\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055)\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571)\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606)\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523)\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799)\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359)\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744)\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380)\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649)\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070)\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379)\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259)\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551)\n\n a = safeAdd(a, olda)\n b = safeAdd(b, oldb)\n c = safeAdd(c, oldc)\n d = safeAdd(d, oldd)\n }\n return [a, b, c, d]\n }\n\n /*\n * Convert an array of little-endian words to a string\n */\n function binl2rstr (input) {\n var i\n var output = ''\n var length32 = input.length * 32\n for (i = 0; i < length32; i += 8) {\n output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff)\n }\n return output\n }\n\n /*\n * Convert a raw string to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n function rstr2binl (input) {\n var i\n var output = []\n output[(input.length >> 2) - 1] = undefined\n for (i = 0; i < output.length; i += 1) {\n output[i] = 0\n }\n var length8 = input.length * 8\n for (i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32)\n }\n return output\n }\n\n /*\n * Calculate the MD5 of a raw string\n */\n function rstrMD5 (s) {\n return binl2rstr(binlMD5(rstr2binl(s), s.length * 8))\n }\n\n /*\n * Calculate the HMAC-MD5, of a key and some data (raw strings)\n */\n function rstrHMACMD5 (key, data) {\n var i\n var bkey = rstr2binl(key)\n var ipad = []\n var opad = []\n var hash\n ipad[15] = opad[15] = undefined\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8)\n }\n for (i = 0; i < 16; i += 1) {\n ipad[i] = bkey[i] ^ 0x36363636\n opad[i] = bkey[i] ^ 0x5c5c5c5c\n }\n hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8)\n return binl2rstr(binlMD5(opad.concat(hash), 512 + 128))\n }\n\n /*\n * Convert a raw string to a hex string\n */\n function rstr2hex (input) {\n var hexTab = '0123456789abcdef'\n var output = ''\n var x\n var i\n for (i = 0; i < input.length; i += 1) {\n x = input.charCodeAt(i)\n output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)\n }\n return output\n }\n\n /*\n * Encode a string as utf-8\n */\n function str2rstrUTF8 (input) {\n return unescape(encodeURIComponent(input))\n }\n\n /*\n * Take string arguments and return either raw or hex encoded strings\n */\n function rawMD5 (s) {\n return rstrMD5(str2rstrUTF8(s))\n }\n function hexMD5 (s) {\n return rstr2hex(rawMD5(s))\n }\n function rawHMACMD5 (k, d) {\n return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d))\n }\n function hexHMACMD5 (k, d) {\n return rstr2hex(rawHMACMD5(k, d))\n }\n\n function md5 (string, key, raw) {\n if (!key) {\n if (!raw) {\n return hexMD5(string)\n }\n return rawMD5(string)\n }\n if (!raw) {\n return hexHMACMD5(key, string)\n }\n return rawHMACMD5(key, string)\n }\n\n if (true) {\n !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n return md5\n }).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n } else {}\n})(this)\n\n\n//# sourceURL=webpack:///./node_modules/blueimp-md5/js/md5.js?");
97 |
98 | /***/ }),
99 |
100 | /***/ "./node_modules/fingerprintjs2/fingerprint2.js":
101 | /*!*****************************************************!*\
102 | !*** ./node_modules/fingerprintjs2/fingerprint2.js ***!
103 | \*****************************************************/
104 | /*! no static exports found */
105 | /***/ (function(module, exports, __webpack_require__) {
106 |
107 | eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*\n* Fingerprintjs2 2.1.0 - Modern & flexible browser fingerprint library v2\n* https://github.com/Valve/fingerprintjs2\n* Copyright (c) 2015 Valentin Vasilyev (valentin.vasilyev@outlook.com)\n* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n* ARE DISCLAIMED. IN NO EVENT SHALL VALENTIN VASILYEV BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n/* global define */\n(function (name, context, definition) {\n 'use strict'\n if (typeof window !== 'undefined' && \"function\" === 'function' && __webpack_require__(/*! !webpack amd options */ \"./node_modules/webpack/buildin/amd-options.js\")) { !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else if ( true && module.exports) { module.exports = definition() } else if (context.exports) { context.exports = definition() } else { context[name] = definition() }\n})('Fingerprint2', this, function () {\n 'use strict'\n\n /// MurmurHash3 related functions\n\n //\n // Given two 64bit ints (as an array of two 32bit ints) returns the two\n // added together as a 64bit int (as an array of two 32bit ints).\n //\n var x64Add = function (m, n) {\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff]\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff]\n var o = [0, 0, 0, 0]\n o[3] += m[3] + n[3]\n o[2] += o[3] >>> 16\n o[3] &= 0xffff\n o[2] += m[2] + n[2]\n o[1] += o[2] >>> 16\n o[2] &= 0xffff\n o[1] += m[1] + n[1]\n o[0] += o[1] >>> 16\n o[1] &= 0xffff\n o[0] += m[0] + n[0]\n o[0] &= 0xffff\n return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]]\n }\n\n //\n // Given two 64bit ints (as an array of two 32bit ints) returns the two\n // multiplied together as a 64bit int (as an array of two 32bit ints).\n //\n var x64Multiply = function (m, n) {\n m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff]\n n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff]\n var o = [0, 0, 0, 0]\n o[3] += m[3] * n[3]\n o[2] += o[3] >>> 16\n o[3] &= 0xffff\n o[2] += m[2] * n[3]\n o[1] += o[2] >>> 16\n o[2] &= 0xffff\n o[2] += m[3] * n[2]\n o[1] += o[2] >>> 16\n o[2] &= 0xffff\n o[1] += m[1] * n[3]\n o[0] += o[1] >>> 16\n o[1] &= 0xffff\n o[1] += m[2] * n[2]\n o[0] += o[1] >>> 16\n o[1] &= 0xffff\n o[1] += m[3] * n[1]\n o[0] += o[1] >>> 16\n o[1] &= 0xffff\n o[0] += (m[0] * n[3]) + (m[1] * n[2]) + (m[2] * n[1]) + (m[3] * n[0])\n o[0] &= 0xffff\n return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]]\n }\n //\n // Given a 64bit int (as an array of two 32bit ints) and an int\n // representing a number of bit positions, returns the 64bit int (as an\n // array of two 32bit ints) rotated left by that number of positions.\n //\n var x64Rotl = function (m, n) {\n n %= 64\n if (n === 32) {\n return [m[1], m[0]]\n } else if (n < 32) {\n return [(m[0] << n) | (m[1] >>> (32 - n)), (m[1] << n) | (m[0] >>> (32 - n))]\n } else {\n n -= 32\n return [(m[1] << n) | (m[0] >>> (32 - n)), (m[0] << n) | (m[1] >>> (32 - n))]\n }\n }\n //\n // Given a 64bit int (as an array of two 32bit ints) and an int\n // representing a number of bit positions, returns the 64bit int (as an\n // array of two 32bit ints) shifted left by that number of positions.\n //\n var x64LeftShift = function (m, n) {\n n %= 64\n if (n === 0) {\n return m\n } else if (n < 32) {\n return [(m[0] << n) | (m[1] >>> (32 - n)), m[1] << n]\n } else {\n return [m[1] << (n - 32), 0]\n }\n }\n //\n // Given two 64bit ints (as an array of two 32bit ints) returns the two\n // xored together as a 64bit int (as an array of two 32bit ints).\n //\n var x64Xor = function (m, n) {\n return [m[0] ^ n[0], m[1] ^ n[1]]\n }\n //\n // Given a block, returns murmurHash3's final x64 mix of that block.\n // (`[0, h[0] >>> 1]` is a 33 bit unsigned right shift. This is the\n // only place where we need to right shift 64bit ints.)\n //\n var x64Fmix = function (h) {\n h = x64Xor(h, [0, h[0] >>> 1])\n h = x64Multiply(h, [0xff51afd7, 0xed558ccd])\n h = x64Xor(h, [0, h[0] >>> 1])\n h = x64Multiply(h, [0xc4ceb9fe, 0x1a85ec53])\n h = x64Xor(h, [0, h[0] >>> 1])\n return h\n }\n\n //\n // Given a string and an optional seed as an int, returns a 128 bit\n // hash using the x64 flavor of MurmurHash3, as an unsigned hex.\n //\n var x64hash128 = function (key, seed) {\n key = key || ''\n seed = seed || 0\n var remainder = key.length % 16\n var bytes = key.length - remainder\n var h1 = [0, seed]\n var h2 = [0, seed]\n var k1 = [0, 0]\n var k2 = [0, 0]\n var c1 = [0x87c37b91, 0x114253d5]\n var c2 = [0x4cf5ad43, 0x2745937f]\n for (var i = 0; i < bytes; i = i + 16) {\n k1 = [((key.charCodeAt(i + 4) & 0xff)) | ((key.charCodeAt(i + 5) & 0xff) << 8) | ((key.charCodeAt(i + 6) & 0xff) << 16) | ((key.charCodeAt(i + 7) & 0xff) << 24), ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(i + 1) & 0xff) << 8) | ((key.charCodeAt(i + 2) & 0xff) << 16) | ((key.charCodeAt(i + 3) & 0xff) << 24)]\n k2 = [((key.charCodeAt(i + 12) & 0xff)) | ((key.charCodeAt(i + 13) & 0xff) << 8) | ((key.charCodeAt(i + 14) & 0xff) << 16) | ((key.charCodeAt(i + 15) & 0xff) << 24), ((key.charCodeAt(i + 8) & 0xff)) | ((key.charCodeAt(i + 9) & 0xff) << 8) | ((key.charCodeAt(i + 10) & 0xff) << 16) | ((key.charCodeAt(i + 11) & 0xff) << 24)]\n k1 = x64Multiply(k1, c1)\n k1 = x64Rotl(k1, 31)\n k1 = x64Multiply(k1, c2)\n h1 = x64Xor(h1, k1)\n h1 = x64Rotl(h1, 27)\n h1 = x64Add(h1, h2)\n h1 = x64Add(x64Multiply(h1, [0, 5]), [0, 0x52dce729])\n k2 = x64Multiply(k2, c2)\n k2 = x64Rotl(k2, 33)\n k2 = x64Multiply(k2, c1)\n h2 = x64Xor(h2, k2)\n h2 = x64Rotl(h2, 31)\n h2 = x64Add(h2, h1)\n h2 = x64Add(x64Multiply(h2, [0, 5]), [0, 0x38495ab5])\n }\n k1 = [0, 0]\n k2 = [0, 0]\n switch (remainder) {\n case 15:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 14)], 48))\n // fallthrough\n case 14:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 13)], 40))\n // fallthrough\n case 13:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 12)], 32))\n // fallthrough\n case 12:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 11)], 24))\n // fallthrough\n case 11:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 10)], 16))\n // fallthrough\n case 10:\n k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 9)], 8))\n // fallthrough\n case 9:\n k2 = x64Xor(k2, [0, key.charCodeAt(i + 8)])\n k2 = x64Multiply(k2, c2)\n k2 = x64Rotl(k2, 33)\n k2 = x64Multiply(k2, c1)\n h2 = x64Xor(h2, k2)\n // fallthrough\n case 8:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 7)], 56))\n // fallthrough\n case 7:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 6)], 48))\n // fallthrough\n case 6:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 5)], 40))\n // fallthrough\n case 5:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 4)], 32))\n // fallthrough\n case 4:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 3)], 24))\n // fallthrough\n case 3:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 2)], 16))\n // fallthrough\n case 2:\n k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 1)], 8))\n // fallthrough\n case 1:\n k1 = x64Xor(k1, [0, key.charCodeAt(i)])\n k1 = x64Multiply(k1, c1)\n k1 = x64Rotl(k1, 31)\n k1 = x64Multiply(k1, c2)\n h1 = x64Xor(h1, k1)\n // fallthrough\n }\n h1 = x64Xor(h1, [0, key.length])\n h2 = x64Xor(h2, [0, key.length])\n h1 = x64Add(h1, h2)\n h2 = x64Add(h2, h1)\n h1 = x64Fmix(h1)\n h2 = x64Fmix(h2)\n h1 = x64Add(h1, h2)\n h2 = x64Add(h2, h1)\n return ('00000000' + (h1[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h1[1] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[1] >>> 0).toString(16)).slice(-8)\n }\n\n var defaultOptions = {\n preprocessor: null,\n audio: {\n timeout: 1000,\n // On iOS 11, audio context can only be used in response to user interaction.\n // We require users to explicitly enable audio fingerprinting on iOS 11.\n // See https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088\n excludeIOS11: true\n },\n fonts: {\n swfContainerId: 'fingerprintjs2',\n swfPath: 'flash/compiled/FontList.swf',\n userDefinedFonts: [],\n extendedJsFonts: false\n },\n screen: {\n // To ensure consistent fingerprints when users rotate their mobile devices\n detectScreenOrientation: true\n },\n plugins: {\n sortPluginsFor: [/palemoon/i],\n excludeIE: false\n },\n extraComponents: [],\n excludes: {\n // Unreliable on Windows, see https://github.com/Valve/fingerprintjs2/issues/375\n 'enumerateDevices': true,\n // devicePixelRatio depends on browser zoom, and it's impossible to detect browser zoom\n 'pixelRatio': true,\n // DNT depends on incognito mode for some browsers (Chrome) and it's impossible to detect incognito mode\n 'doNotTrack': true,\n // uses js fonts already\n 'fontsFlash': true\n },\n NOT_AVAILABLE: 'not available',\n ERROR: 'error',\n EXCLUDED: 'excluded'\n }\n\n var each = function (obj, iterator) {\n if (Array.prototype.forEach && obj.forEach === Array.prototype.forEach) {\n obj.forEach(iterator)\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i++) {\n iterator(obj[i], i, obj)\n }\n } else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator(obj[key], key, obj)\n }\n }\n }\n }\n\n var map = function (obj, iterator) {\n var results = []\n // Not using strict equality so that this acts as a\n // shortcut to checking for `null` and `undefined`.\n if (obj == null) {\n return results\n }\n if (Array.prototype.map && obj.map === Array.prototype.map) { return obj.map(iterator) }\n each(obj, function (value, index, list) {\n results.push(iterator(value, index, list))\n })\n return results\n }\n\n var extendSoft = function (target, source) {\n if (source == null) { return target }\n var value\n var key\n for (key in source) {\n value = source[key]\n if (value != null && !(Object.prototype.hasOwnProperty.call(target, key))) {\n target[key] = value\n }\n }\n return target\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices\n var enumerateDevicesKey = function (done, options) {\n if (!isEnumerateDevicesSupported()) {\n return done(options.NOT_AVAILABLE)\n }\n navigator.mediaDevices.enumerateDevices().then(function (devices) {\n done(devices.map(function (device) {\n return 'id=' + device.deviceId + ';gid=' + device.groupId + ';' + device.kind + ';' + device.label\n }))\n })\n .catch(function (error) {\n done(error)\n })\n }\n\n var isEnumerateDevicesSupported = function () {\n return (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices)\n }\n // Inspired by and based on https://github.com/cozylife/audio-fingerprint\n var audioKey = function (done, options) {\n var audioOptions = options.audio\n if (audioOptions.excludeIOS11 && navigator.userAgent.match(/OS 11.+Version\\/11.+Safari/)) {\n // See comment for excludeUserAgent and https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088\n return done(options.EXCLUDED)\n }\n\n var AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext\n\n if (AudioContext == null) {\n return done(options.NOT_AVAILABLE)\n }\n\n var context = new AudioContext(1, 44100, 44100)\n\n var oscillator = context.createOscillator()\n oscillator.type = 'triangle'\n oscillator.frequency.setValueAtTime(10000, context.currentTime)\n\n var compressor = context.createDynamicsCompressor()\n each([\n ['threshold', -50],\n ['knee', 40],\n ['ratio', 12],\n ['reduction', -20],\n ['attack', 0],\n ['release', 0.25]\n ], function (item) {\n if (compressor[item[0]] !== undefined && typeof compressor[item[0]].setValueAtTime === 'function') {\n compressor[item[0]].setValueAtTime(item[1], context.currentTime)\n }\n })\n\n oscillator.connect(compressor)\n compressor.connect(context.destination)\n oscillator.start(0)\n context.startRendering()\n\n var audioTimeoutId = setTimeout(function () {\n console.warn('Audio fingerprint timed out. Please report bug at https://github.com/Valve/fingerprintjs2 with your user agent: \"' + navigator.userAgent + '\".')\n context.oncomplete = function () { }\n context = null\n return done('audioTimeout')\n }, audioOptions.timeout)\n\n context.oncomplete = function (event) {\n var fingerprint\n try {\n clearTimeout(audioTimeoutId)\n fingerprint = event.renderedBuffer.getChannelData(0)\n .slice(4500, 5000)\n .reduce(function (acc, val) { return acc + Math.abs(val) }, 0)\n .toString()\n oscillator.disconnect()\n compressor.disconnect()\n } catch (error) {\n done(error)\n return\n }\n done(fingerprint)\n }\n }\n var UserAgent = function (done) {\n done(navigator.userAgent)\n }\n var webdriver = function (done, options) {\n done(navigator.webdriver == null ? options.NOT_AVAILABLE : navigator.webdriver)\n }\n var languageKey = function (done, options) {\n done(navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || options.NOT_AVAILABLE)\n }\n var colorDepthKey = function (done, options) {\n done(window.screen.colorDepth || options.NOT_AVAILABLE)\n }\n var deviceMemoryKey = function (done, options) {\n done(navigator.deviceMemory || options.NOT_AVAILABLE)\n }\n var pixelRatioKey = function (done, options) {\n done(window.devicePixelRatio || options.NOT_AVAILABLE)\n }\n var screenResolutionKey = function (done, options) {\n done(getScreenResolution(options))\n }\n var getScreenResolution = function (options) {\n var resolution = [window.screen.width, window.screen.height]\n if (options.screen.detectScreenOrientation) {\n resolution.sort().reverse()\n }\n return resolution\n }\n var availableScreenResolutionKey = function (done, options) {\n done(getAvailableScreenResolution(options))\n }\n var getAvailableScreenResolution = function (options) {\n if (window.screen.availWidth && window.screen.availHeight) {\n var available = [window.screen.availHeight, window.screen.availWidth]\n if (options.screen.detectScreenOrientation) {\n available.sort().reverse()\n }\n return available\n }\n // headless browsers\n return options.NOT_AVAILABLE\n }\n var timezoneOffset = function (done) {\n done(new Date().getTimezoneOffset())\n }\n var timezone = function (done, options) {\n if (window.Intl && window.Intl.DateTimeFormat) {\n done(new window.Intl.DateTimeFormat().resolvedOptions().timeZone)\n return\n }\n done(options.NOT_AVAILABLE)\n }\n var sessionStorageKey = function (done, options) {\n done(hasSessionStorage(options))\n }\n var localStorageKey = function (done, options) {\n done(hasLocalStorage(options))\n }\n var indexedDbKey = function (done, options) {\n done(hasIndexedDB(options))\n }\n var addBehaviorKey = function (done) {\n // body might not be defined at this point or removed programmatically\n done(!!(document.body && document.body.addBehavior))\n }\n var openDatabaseKey = function (done) {\n done(!!window.openDatabase)\n }\n var cpuClassKey = function (done, options) {\n done(getNavigatorCpuClass(options))\n }\n var platformKey = function (done, options) {\n done(getNavigatorPlatform(options))\n }\n var doNotTrackKey = function (done, options) {\n done(getDoNotTrack(options))\n }\n var canvasKey = function (done, options) {\n if (isCanvasSupported()) {\n done(getCanvasFp(options))\n return\n }\n done(options.NOT_AVAILABLE)\n }\n var webglKey = function (done, options) {\n if (isWebGlSupported()) {\n done(getWebglFp())\n return\n }\n done(options.NOT_AVAILABLE)\n }\n var webglVendorAndRendererKey = function (done) {\n if (isWebGlSupported()) {\n done(getWebglVendorAndRenderer())\n return\n }\n done()\n }\n var adBlockKey = function (done) {\n done(getAdBlock())\n }\n var hasLiedLanguagesKey = function (done) {\n done(getHasLiedLanguages())\n }\n var hasLiedResolutionKey = function (done) {\n done(getHasLiedResolution())\n }\n var hasLiedOsKey = function (done) {\n done(getHasLiedOs())\n }\n var hasLiedBrowserKey = function (done) {\n done(getHasLiedBrowser())\n }\n // flash fonts (will increase fingerprinting time 20X to ~ 130-150ms)\n var flashFontsKey = function (done, options) {\n // we do flash if swfobject is loaded\n if (!hasSwfObjectLoaded()) {\n return done('swf object not loaded')\n }\n if (!hasMinFlashInstalled()) {\n return done('flash not installed')\n }\n if (!options.fonts.swfPath) {\n return done('missing options.fonts.swfPath')\n }\n loadSwfAndDetectFonts(function (fonts) {\n done(fonts)\n }, options)\n }\n // kudos to http://www.lalit.org/lab/javascript-css-font-detect/\n var jsFontsKey = function (done, options) {\n // a font will be compared against all the three default fonts.\n // and if it doesn't match all 3 then that font is not available.\n var baseFonts = ['monospace', 'sans-serif', 'serif']\n\n var fontList = [\n 'Andale Mono', 'Arial', 'Arial Black', 'Arial Hebrew', 'Arial MT', 'Arial Narrow', 'Arial Rounded MT Bold', 'Arial Unicode MS',\n 'Bitstream Vera Sans Mono', 'Book Antiqua', 'Bookman Old Style',\n 'Calibri', 'Cambria', 'Cambria Math', 'Century', 'Century Gothic', 'Century Schoolbook', 'Comic Sans', 'Comic Sans MS', 'Consolas', 'Courier', 'Courier New',\n 'Geneva', 'Georgia',\n 'Helvetica', 'Helvetica Neue',\n 'Impact',\n 'Lucida Bright', 'Lucida Calligraphy', 'Lucida Console', 'Lucida Fax', 'LUCIDA GRANDE', 'Lucida Handwriting', 'Lucida Sans', 'Lucida Sans Typewriter', 'Lucida Sans Unicode',\n 'Microsoft Sans Serif', 'Monaco', 'Monotype Corsiva', 'MS Gothic', 'MS Outlook', 'MS PGothic', 'MS Reference Sans Serif', 'MS Sans Serif', 'MS Serif', 'MYRIAD', 'MYRIAD PRO',\n 'Palatino', 'Palatino Linotype',\n 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Segoe UI Light', 'Segoe UI Semibold', 'Segoe UI Symbol',\n 'Tahoma', 'Times', 'Times New Roman', 'Times New Roman PS', 'Trebuchet MS',\n 'Verdana', 'Wingdings', 'Wingdings 2', 'Wingdings 3'\n ]\n\n if (options.fonts.extendedJsFonts) {\n var extendedFontList = [\n 'Abadi MT Condensed Light', 'Academy Engraved LET', 'ADOBE CASLON PRO', 'Adobe Garamond', 'ADOBE GARAMOND PRO', 'Agency FB', 'Aharoni', 'Albertus Extra Bold', 'Albertus Medium', 'Algerian', 'Amazone BT', 'American Typewriter',\n 'American Typewriter Condensed', 'AmerType Md BT', 'Andalus', 'Angsana New', 'AngsanaUPC', 'Antique Olive', 'Aparajita', 'Apple Chancery', 'Apple Color Emoji', 'Apple SD Gothic Neo', 'Arabic Typesetting', 'ARCHER',\n 'ARNO PRO', 'Arrus BT', 'Aurora Cn BT', 'AvantGarde Bk BT', 'AvantGarde Md BT', 'AVENIR', 'Ayuthaya', 'Bandy', 'Bangla Sangam MN', 'Bank Gothic', 'BankGothic Md BT', 'Baskerville',\n 'Baskerville Old Face', 'Batang', 'BatangChe', 'Bauer Bodoni', 'Bauhaus 93', 'Bazooka', 'Bell MT', 'Bembo', 'Benguiat Bk BT', 'Berlin Sans FB', 'Berlin Sans FB Demi', 'Bernard MT Condensed', 'BernhardFashion BT', 'BernhardMod BT', 'Big Caslon', 'BinnerD',\n 'Blackadder ITC', 'BlairMdITC TT', 'Bodoni 72', 'Bodoni 72 Oldstyle', 'Bodoni 72 Smallcaps', 'Bodoni MT', 'Bodoni MT Black', 'Bodoni MT Condensed', 'Bodoni MT Poster Compressed',\n 'Bookshelf Symbol 7', 'Boulder', 'Bradley Hand', 'Bradley Hand ITC', 'Bremen Bd BT', 'Britannic Bold', 'Broadway', 'Browallia New', 'BrowalliaUPC', 'Brush Script MT', 'Californian FB', 'Calisto MT', 'Calligrapher', 'Candara',\n 'CaslonOpnface BT', 'Castellar', 'Centaur', 'Cezanne', 'CG Omega', 'CG Times', 'Chalkboard', 'Chalkboard SE', 'Chalkduster', 'Charlesworth', 'Charter Bd BT', 'Charter BT', 'Chaucer',\n 'ChelthmITC Bk BT', 'Chiller', 'Clarendon', 'Clarendon Condensed', 'CloisterBlack BT', 'Cochin', 'Colonna MT', 'Constantia', 'Cooper Black', 'Copperplate', 'Copperplate Gothic', 'Copperplate Gothic Bold',\n 'Copperplate Gothic Light', 'CopperplGoth Bd BT', 'Corbel', 'Cordia New', 'CordiaUPC', 'Cornerstone', 'Coronet', 'Cuckoo', 'Curlz MT', 'DaunPenh', 'Dauphin', 'David', 'DB LCD Temp', 'DELICIOUS', 'Denmark',\n 'DFKai-SB', 'Didot', 'DilleniaUPC', 'DIN', 'DokChampa', 'Dotum', 'DotumChe', 'Ebrima', 'Edwardian Script ITC', 'Elephant', 'English 111 Vivace BT', 'Engravers MT', 'EngraversGothic BT', 'Eras Bold ITC', 'Eras Demi ITC', 'Eras Light ITC', 'Eras Medium ITC',\n 'EucrosiaUPC', 'Euphemia', 'Euphemia UCAS', 'EUROSTILE', 'Exotc350 Bd BT', 'FangSong', 'Felix Titling', 'Fixedsys', 'FONTIN', 'Footlight MT Light', 'Forte',\n 'FrankRuehl', 'Fransiscan', 'Freefrm721 Blk BT', 'FreesiaUPC', 'Freestyle Script', 'French Script MT', 'FrnkGothITC Bk BT', 'Fruitger', 'FRUTIGER',\n 'Futura', 'Futura Bk BT', 'Futura Lt BT', 'Futura Md BT', 'Futura ZBlk BT', 'FuturaBlack BT', 'Gabriola', 'Galliard BT', 'Gautami', 'Geeza Pro', 'Geometr231 BT', 'Geometr231 Hv BT', 'Geometr231 Lt BT', 'GeoSlab 703 Lt BT',\n 'GeoSlab 703 XBd BT', 'Gigi', 'Gill Sans', 'Gill Sans MT', 'Gill Sans MT Condensed', 'Gill Sans MT Ext Condensed Bold', 'Gill Sans Ultra Bold', 'Gill Sans Ultra Bold Condensed', 'Gisha', 'Gloucester MT Extra Condensed', 'GOTHAM', 'GOTHAM BOLD',\n 'Goudy Old Style', 'Goudy Stout', 'GoudyHandtooled BT', 'GoudyOLSt BT', 'Gujarati Sangam MN', 'Gulim', 'GulimChe', 'Gungsuh', 'GungsuhChe', 'Gurmukhi MN', 'Haettenschweiler', 'Harlow Solid Italic', 'Harrington', 'Heather', 'Heiti SC', 'Heiti TC', 'HELV',\n 'Herald', 'High Tower Text', 'Hiragino Kaku Gothic ProN', 'Hiragino Mincho ProN', 'Hoefler Text', 'Humanst 521 Cn BT', 'Humanst521 BT', 'Humanst521 Lt BT', 'Imprint MT Shadow', 'Incised901 Bd BT', 'Incised901 BT',\n 'Incised901 Lt BT', 'INCONSOLATA', 'Informal Roman', 'Informal011 BT', 'INTERSTATE', 'IrisUPC', 'Iskoola Pota', 'JasmineUPC', 'Jazz LET', 'Jenson', 'Jester', 'Jokerman', 'Juice ITC', 'Kabel Bk BT', 'Kabel Ult BT', 'Kailasa', 'KaiTi', 'Kalinga', 'Kannada Sangam MN',\n 'Kartika', 'Kaufmann Bd BT', 'Kaufmann BT', 'Khmer UI', 'KodchiangUPC', 'Kokila', 'Korinna BT', 'Kristen ITC', 'Krungthep', 'Kunstler Script', 'Lao UI', 'Latha', 'Leelawadee', 'Letter Gothic', 'Levenim MT', 'LilyUPC', 'Lithograph', 'Lithograph Light', 'Long Island',\n 'Lydian BT', 'Magneto', 'Maiandra GD', 'Malayalam Sangam MN', 'Malgun Gothic',\n 'Mangal', 'Marigold', 'Marion', 'Marker Felt', 'Market', 'Marlett', 'Matisse ITC', 'Matura MT Script Capitals', 'Meiryo', 'Meiryo UI', 'Microsoft Himalaya', 'Microsoft JhengHei', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', 'Microsoft Tai Le',\n 'Microsoft Uighur', 'Microsoft YaHei', 'Microsoft Yi Baiti', 'MingLiU', 'MingLiU_HKSCS', 'MingLiU_HKSCS-ExtB', 'MingLiU-ExtB', 'Minion', 'Minion Pro', 'Miriam', 'Miriam Fixed', 'Mistral', 'Modern', 'Modern No. 20', 'Mona Lisa Solid ITC TT', 'Mongolian Baiti',\n 'MONO', 'MoolBoran', 'Mrs Eaves', 'MS LineDraw', 'MS Mincho', 'MS PMincho', 'MS Reference Specialty', 'MS UI Gothic', 'MT Extra', 'MUSEO', 'MV Boli',\n 'Nadeem', 'Narkisim', 'NEVIS', 'News Gothic', 'News GothicMT', 'NewsGoth BT', 'Niagara Engraved', 'Niagara Solid', 'Noteworthy', 'NSimSun', 'Nyala', 'OCR A Extended', 'Old Century', 'Old English Text MT', 'Onyx', 'Onyx BT', 'OPTIMA', 'Oriya Sangam MN',\n 'OSAKA', 'OzHandicraft BT', 'Palace Script MT', 'Papyrus', 'Parchment', 'Party LET', 'Pegasus', 'Perpetua', 'Perpetua Titling MT', 'PetitaBold', 'Pickwick', 'Plantagenet Cherokee', 'Playbill', 'PMingLiU', 'PMingLiU-ExtB',\n 'Poor Richard', 'Poster', 'PosterBodoni BT', 'PRINCETOWN LET', 'Pristina', 'PTBarnum BT', 'Pythagoras', 'Raavi', 'Rage Italic', 'Ravie', 'Ribbon131 Bd BT', 'Rockwell', 'Rockwell Condensed', 'Rockwell Extra Bold', 'Rod', 'Roman', 'Sakkal Majalla',\n 'Santa Fe LET', 'Savoye LET', 'Sceptre', 'Script', 'Script MT Bold', 'SCRIPTINA', 'Serifa', 'Serifa BT', 'Serifa Th BT', 'ShelleyVolante BT', 'Sherwood',\n 'Shonar Bangla', 'Showcard Gothic', 'Shruti', 'Signboard', 'SILKSCREEN', 'SimHei', 'Simplified Arabic', 'Simplified Arabic Fixed', 'SimSun', 'SimSun-ExtB', 'Sinhala Sangam MN', 'Sketch Rockwell', 'Skia', 'Small Fonts', 'Snap ITC', 'Snell Roundhand', 'Socket',\n 'Souvenir Lt BT', 'Staccato222 BT', 'Steamer', 'Stencil', 'Storybook', 'Styllo', 'Subway', 'Swis721 BlkEx BT', 'Swiss911 XCm BT', 'Sylfaen', 'Synchro LET', 'System', 'Tamil Sangam MN', 'Technical', 'Teletype', 'Telugu Sangam MN', 'Tempus Sans ITC',\n 'Terminal', 'Thonburi', 'Traditional Arabic', 'Trajan', 'TRAJAN PRO', 'Tristan', 'Tubular', 'Tunga', 'Tw Cen MT', 'Tw Cen MT Condensed', 'Tw Cen MT Condensed Extra Bold',\n 'TypoUpright BT', 'Unicorn', 'Univers', 'Univers CE 55 Medium', 'Univers Condensed', 'Utsaah', 'Vagabond', 'Vani', 'Vijaya', 'Viner Hand ITC', 'VisualUI', 'Vivaldi', 'Vladimir Script', 'Vrinda', 'Westminster', 'WHITNEY', 'Wide Latin',\n 'ZapfEllipt BT', 'ZapfHumnst BT', 'ZapfHumnst Dm BT', 'Zapfino', 'Zurich BlkEx BT', 'Zurich Ex BT', 'ZWAdobeF']\n fontList = fontList.concat(extendedFontList)\n }\n\n fontList = fontList.concat(options.fonts.userDefinedFonts)\n\n // remove duplicate fonts\n fontList = fontList.filter(function (font, position) {\n return fontList.indexOf(font) === position\n })\n\n // we use m or w because these two characters take up the maximum width.\n // And we use a LLi so that the same matching fonts can get separated\n var testString = 'mmmmmmmmmmlli'\n\n // we test using 72px font size, we may use any size. I guess larger the better.\n var testSize = '72px'\n\n var h = document.getElementsByTagName('body')[0]\n\n // div to load spans for the base fonts\n var baseFontsDiv = document.createElement('div')\n\n // div to load spans for the fonts to detect\n var fontsDiv = document.createElement('div')\n\n var defaultWidth = {}\n var defaultHeight = {}\n\n // creates a span where the fonts will be loaded\n var createSpan = function () {\n var s = document.createElement('span')\n /*\n * We need this css as in some weird browser this\n * span elements shows up for a microSec which creates a\n * bad user experience\n */\n s.style.position = 'absolute'\n s.style.left = '-9999px'\n s.style.fontSize = testSize\n\n // css font reset to reset external styles\n s.style.fontStyle = 'normal'\n s.style.fontWeight = 'normal'\n s.style.letterSpacing = 'normal'\n s.style.lineBreak = 'auto'\n s.style.lineHeight = 'normal'\n s.style.textTransform = 'none'\n s.style.textAlign = 'left'\n s.style.textDecoration = 'none'\n s.style.textShadow = 'none'\n s.style.whiteSpace = 'normal'\n s.style.wordBreak = 'normal'\n s.style.wordSpacing = 'normal'\n\n s.innerHTML = testString\n return s\n }\n\n // creates a span and load the font to detect and a base font for fallback\n var createSpanWithFonts = function (fontToDetect, baseFont) {\n var s = createSpan()\n s.style.fontFamily = \"'\" + fontToDetect + \"',\" + baseFont\n return s\n }\n\n // creates spans for the base fonts and adds them to baseFontsDiv\n var initializeBaseFontsSpans = function () {\n var spans = []\n for (var index = 0, length = baseFonts.length; index < length; index++) {\n var s = createSpan()\n s.style.fontFamily = baseFonts[index]\n baseFontsDiv.appendChild(s)\n spans.push(s)\n }\n return spans\n }\n\n // creates spans for the fonts to detect and adds them to fontsDiv\n var initializeFontsSpans = function () {\n var spans = {}\n for (var i = 0, l = fontList.length; i < l; i++) {\n var fontSpans = []\n for (var j = 0, numDefaultFonts = baseFonts.length; j < numDefaultFonts; j++) {\n var s = createSpanWithFonts(fontList[i], baseFonts[j])\n fontsDiv.appendChild(s)\n fontSpans.push(s)\n }\n spans[fontList[i]] = fontSpans // Stores {fontName : [spans for that font]}\n }\n return spans\n }\n\n // checks if a font is available\n var isFontAvailable = function (fontSpans) {\n var detected = false\n for (var i = 0; i < baseFonts.length; i++) {\n detected = (fontSpans[i].offsetWidth !== defaultWidth[baseFonts[i]] || fontSpans[i].offsetHeight !== defaultHeight[baseFonts[i]])\n if (detected) {\n return detected\n }\n }\n return detected\n }\n\n // create spans for base fonts\n var baseFontsSpans = initializeBaseFontsSpans()\n\n // add the spans to the DOM\n h.appendChild(baseFontsDiv)\n\n // get the default width for the three base fonts\n for (var index = 0, length = baseFonts.length; index < length; index++) {\n defaultWidth[baseFonts[index]] = baseFontsSpans[index].offsetWidth // width for the default font\n defaultHeight[baseFonts[index]] = baseFontsSpans[index].offsetHeight // height for the default font\n }\n\n // create spans for fonts to detect\n var fontsSpans = initializeFontsSpans()\n\n // add all the spans to the DOM\n h.appendChild(fontsDiv)\n\n // check available fonts\n var available = []\n for (var i = 0, l = fontList.length; i < l; i++) {\n if (isFontAvailable(fontsSpans[fontList[i]])) {\n available.push(fontList[i])\n }\n }\n\n // remove spans from DOM\n h.removeChild(fontsDiv)\n h.removeChild(baseFontsDiv)\n done(available)\n }\n var pluginsComponent = function (done, options) {\n if (isIE()) {\n if (!options.plugins.excludeIE) {\n done(getIEPlugins(options))\n } else {\n done(options.EXCLUDED)\n }\n } else {\n done(getRegularPlugins(options))\n }\n }\n var getRegularPlugins = function (options) {\n if (navigator.plugins == null) {\n return options.NOT_AVAILABLE\n }\n\n var plugins = []\n // plugins isn't defined in Node envs.\n for (var i = 0, l = navigator.plugins.length; i < l; i++) {\n if (navigator.plugins[i]) { plugins.push(navigator.plugins[i]) }\n }\n\n // sorting plugins only for those user agents, that we know randomize the plugins\n // every time we try to enumerate them\n if (pluginsShouldBeSorted(options)) {\n plugins = plugins.sort(function (a, b) {\n if (a.name > b.name) { return 1 }\n if (a.name < b.name) { return -1 }\n return 0\n })\n }\n return map(plugins, function (p) {\n var mimeTypes = map(p, function (mt) {\n return [mt.type, mt.suffixes]\n })\n return [p.name, p.description, mimeTypes]\n })\n }\n var getIEPlugins = function (options) {\n var result = []\n if ((Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(window, 'ActiveXObject')) || ('ActiveXObject' in window)) {\n var names = [\n 'AcroPDF.PDF', // Adobe PDF reader 7+\n 'Adodb.Stream',\n 'AgControl.AgControl', // Silverlight\n 'DevalVRXCtrl.DevalVRXCtrl.1',\n 'MacromediaFlashPaper.MacromediaFlashPaper',\n 'Msxml2.DOMDocument',\n 'Msxml2.XMLHTTP',\n 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr\n 'QuickTime.QuickTime', // QuickTime\n 'QuickTimeCheckObject.QuickTimeCheck.1',\n 'RealPlayer',\n 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',\n 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',\n 'Scripting.Dictionary',\n 'SWCtl.SWCtl', // ShockWave player\n 'Shell.UIHelper',\n 'ShockwaveFlash.ShockwaveFlash', // flash plugin\n 'Skype.Detection',\n 'TDCCtl.TDCCtl',\n 'WMPlayer.OCX', // Windows media player\n 'rmocx.RealPlayer G2 Control',\n 'rmocx.RealPlayer G2 Control.1'\n ]\n // starting to detect plugins in IE\n result = map(names, function (name) {\n try {\n // eslint-disable-next-line no-new\n new window.ActiveXObject(name)\n return name\n } catch (e) {\n return options.ERROR\n }\n })\n } else {\n result.push(options.NOT_AVAILABLE)\n }\n if (navigator.plugins) {\n result = result.concat(getRegularPlugins(options))\n }\n return result\n }\n var pluginsShouldBeSorted = function (options) {\n var should = false\n for (var i = 0, l = options.plugins.sortPluginsFor.length; i < l; i++) {\n var re = options.plugins.sortPluginsFor[i]\n if (navigator.userAgent.match(re)) {\n should = true\n break\n }\n }\n return should\n }\n var touchSupportKey = function (done) {\n done(getTouchSupport())\n }\n var hardwareConcurrencyKey = function (done, options) {\n done(getHardwareConcurrency(options))\n }\n var hasSessionStorage = function (options) {\n try {\n return !!window.sessionStorage\n } catch (e) {\n return options.ERROR // SecurityError when referencing it means it exists\n }\n }\n\n // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\n var hasLocalStorage = function (options) {\n try {\n return !!window.localStorage\n } catch (e) {\n return options.ERROR // SecurityError when referencing it means it exists\n }\n }\n var hasIndexedDB = function (options) {\n try {\n return !!window.indexedDB\n } catch (e) {\n return options.ERROR // SecurityError when referencing it means it exists\n }\n }\n var getHardwareConcurrency = function (options) {\n if (navigator.hardwareConcurrency) {\n return navigator.hardwareConcurrency\n }\n return options.NOT_AVAILABLE\n }\n var getNavigatorCpuClass = function (options) {\n return navigator.cpuClass || options.NOT_AVAILABLE\n }\n var getNavigatorPlatform = function (options) {\n if (navigator.platform) {\n return navigator.platform\n } else {\n return options.NOT_AVAILABLE\n }\n }\n var getDoNotTrack = function (options) {\n if (navigator.doNotTrack) {\n return navigator.doNotTrack\n } else if (navigator.msDoNotTrack) {\n return navigator.msDoNotTrack\n } else if (window.doNotTrack) {\n return window.doNotTrack\n } else {\n return options.NOT_AVAILABLE\n }\n }\n // This is a crude and primitive touch screen detection.\n // It's not possible to currently reliably detect the availability of a touch screen\n // with a JS, without actually subscribing to a touch event.\n // http://www.stucox.com/blog/you-cant-detect-a-touchscreen/\n // https://github.com/Modernizr/Modernizr/issues/548\n // method returns an array of 3 values:\n // maxTouchPoints, the success or failure of creating a TouchEvent,\n // and the availability of the 'ontouchstart' property\n\n var getTouchSupport = function () {\n var maxTouchPoints = 0\n var touchEvent\n if (typeof navigator.maxTouchPoints !== 'undefined') {\n maxTouchPoints = navigator.maxTouchPoints\n } else if (typeof navigator.msMaxTouchPoints !== 'undefined') {\n maxTouchPoints = navigator.msMaxTouchPoints\n }\n try {\n document.createEvent('TouchEvent')\n touchEvent = true\n } catch (_) {\n touchEvent = false\n }\n var touchStart = 'ontouchstart' in window\n return [maxTouchPoints, touchEvent, touchStart]\n }\n // https://www.browserleaks.com/canvas#how-does-it-work\n\n var getCanvasFp = function (options) {\n var result = []\n // Very simple now, need to make it more complex (geo shapes etc)\n var canvas = document.createElement('canvas')\n canvas.width = 2000\n canvas.height = 200\n canvas.style.display = 'inline'\n var ctx = canvas.getContext('2d')\n // detect browser support of canvas winding\n // http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/canvas/winding.js\n ctx.rect(0, 0, 10, 10)\n ctx.rect(2, 2, 6, 6)\n result.push('canvas winding:' + ((ctx.isPointInPath(5, 5, 'evenodd') === false) ? 'yes' : 'no'))\n\n ctx.textBaseline = 'alphabetic'\n ctx.fillStyle = '#f60'\n ctx.fillRect(125, 1, 62, 20)\n ctx.fillStyle = '#069'\n // https://github.com/Valve/fingerprintjs2/issues/66\n if (options.dontUseFakeFontInCanvas) {\n ctx.font = '11pt Arial'\n } else {\n ctx.font = '11pt no-real-font-123'\n }\n ctx.fillText('Cwm fjordbank glyphs vext quiz, \\ud83d\\ude03', 2, 15)\n ctx.fillStyle = 'rgba(102, 204, 0, 0.2)'\n ctx.font = '18pt Arial'\n ctx.fillText('Cwm fjordbank glyphs vext quiz, \\ud83d\\ude03', 4, 45)\n\n // canvas blending\n // http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/\n // http://jsfiddle.net/NDYV8/16/\n ctx.globalCompositeOperation = 'multiply'\n ctx.fillStyle = 'rgb(255,0,255)'\n ctx.beginPath()\n ctx.arc(50, 50, 50, 0, Math.PI * 2, true)\n ctx.closePath()\n ctx.fill()\n ctx.fillStyle = 'rgb(0,255,255)'\n ctx.beginPath()\n ctx.arc(100, 50, 50, 0, Math.PI * 2, true)\n ctx.closePath()\n ctx.fill()\n ctx.fillStyle = 'rgb(255,255,0)'\n ctx.beginPath()\n ctx.arc(75, 100, 50, 0, Math.PI * 2, true)\n ctx.closePath()\n ctx.fill()\n ctx.fillStyle = 'rgb(255,0,255)'\n // canvas winding\n // http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // http://jsfiddle.net/NDYV8/19/\n ctx.arc(75, 75, 75, 0, Math.PI * 2, true)\n ctx.arc(75, 75, 25, 0, Math.PI * 2, true)\n ctx.fill('evenodd')\n\n if (canvas.toDataURL) { result.push('canvas fp:' + canvas.toDataURL()) }\n return result\n }\n var getWebglFp = function () {\n var gl\n var fa2s = function (fa) {\n gl.clearColor(0.0, 0.0, 0.0, 1.0)\n gl.enable(gl.DEPTH_TEST)\n gl.depthFunc(gl.LEQUAL)\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)\n return '[' + fa[0] + ', ' + fa[1] + ']'\n }\n var maxAnisotropy = function (gl) {\n var ext = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic')\n if (ext) {\n var anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT)\n if (anisotropy === 0) {\n anisotropy = 2\n }\n return anisotropy\n } else {\n return null\n }\n }\n\n gl = getWebglCanvas()\n if (!gl) { return null }\n // WebGL fingerprinting is a combination of techniques, found in MaxMind antifraud script & Augur fingerprinting.\n // First it draws a gradient object with shaders and convers the image to the Base64 string.\n // Then it enumerates all WebGL extensions & capabilities and appends them to the Base64 string, resulting in a huge WebGL string, potentially very unique on each device\n // Since iOS supports webgl starting from version 8.1 and 8.1 runs on several graphics chips, the results may be different across ios devices, but we need to verify it.\n var result = []\n var vShaderTemplate = 'attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}'\n var fShaderTemplate = 'precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}'\n var vertexPosBuffer = gl.createBuffer()\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer)\n var vertices = new Float32Array([-0.2, -0.9, 0, 0.4, -0.26, 0, 0, 0.732134444, 0])\n gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW)\n vertexPosBuffer.itemSize = 3\n vertexPosBuffer.numItems = 3\n var program = gl.createProgram()\n var vshader = gl.createShader(gl.VERTEX_SHADER)\n gl.shaderSource(vshader, vShaderTemplate)\n gl.compileShader(vshader)\n var fshader = gl.createShader(gl.FRAGMENT_SHADER)\n gl.shaderSource(fshader, fShaderTemplate)\n gl.compileShader(fshader)\n gl.attachShader(program, vshader)\n gl.attachShader(program, fshader)\n gl.linkProgram(program)\n gl.useProgram(program)\n program.vertexPosAttrib = gl.getAttribLocation(program, 'attrVertex')\n program.offsetUniform = gl.getUniformLocation(program, 'uniformOffset')\n gl.enableVertexAttribArray(program.vertexPosArray)\n gl.vertexAttribPointer(program.vertexPosAttrib, vertexPosBuffer.itemSize, gl.FLOAT, !1, 0, 0)\n gl.uniform2f(program.offsetUniform, 1, 1)\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, vertexPosBuffer.numItems)\n try {\n result.push(gl.canvas.toDataURL())\n } catch (e) {\n /* .toDataURL may be absent or broken (blocked by extension) */\n }\n result.push('extensions:' + (gl.getSupportedExtensions() || []).join(';'))\n result.push('webgl aliased line width range:' + fa2s(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)))\n result.push('webgl aliased point size range:' + fa2s(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)))\n result.push('webgl alpha bits:' + gl.getParameter(gl.ALPHA_BITS))\n result.push('webgl antialiasing:' + (gl.getContextAttributes().antialias ? 'yes' : 'no'))\n result.push('webgl blue bits:' + gl.getParameter(gl.BLUE_BITS))\n result.push('webgl depth bits:' + gl.getParameter(gl.DEPTH_BITS))\n result.push('webgl green bits:' + gl.getParameter(gl.GREEN_BITS))\n result.push('webgl max anisotropy:' + maxAnisotropy(gl))\n result.push('webgl max combined texture image units:' + gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS))\n result.push('webgl max cube map texture size:' + gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE))\n result.push('webgl max fragment uniform vectors:' + gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS))\n result.push('webgl max render buffer size:' + gl.getParameter(gl.MAX_RENDERBUFFER_SIZE))\n result.push('webgl max texture image units:' + gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS))\n result.push('webgl max texture size:' + gl.getParameter(gl.MAX_TEXTURE_SIZE))\n result.push('webgl max varying vectors:' + gl.getParameter(gl.MAX_VARYING_VECTORS))\n result.push('webgl max vertex attribs:' + gl.getParameter(gl.MAX_VERTEX_ATTRIBS))\n result.push('webgl max vertex texture image units:' + gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS))\n result.push('webgl max vertex uniform vectors:' + gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS))\n result.push('webgl max viewport dims:' + fa2s(gl.getParameter(gl.MAX_VIEWPORT_DIMS)))\n result.push('webgl red bits:' + gl.getParameter(gl.RED_BITS))\n result.push('webgl renderer:' + gl.getParameter(gl.RENDERER))\n result.push('webgl shading language version:' + gl.getParameter(gl.SHADING_LANGUAGE_VERSION))\n result.push('webgl stencil bits:' + gl.getParameter(gl.STENCIL_BITS))\n result.push('webgl vendor:' + gl.getParameter(gl.VENDOR))\n result.push('webgl version:' + gl.getParameter(gl.VERSION))\n\n try {\n // Add the unmasked vendor and unmasked renderer if the debug_renderer_info extension is available\n var extensionDebugRendererInfo = gl.getExtension('WEBGL_debug_renderer_info')\n if (extensionDebugRendererInfo) {\n result.push('webgl unmasked vendor:' + gl.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL))\n result.push('webgl unmasked renderer:' + gl.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL))\n }\n } catch (e) { /* squelch */ }\n\n if (!gl.getShaderPrecisionFormat) {\n return result\n }\n\n each(['FLOAT', 'INT'], function (numType) {\n each(['VERTEX', 'FRAGMENT'], function (shader) {\n each(['HIGH', 'MEDIUM', 'LOW'], function (numSize) {\n each(['precision', 'rangeMin', 'rangeMax'], function (key) {\n var format = gl.getShaderPrecisionFormat(gl[shader + '_SHADER'], gl[numSize + '_' + numType])[key]\n if (key !== 'precision') {\n key = 'precision ' + key\n }\n var line = ['webgl ', shader.toLowerCase(), ' shader ', numSize.toLowerCase(), ' ', numType.toLowerCase(), ' ', key, ':', format].join('')\n result.push(line)\n })\n })\n })\n })\n return result\n }\n var getWebglVendorAndRenderer = function () {\n /* This a subset of the WebGL fingerprint with a lot of entropy, while being reasonably browser-independent */\n try {\n var glContext = getWebglCanvas()\n var extensionDebugRendererInfo = glContext.getExtension('WEBGL_debug_renderer_info')\n return glContext.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL) + '~' + glContext.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL)\n } catch (e) {\n return null\n }\n }\n var getAdBlock = function () {\n var ads = document.createElement('div')\n ads.innerHTML = ' '\n ads.className = 'adsbox'\n var result = false\n try {\n // body may not exist, that's why we need try/catch\n document.body.appendChild(ads)\n result = document.getElementsByClassName('adsbox')[0].offsetHeight === 0\n document.body.removeChild(ads)\n } catch (e) {\n result = false\n }\n return result\n }\n var getHasLiedLanguages = function () {\n // We check if navigator.language is equal to the first language of navigator.languages\n // navigator.languages is undefined on IE11 (and potentially older IEs)\n if (typeof navigator.languages !== 'undefined') {\n try {\n var firstLanguages = navigator.languages[0].substr(0, 2)\n if (firstLanguages !== navigator.language.substr(0, 2)) {\n return true\n }\n } catch (err) {\n return true\n }\n }\n return false\n }\n var getHasLiedResolution = function () {\n return window.screen.width < window.screen.availWidth || window.screen.height < window.screen.availHeight\n }\n var getHasLiedOs = function () {\n var userAgent = navigator.userAgent.toLowerCase()\n var oscpu = navigator.oscpu\n var platform = navigator.platform.toLowerCase()\n var os\n // We extract the OS from the user agent (respect the order of the if else if statement)\n if (userAgent.indexOf('windows phone') >= 0) {\n os = 'Windows Phone'\n } else if (userAgent.indexOf('win') >= 0) {\n os = 'Windows'\n } else if (userAgent.indexOf('android') >= 0) {\n os = 'Android'\n } else if (userAgent.indexOf('linux') >= 0 || userAgent.indexOf('cros') >= 0) {\n os = 'Linux'\n } else if (userAgent.indexOf('iphone') >= 0 || userAgent.indexOf('ipad') >= 0) {\n os = 'iOS'\n } else if (userAgent.indexOf('mac') >= 0) {\n os = 'Mac'\n } else {\n os = 'Other'\n }\n // We detect if the person uses a mobile device\n var mobileDevice = (('ontouchstart' in window) ||\n (navigator.maxTouchPoints > 0) ||\n (navigator.msMaxTouchPoints > 0))\n\n if (mobileDevice && os !== 'Windows Phone' && os !== 'Android' && os !== 'iOS' && os !== 'Other') {\n return true\n }\n\n // We compare oscpu with the OS extracted from the UA\n if (typeof oscpu !== 'undefined') {\n oscpu = oscpu.toLowerCase()\n if (oscpu.indexOf('win') >= 0 && os !== 'Windows' && os !== 'Windows Phone') {\n return true\n } else if (oscpu.indexOf('linux') >= 0 && os !== 'Linux' && os !== 'Android') {\n return true\n } else if (oscpu.indexOf('mac') >= 0 && os !== 'Mac' && os !== 'iOS') {\n return true\n } else if ((oscpu.indexOf('win') === -1 && oscpu.indexOf('linux') === -1 && oscpu.indexOf('mac') === -1) !== (os === 'Other')) {\n return true\n }\n }\n\n // We compare platform with the OS extracted from the UA\n if (platform.indexOf('win') >= 0 && os !== 'Windows' && os !== 'Windows Phone') {\n return true\n } else if ((platform.indexOf('linux') >= 0 || platform.indexOf('android') >= 0 || platform.indexOf('pike') >= 0) && os !== 'Linux' && os !== 'Android') {\n return true\n } else if ((platform.indexOf('mac') >= 0 || platform.indexOf('ipad') >= 0 || platform.indexOf('ipod') >= 0 || platform.indexOf('iphone') >= 0) && os !== 'Mac' && os !== 'iOS') {\n return true\n } else {\n var platformIsOther = platform.indexOf('win') < 0 &&\n platform.indexOf('linux') < 0 &&\n platform.indexOf('mac') < 0 &&\n platform.indexOf('iphone') < 0 &&\n platform.indexOf('ipad') < 0\n if (platformIsOther !== (os === 'Other')) {\n return true\n }\n }\n\n return typeof navigator.plugins === 'undefined' && os !== 'Windows' && os !== 'Windows Phone'\n }\n var getHasLiedBrowser = function () {\n var userAgent = navigator.userAgent.toLowerCase()\n var productSub = navigator.productSub\n\n // we extract the browser from the user agent (respect the order of the tests)\n var browser\n if (userAgent.indexOf('firefox') >= 0) {\n browser = 'Firefox'\n } else if (userAgent.indexOf('opera') >= 0 || userAgent.indexOf('opr') >= 0) {\n browser = 'Opera'\n } else if (userAgent.indexOf('chrome') >= 0) {\n browser = 'Chrome'\n } else if (userAgent.indexOf('safari') >= 0) {\n browser = 'Safari'\n } else if (userAgent.indexOf('trident') >= 0) {\n browser = 'Internet Explorer'\n } else {\n browser = 'Other'\n }\n\n if ((browser === 'Chrome' || browser === 'Safari' || browser === 'Opera') && productSub !== '20030107') {\n return true\n }\n\n // eslint-disable-next-line no-eval\n var tempRes = eval.toString().length\n if (tempRes === 37 && browser !== 'Safari' && browser !== 'Firefox' && browser !== 'Other') {\n return true\n } else if (tempRes === 39 && browser !== 'Internet Explorer' && browser !== 'Other') {\n return true\n } else if (tempRes === 33 && browser !== 'Chrome' && browser !== 'Opera' && browser !== 'Other') {\n return true\n }\n\n // We create an error to see how it is handled\n var errFirefox\n try {\n // eslint-disable-next-line no-throw-literal\n throw 'a'\n } catch (err) {\n try {\n err.toSource()\n errFirefox = true\n } catch (errOfErr) {\n errFirefox = false\n }\n }\n return errFirefox && browser !== 'Firefox' && browser !== 'Other'\n }\n var isCanvasSupported = function () {\n var elem = document.createElement('canvas')\n return !!(elem.getContext && elem.getContext('2d'))\n }\n var isWebGlSupported = function () {\n // code taken from Modernizr\n if (!isCanvasSupported()) {\n return false\n }\n\n var glContext = getWebglCanvas()\n return !!window.WebGLRenderingContext && !!glContext\n }\n var isIE = function () {\n if (navigator.appName === 'Microsoft Internet Explorer') {\n return true\n } else if (navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)) { // IE 11\n return true\n }\n return false\n }\n var hasSwfObjectLoaded = function () {\n return typeof window.swfobject !== 'undefined'\n }\n var hasMinFlashInstalled = function () {\n return window.swfobject.hasFlashPlayerVersion('9.0.0')\n }\n var addFlashDivNode = function (options) {\n var node = document.createElement('div')\n node.setAttribute('id', options.fonts.swfContainerId)\n document.body.appendChild(node)\n }\n var loadSwfAndDetectFonts = function (done, options) {\n var hiddenCallback = '___fp_swf_loaded'\n window[hiddenCallback] = function (fonts) {\n done(fonts)\n }\n var id = options.fonts.swfContainerId\n addFlashDivNode()\n var flashvars = { onReady: hiddenCallback }\n var flashparams = { allowScriptAccess: 'always', menu: 'false' }\n window.swfobject.embedSWF(options.fonts.swfPath, id, '1', '1', '9.0.0', false, flashvars, flashparams, {})\n }\n var getWebglCanvas = function () {\n var canvas = document.createElement('canvas')\n var gl = null\n try {\n gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')\n } catch (e) { /* squelch */ }\n if (!gl) { gl = null }\n return gl\n }\n\n var components = [\n { key: 'userAgent', getData: UserAgent },\n { key: 'webdriver', getData: webdriver },\n { key: 'language', getData: languageKey },\n { key: 'colorDepth', getData: colorDepthKey },\n { key: 'deviceMemory', getData: deviceMemoryKey },\n { key: 'pixelRatio', getData: pixelRatioKey },\n { key: 'hardwareConcurrency', getData: hardwareConcurrencyKey },\n { key: 'screenResolution', getData: screenResolutionKey },\n { key: 'availableScreenResolution', getData: availableScreenResolutionKey },\n { key: 'timezoneOffset', getData: timezoneOffset },\n { key: 'timezone', getData: timezone },\n { key: 'sessionStorage', getData: sessionStorageKey },\n { key: 'localStorage', getData: localStorageKey },\n { key: 'indexedDb', getData: indexedDbKey },\n { key: 'addBehavior', getData: addBehaviorKey },\n { key: 'openDatabase', getData: openDatabaseKey },\n { key: 'cpuClass', getData: cpuClassKey },\n { key: 'platform', getData: platformKey },\n { key: 'doNotTrack', getData: doNotTrackKey },\n { key: 'plugins', getData: pluginsComponent },\n { key: 'canvas', getData: canvasKey },\n { key: 'webgl', getData: webglKey },\n { key: 'webglVendorAndRenderer', getData: webglVendorAndRendererKey },\n { key: 'adBlock', getData: adBlockKey },\n { key: 'hasLiedLanguages', getData: hasLiedLanguagesKey },\n { key: 'hasLiedResolution', getData: hasLiedResolutionKey },\n { key: 'hasLiedOs', getData: hasLiedOsKey },\n { key: 'hasLiedBrowser', getData: hasLiedBrowserKey },\n { key: 'touchSupport', getData: touchSupportKey },\n { key: 'fonts', getData: jsFontsKey, pauseBefore: true },\n { key: 'fontsFlash', getData: flashFontsKey, pauseBefore: true },\n { key: 'audio', getData: audioKey },\n { key: 'enumerateDevices', getData: enumerateDevicesKey }\n ]\n\n var Fingerprint2 = function (options) {\n throw new Error(\"'new Fingerprint()' is deprecated, see https://github.com/Valve/fingerprintjs2#upgrade-guide-from-182-to-200\")\n }\n\n Fingerprint2.get = function (options, callback) {\n if (!callback) {\n callback = options\n options = {}\n } else if (!options) {\n options = {}\n }\n extendSoft(options, defaultOptions)\n options.components = options.extraComponents.concat(components)\n\n var keys = {\n data: [],\n addPreprocessedComponent: function (key, value) {\n if (typeof options.preprocessor === 'function') {\n value = options.preprocessor(key, value)\n }\n keys.data.push({ key: key, value: value })\n }\n }\n\n var i = -1\n var chainComponents = function (alreadyWaited) {\n i += 1\n if (i >= options.components.length) { // on finish\n callback(keys.data)\n return\n }\n var component = options.components[i]\n\n if (options.excludes[component.key]) {\n chainComponents(false) // skip\n return\n }\n\n if (!alreadyWaited && component.pauseBefore) {\n i -= 1\n setTimeout(function () {\n chainComponents(true)\n }, 1)\n return\n }\n\n try {\n component.getData(function (value) {\n keys.addPreprocessedComponent(component.key, value)\n chainComponents(false)\n }, options)\n } catch (error) {\n // main body error\n keys.addPreprocessedComponent(component.key, String(error))\n chainComponents(false)\n }\n }\n\n chainComponents(false)\n }\n\n Fingerprint2.getPromise = function (options) {\n return new Promise(function (resolve, reject) {\n Fingerprint2.get(options, resolve)\n })\n }\n\n Fingerprint2.getV18 = function (options, callback) {\n if (callback == null) {\n callback = options\n options = {}\n }\n return Fingerprint2.get(options, function (components) {\n var newComponents = []\n for (var i = 0; i < components.length; i++) {\n var component = components[i]\n if (component.value === (options.NOT_AVAILABLE || 'not available')) {\n newComponents.push({ key: component.key, value: 'unknown' })\n } else if (component.key === 'plugins') {\n newComponents.push({\n key: 'plugins',\n value: map(component.value, function (p) {\n var mimeTypes = map(p[2], function (mt) {\n if (mt.join) { return mt.join('~') }\n return mt\n }).join(',')\n return [p[0], p[1], mimeTypes].join('::')\n })\n })\n } else if (['canvas', 'webgl'].indexOf(component.key) !== -1) {\n newComponents.push({ key: component.key, value: component.value.join('~') })\n } else if (['sessionStorage', 'localStorage', 'indexedDb', 'addBehavior', 'openDatabase'].indexOf(component.key) !== -1) {\n if (component.value) {\n newComponents.push({ key: component.key, value: 1 })\n } else {\n // skip\n continue\n }\n } else {\n if (component.value) {\n newComponents.push(component.value.join ? { key: component.key, value: component.value.join(';') } : component)\n } else {\n newComponents.push({ key: component.key, value: component.value })\n }\n }\n }\n var murmur = x64hash128(map(newComponents, function (component) { return component.value }).join('~~~'), 31)\n callback(murmur, newComponents)\n })\n }\n\n Fingerprint2.x64hash128 = x64hash128\n Fingerprint2.VERSION = '2.1.0'\n return Fingerprint2\n})\n\n\n//# sourceURL=webpack:///./node_modules/fingerprintjs2/fingerprint2.js?");
108 |
109 | /***/ }),
110 |
111 | /***/ "./node_modules/webpack/buildin/amd-options.js":
112 | /*!****************************************!*\
113 | !*** (webpack)/buildin/amd-options.js ***!
114 | \****************************************/
115 | /*! no static exports found */
116 | /***/ (function(module, exports) {
117 |
118 | eval("/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {/* globals __webpack_amd_options__ */\nmodule.exports = __webpack_amd_options__;\n\n/* WEBPACK VAR INJECTION */}.call(this, {}))\n\n//# sourceURL=webpack:///(webpack)/buildin/amd-options.js?");
119 |
120 | /***/ }),
121 |
122 | /***/ "./src/core/audioFP.js":
123 | /*!*****************************!*\
124 | !*** ./src/core/audioFP.js ***!
125 | \*****************************/
126 | /*! exports provided: default */
127 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
128 |
129 | "use strict";
130 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var blueimp_md5__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! blueimp-md5 */ \"./node_modules/blueimp-md5/js/md5.js\");\n/* harmony import */ var blueimp_md5__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(blueimp_md5__WEBPACK_IMPORTED_MODULE_0__);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n return new Promise(function (done, reject) {\n var options = {\n audio: {\n timeout: 1000,\n // On iOS 11, audio context can only be used in response to user interaction.\n // We require users to explicitly enable audio fingerprinting on iOS 11.\n // See https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088\n excludeIOS11: true\n }\n };\n var audioOptions = options.audio;\n\n if (audioOptions.excludeIOS11 && navigator.userAgent.match(/OS 11.+Version\\/11.+Safari/)) {\n // See comment for excludeUserAgent and https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088\n return done(options.EXCLUDED);\n }\n\n var AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext;\n\n if (AudioContext == null) {\n return done(options.NOT_AVAILABLE);\n }\n\n var context = new AudioContext(1, 44100, 44100);\n var oscillator = context.createOscillator();\n oscillator.type = 'triangle';\n oscillator.frequency.setValueAtTime(10000, context.currentTime);\n var compressor = context.createDynamicsCompressor();\n [['threshold', -50], ['knee', 40], ['ratio', 12], ['reduction', -20], ['attack', 0], ['release', 0.25]].forEach(function (item) {\n if (compressor[item[0]] !== undefined && typeof compressor[item[0]].setValueAtTime === 'function') {\n compressor[item[0]].setValueAtTime(item[1], context.currentTime);\n }\n });\n oscillator.connect(compressor);\n compressor.connect(context.destination);\n oscillator.start(0);\n context.startRendering();\n var audioTimeoutId = setTimeout(function () {\n console.warn('Audio fingerprint timed out. Please report bug at https://github.com/Valve/fingerprintjs2 with your user agent: \"' + navigator.userAgent + '\".');\n\n context.oncomplete = function () {};\n\n context = null;\n return done('audioTimeout');\n }, audioOptions.timeout);\n\n context.oncomplete = function (event) {\n var fingerprint;\n\n try {\n clearTimeout(audioTimeoutId);\n fingerprint = event.renderedBuffer.getChannelData(0).slice(4500, 5000).reduce(function (acc, val) {\n return acc + Math.abs(val);\n }, 0).toString();\n oscillator.disconnect();\n compressor.disconnect();\n } catch (error) {\n done(error);\n return;\n }\n\n done(fingerprint);\n };\n }).then(function (rawData) {\n return {\n hash: blueimp_md5__WEBPACK_IMPORTED_MODULE_0___default()(rawData + \"\"),\n rawData: rawData\n };\n });\n});\n\n//# sourceURL=webpack:///./src/core/audioFP.js?");
131 |
132 | /***/ }),
133 |
134 | /***/ "./src/core/canvasFP.js":
135 | /*!******************************!*\
136 | !*** ./src/core/canvasFP.js ***!
137 | \******************************/
138 | /*! exports provided: default */
139 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
140 |
141 | "use strict";
142 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var blueimp_md5__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! blueimp-md5 */ \"./node_modules/blueimp-md5/js/md5.js\");\n/* harmony import */ var blueimp_md5__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(blueimp_md5__WEBPACK_IMPORTED_MODULE_0__);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (function (options) {\n options = options ? options : {};\n var result = {}; // Very simple now, need to make it more complex (geo shapes etc)\n\n var canvas = document.createElement('canvas');\n canvas.width = 2000;\n canvas.height = 200;\n canvas.style.display = 'inline';\n var ctx = canvas.getContext('2d'); // detect browser support of canvas winding\n // http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/canvas/winding.js\n\n ctx.rect(0, 0, 10, 10);\n ctx.rect(2, 2, 6, 6);\n result.canvasWinding = ctx.isPointInPath(5, 5, 'evenodd') === false ? 'yes' : 'no';\n ctx.textBaseline = 'alphabetic';\n ctx.fillStyle = '#f60';\n ctx.fillRect(125, 1, 62, 20);\n ctx.fillStyle = '#069'; // https://github.com/Valve/fingerprintjs2/issues/66\n\n if (options.dontUseFakeFontInCanvas) {\n ctx.font = '11pt Arial';\n } else {\n ctx.font = '11pt no-real-font-123';\n }\n\n ctx.fillText(\"Cwm fjordbank glyphs vext quiz, \\uD83D\\uDE03\", 2, 15);\n ctx.fillStyle = 'rgba(102, 204, 0, 0.2)';\n ctx.font = '18pt Arial';\n ctx.fillText(\"Cwm fjordbank glyphs vext quiz, \\uD83D\\uDE03\", 4, 45); // canvas blending\n // http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/\n // http://jsfiddle.net/NDYV8/16/\n\n ctx.globalCompositeOperation = 'multiply';\n ctx.fillStyle = 'rgb(255,0,255)';\n ctx.beginPath();\n ctx.arc(50, 50, 50, 0, Math.PI * 2, true);\n ctx.closePath();\n ctx.fill();\n ctx.fillStyle = 'rgb(0,255,255)';\n ctx.beginPath();\n ctx.arc(100, 50, 50, 0, Math.PI * 2, true);\n ctx.closePath();\n ctx.fill();\n ctx.fillStyle = 'rgb(255,255,0)';\n ctx.beginPath();\n ctx.arc(75, 100, 50, 0, Math.PI * 2, true);\n ctx.closePath();\n ctx.fill();\n ctx.fillStyle = 'rgb(255,0,255)'; // canvas winding\n // http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/\n // http://jsfiddle.net/NDYV8/19/\n\n ctx.arc(75, 75, 75, 0, Math.PI * 2, true);\n ctx.arc(75, 75, 25, 0, Math.PI * 2, true);\n ctx.fill('evenodd');\n\n if (canvas.toDataURL) {\n result.rawData = canvas.toDataURL();\n result.hash = blueimp_md5__WEBPACK_IMPORTED_MODULE_0___default()(result.rawData);\n }\n\n return result;\n});\n;\n\n//# sourceURL=webpack:///./src/core/canvasFP.js?");
143 |
144 | /***/ }),
145 |
146 | /***/ "./src/core/netFP.js":
147 | /*!***************************!*\
148 | !*** ./src/core/netFP.js ***!
149 | \***************************/
150 | /*! exports provided: default */
151 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
152 |
153 | "use strict";
154 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n return new Promise(function (resolve, reject) {\n var rtc = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; //compatibility for Firefox and chrome\n\n var pc = new rtc({\n iceServers: []\n }),\n noop = function noop() {};\n\n pc.createDataChannel(''); //create a bogus data channel\n\n pc.createOffer(pc.setLocalDescription.bind(pc), noop); // create offer and set local description\n\n pc.onicecandidate = function (ice) {\n if (ice && ice.candidate && ice.candidate.candidate) {\n console.log(ice.candidate.candidate);\n resolve(ice.candidate.candidate);\n }\n };\n });\n});\n\n//# sourceURL=webpack:///./src/core/netFP.js?");
155 |
156 | /***/ }),
157 |
158 | /***/ "./src/core/webglFP.js":
159 | /*!*****************************!*\
160 | !*** ./src/core/webglFP.js ***!
161 | \*****************************/
162 | /*! exports provided: default */
163 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
164 |
165 | "use strict";
166 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var blueimp_md5__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! blueimp-md5 */ \"./node_modules/blueimp-md5/js/md5.js\");\n/* harmony import */ var blueimp_md5__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(blueimp_md5__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar getWebglCanvas = function getWebglCanvas() {\n var canvas = document.createElement('canvas');\n var gl = null;\n\n try {\n gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');\n } catch (e) {\n /* squelch */\n }\n\n if (!gl) {\n gl = null;\n }\n\n return gl;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (function () {\n var gl;\n\n var fa2s = function fa2s(fa) {\n gl.clearColor(0.0, 0.0, 0.0, 1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n return '[' + fa[0] + ', ' + fa[1] + ']';\n };\n\n var maxAnisotropy = function maxAnisotropy(gl) {\n var ext = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic');\n\n if (ext) {\n var anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n\n if (anisotropy === 0) {\n anisotropy = 2;\n }\n\n return anisotropy;\n } else {\n return null;\n }\n };\n\n gl = getWebglCanvas();\n\n if (!gl) {\n return null;\n } // WebGL fingerprinting is a combination of techniques, found in MaxMind antifraud script & Augur fingerprinting.\n // First it draws a gradient object with shaders and convers the image to the Base64 string.\n // Then it enumerates all WebGL extensions & capabilities and appends them to the Base64 string, resulting in a huge WebGL string, potentially very unique on each device\n // Since iOS supports webgl starting from version 8.1 and 8.1 runs on several graphics chips, the results may be different across ios devices, but we need to verify it.\n\n\n var result = [];\n var vShaderTemplate = 'attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}';\n var fShaderTemplate = 'precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}';\n var vertexPosBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer);\n var vertices = new Float32Array([-0.2, -0.9, 0, 0.4, -0.26, 0, 0, 0.732134444, 0]);\n gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);\n vertexPosBuffer.itemSize = 3;\n vertexPosBuffer.numItems = 3;\n var program = gl.createProgram();\n var vshader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vshader, vShaderTemplate);\n gl.compileShader(vshader);\n var fshader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fshader, fShaderTemplate);\n gl.compileShader(fshader);\n gl.attachShader(program, vshader);\n gl.attachShader(program, fshader);\n gl.linkProgram(program);\n gl.useProgram(program);\n program.vertexPosAttrib = gl.getAttribLocation(program, 'attrVertex');\n program.offsetUniform = gl.getUniformLocation(program, 'uniformOffset');\n gl.enableVertexAttribArray(program.vertexPosArray);\n gl.vertexAttribPointer(program.vertexPosAttrib, vertexPosBuffer.itemSize, gl.FLOAT, !1, 0, 0);\n gl.uniform2f(program.offsetUniform, 1, 1);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, vertexPosBuffer.numItems);\n\n try {\n result.push(gl.canvas.toDataURL());\n } catch (e) {\n /* .toDataURL may be absent or broken (blocked by extension) */\n }\n\n return {\n hash: blueimp_md5__WEBPACK_IMPORTED_MODULE_0___default()(result[0]),\n rawData: result[0]\n };\n});\n\n//# sourceURL=webpack:///./src/core/webglFP.js?");
167 |
168 | /***/ }),
169 |
170 | /***/ "./src/index.js":
171 | /*!**********************!*\
172 | !*** ./src/index.js ***!
173 | \**********************/
174 | /*! no exports provided */
175 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
176 |
177 | "use strict";
178 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var fingerprintjs2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fingerprintjs2 */ \"./node_modules/fingerprintjs2/fingerprint2.js\");\n/* harmony import */ var fingerprintjs2__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fingerprintjs2__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _core_canvasFP__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core/canvasFP */ \"./src/core/canvasFP.js\");\n/* harmony import */ var _core_webglFP__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./core/webglFP */ \"./src/core/webglFP.js\");\n/* harmony import */ var _core_audioFP__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./core/audioFP */ \"./src/core/audioFP.js\");\n/* harmony import */ var _core_netFP__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./core/netFP */ \"./src/core/netFP.js\");\n\n\n\n\n\n\nfunction log(info) {\n var ele = document.createElement(\"p\");\n ele.style.fontSize = \"12px\";\n ele.innerHTML = info;\n document.body.appendChild(ele);\n} // 记住需要延时一段时间之后再去获取浏览器的指纹,因为网页加载时候立即调用会偶发出现不准确的问题。\n// 500ms 延时是Fingerprint2推荐的做法\n\n\nsetTimeout(function () {\n fingerprintjs2__WEBPACK_IMPORTED_MODULE_0___default.a.get(function (components) {\n console.log(components);\n });\n log(\"浏览器指纹组合实例:
\");\n log(\"记住需要延时一段时间之后再去获取浏览器的指纹,因为网页加载时候立即调用会偶发出现不准确的问题。
\");\n log(\"这个小栗子采用的源码来自 Fingerprint2 开源项目,傲天我只是将audio,webgl,canvas指纹相关的源代码拆分出来到单个文件中,方便读者学习每个指纹其内部的原理。
\");\n log(\"同时我写了一篇 知乎文章 链接介绍了浏览器的属性检测话题
\");\n log(\"记住如果你在产线环境使用指纹来辨别用户的唯一性,一定要知道这些指纹数据不是百分之百准确的!或者说不是百分之百唯一的!而且单个指纹发生碰撞的几率比较高。什么是碰撞?碰撞就是美国有个用户浏览器的canvas指纹与某个在中国的用户的canvas指纹是相同的。
\");\n var canvasStartTime = +new Date();\n log(\"canvas fingerprint : \" + Object(_core_canvasFP__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().hash);\n console.log(\"canvas fp generate time \".concat(+new Date() - canvasStartTime, \" ms\"));\n var webglStartTime = +new Date();\n log(\"webgl fingerprint : \" + Object(_core_webglFP__WEBPACK_IMPORTED_MODULE_2__[\"default\"])().hash);\n console.log(\"webgl fp generate time \".concat(+new Date() - webglStartTime, \" ms\"));\n var audioStartTime = +new Date();\n Object(_core_audioFP__WEBPACK_IMPORTED_MODULE_3__[\"default\"])().then(function (_ref) {\n var hash = _ref.hash;\n console.log(\"audio generate time : \".concat(+new Date() - audioStartTime, \" ms\"));\n log(\"audio fingerprint : \" + hash);\n });\n Object(_core_netFP__WEBPACK_IMPORTED_MODULE_4__[\"default\"])().then(function (offer) {\n log(\"rtcpeerconnection offer\", offer);\n });\n}, 500); //\n// var components = [\n// { key: 'userAgent', getData: UserAgent },\n// { key: 'webdriver', getData: webdriver },\n// { key: 'language', getData: languageKey },\n// { key: 'colorDepth', getData: colorDepthKey },\n// { key: 'deviceMemory', getData: deviceMemoryKey },\n// { key: 'pixelRatio', getData: pixelRatioKey },\n// { key: 'hardwareConcurrency', getData: hardwareConcurrencyKey },\n// { key: 'screenResolution', getData: screenResolutionKey },\n// { key: 'availableScreenResolution', getData: availableScreenResolutionKey },\n// { key: 'timezoneOffset', getData: timezoneOffset },\n// { key: 'timezone', getData: timezone },\n// { key: 'sessionStorage', getData: sessionStorageKey },\n// { key: 'localStorage', getData: localStorageKey },\n// { key: 'indexedDb', getData: indexedDbKey },\n// { key: 'addBehavior', getData: addBehaviorKey },\n// { key: 'openDatabase', getData: openDatabaseKey },\n// { key: 'cpuClass', getData: cpuClassKey },\n// { key: 'platform', getData: platformKey },\n// { key: 'doNotTrack', getData: doNotTrackKey },\n// { key: 'plugins', getData: pluginsComponent },\n// { key: 'canvas', getData: canvasKey },\n// { key: 'webgl', getData: webglKey },\n// { key: 'webglVendorAndRenderer', getData: webglVendorAndRendererKey },\n// { key: 'adBlock', getData: adBlockKey },\n// { key: 'hasLiedLanguages', getData: hasLiedLanguagesKey },\n// { key: 'hasLiedResolution', getData: hasLiedResolutionKey },\n// { key: 'hasLiedOs', getData: hasLiedOsKey },\n// { key: 'hasLiedBrowser', getData: hasLiedBrowserKey },\n// { key: 'touchSupport', getData: touchSupportKey },\n// { key: 'fonts', getData: jsFontsKey, pauseBefore: true },\n// { key: 'fontsFlash', getData: flashFontsKey, pauseBefore: true },\n// { key: 'audio', getData: audioKey },\n// { key: 'enumerateDevices', getData: enumerateDevicesKey }\n// ]\n\n//# sourceURL=webpack:///./src/index.js?");
179 |
180 | /***/ })
181 |
182 | /******/ });
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fingerprintDemo",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "dev": "webpack-dev-server --open",
8 | "build": "webpack"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "devDependencies": {
14 | "@babel/core": "^7.4.5",
15 | "@babel/preset-env": "^7.4.5",
16 | "babel-loader": "^8.0.6",
17 | "babel-plugin-syntax-dynamic-import": "^6.18.0",
18 | "css-loader": "^2.1.1",
19 | "html-webpack-plugin": "^3.2.0",
20 | "less": "^3.9.0",
21 | "less-loader": "^5.0.0",
22 | "style-loader": "^0.23.1",
23 | "uglifyjs-webpack-plugin": "^2.1.3",
24 | "webpack": "^4.32.2",
25 | "webpack-cli": "^3.3.2",
26 | "webpack-dev-server": "^3.5.1"
27 | },
28 | "dependencies": {
29 | "blueimp-md5": "^2.10.0",
30 | "fingerprintjs2": "^2.1.0"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/record.md:
--------------------------------------------------------------------------------
1 | ## 2019年8月22日
2 | 测试webrtc本地的ip, 但是只能获取到形如下面这样的"本地ip地址"
3 | ```text
4 | a581fe56-7ceb-405e-b053-6a0796ce7aaf.local
5 | ```
6 |
7 | 测试发现虽然在同一个tab页面中, 这个"本地ip/域名"可以保持唯一性, 但是新打开一个tab页就是一个新的值了.
8 | 所以无法作为浏览器指纹的指标.
9 |
10 |
--------------------------------------------------------------------------------
/src/core/audioFP.js:
--------------------------------------------------------------------------------
1 | import md5 from 'blueimp-md5'
2 |
3 | export default function () {
4 | return new Promise((done, reject) => {
5 | let options = {
6 | audio: {
7 | timeout: 1000,
8 | // On iOS 11, audio context can only be used in response to user interaction.
9 | // We require users to explicitly enable audio fingerprinting on iOS 11.
10 | // See https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088
11 | excludeIOS11: true
12 | }
13 | };
14 |
15 |
16 | var audioOptions = options.audio
17 | if (audioOptions.excludeIOS11 && navigator.userAgent.match(/OS 11.+Version\/11.+Safari/)) {
18 | // See comment for excludeUserAgent and https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088
19 | return done(options.EXCLUDED)
20 | }
21 |
22 | var AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext
23 |
24 | if (AudioContext == null) {
25 | return done(options.NOT_AVAILABLE)
26 | }
27 |
28 | var context = new AudioContext(1, 44100, 44100)
29 |
30 | var oscillator = context.createOscillator()
31 | oscillator.type = 'triangle'
32 | oscillator.frequency.setValueAtTime(10000, context.currentTime)
33 |
34 | var compressor = context.createDynamicsCompressor();
35 | [
36 | ['threshold', -50],
37 | ['knee', 40],
38 | ['ratio', 12],
39 | ['reduction', -20],
40 | ['attack', 0],
41 | ['release', 0.25]
42 | ].forEach(function (item) {
43 | if (compressor[item[0]] !== undefined && typeof compressor[item[0]].setValueAtTime === 'function') {
44 | compressor[item[0]].setValueAtTime(item[1], context.currentTime)
45 | }
46 | })
47 |
48 | oscillator.connect(compressor)
49 | compressor.connect(context.destination)
50 | oscillator.start(0)
51 | context.startRendering()
52 |
53 | var audioTimeoutId = setTimeout(function () {
54 | console.warn('Audio fingerprint timed out. Please report bug at https://github.com/Valve/fingerprintjs2 with your user agent: "' + navigator.userAgent + '".')
55 | context.oncomplete = function () {
56 | }
57 | context = null
58 | return done('audioTimeout')
59 | }, audioOptions.timeout)
60 |
61 | context.oncomplete = function (event) {
62 | var fingerprint
63 | try {
64 | clearTimeout(audioTimeoutId)
65 | fingerprint = event.renderedBuffer.getChannelData(0)
66 | .slice(4500, 5000)
67 | .reduce(function (acc, val) {
68 | return acc + Math.abs(val)
69 | }, 0)
70 | .toString()
71 | oscillator.disconnect()
72 | compressor.disconnect()
73 | } catch (error) {
74 | done(error)
75 | return
76 | }
77 | done(fingerprint)
78 | }
79 | }).then(rawData => {
80 | return {
81 | hash: md5(rawData + ""),
82 | rawData,
83 | }
84 | });
85 | }
86 |
--------------------------------------------------------------------------------
/src/core/canvasFP.js:
--------------------------------------------------------------------------------
1 | import md5 from 'blueimp-md5'
2 |
3 | export default function (options) {
4 | options = options ? options : {};
5 | var result = {}
6 | // Very simple now, need to make it more complex (geo shapes etc)
7 | var canvas = document.createElement('canvas')
8 | canvas.width = 2000
9 | canvas.height = 200
10 | canvas.style.display = 'inline'
11 | var ctx = canvas.getContext('2d')
12 | // detect browser support of canvas winding
13 | // http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/
14 | // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/canvas/winding.js
15 | ctx.rect(0, 0, 10, 10)
16 | ctx.rect(2, 2, 6, 6)
17 | result.canvasWinding = ((ctx.isPointInPath(5, 5, 'evenodd') === false) ? 'yes' : 'no');
18 |
19 |
20 | ctx.textBaseline = 'alphabetic'
21 | ctx.fillStyle = '#f60'
22 | ctx.fillRect(125, 1, 62, 20)
23 | ctx.fillStyle = '#069'
24 | // https://github.com/Valve/fingerprintjs2/issues/66
25 | if (options.dontUseFakeFontInCanvas) {
26 | ctx.font = '11pt Arial'
27 | } else {
28 | ctx.font = '11pt no-real-font-123'
29 | }
30 | ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 2, 15)
31 | ctx.fillStyle = 'rgba(102, 204, 0, 0.2)'
32 | ctx.font = '18pt Arial'
33 | ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 4, 45)
34 |
35 | // canvas blending
36 | // http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/
37 | // http://jsfiddle.net/NDYV8/16/
38 | ctx.globalCompositeOperation = 'multiply'
39 | ctx.fillStyle = 'rgb(255,0,255)'
40 | ctx.beginPath()
41 | ctx.arc(50, 50, 50, 0, Math.PI * 2, true)
42 | ctx.closePath()
43 | ctx.fill()
44 | ctx.fillStyle = 'rgb(0,255,255)'
45 | ctx.beginPath()
46 | ctx.arc(100, 50, 50, 0, Math.PI * 2, true)
47 | ctx.closePath()
48 | ctx.fill()
49 | ctx.fillStyle = 'rgb(255,255,0)'
50 | ctx.beginPath()
51 | ctx.arc(75, 100, 50, 0, Math.PI * 2, true)
52 | ctx.closePath()
53 | ctx.fill()
54 | ctx.fillStyle = 'rgb(255,0,255)'
55 | // canvas winding
56 | // http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/
57 | // http://jsfiddle.net/NDYV8/19/
58 | ctx.arc(75, 75, 75, 0, Math.PI * 2, true)
59 | ctx.arc(75, 75, 25, 0, Math.PI * 2, true)
60 | ctx.fill('evenodd')
61 |
62 | if (canvas.toDataURL) {
63 | result.rawData = canvas.toDataURL();
64 | result.hash = md5(result.rawData);
65 | }
66 | return result
67 | };
68 |
--------------------------------------------------------------------------------
/src/core/netFP.js:
--------------------------------------------------------------------------------
1 | export default function() {
2 | return new Promise((resolve, reject) => {
3 | let rtc = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;//compatibility for Firefox and chrome
4 | var pc = new rtc({iceServers:[]}), noop = function(){};
5 | pc.createDataChannel('');//create a bogus data channel
6 | pc.createOffer(pc.setLocalDescription.bind(pc), noop);// create offer and set local description
7 | pc.onicecandidate = function(ice)
8 | {
9 | if (ice && ice.candidate && ice.candidate.candidate)
10 | {
11 | console.log(ice.candidate.candidate);
12 | resolve(ice.candidate.candidate)
13 | }
14 | };
15 | })
16 | }
17 |
--------------------------------------------------------------------------------
/src/core/webglFP.js:
--------------------------------------------------------------------------------
1 | import md5 from 'blueimp-md5'
2 |
3 | var getWebglCanvas = function () {
4 | var canvas = document.createElement('canvas')
5 | var gl = null
6 | try {
7 | gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
8 | } catch (e) { /* squelch */ }
9 | if (!gl) { gl = null }
10 | return gl
11 | }
12 |
13 | export default function () {
14 | var gl
15 | var fa2s = function (fa) {
16 | gl.clearColor(0.0, 0.0, 0.0, 1.0)
17 | gl.enable(gl.DEPTH_TEST)
18 | gl.depthFunc(gl.LEQUAL)
19 | gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
20 | return '[' + fa[0] + ', ' + fa[1] + ']'
21 | }
22 | var maxAnisotropy = function (gl) {
23 | var ext = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic')
24 | if (ext) {
25 | var anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT)
26 | if (anisotropy === 0) {
27 | anisotropy = 2
28 | }
29 | return anisotropy
30 | } else {
31 | return null
32 | }
33 | }
34 |
35 | gl = getWebglCanvas()
36 | if (!gl) { return null }
37 | // WebGL fingerprinting is a combination of techniques, found in MaxMind antifraud script & Augur fingerprinting.
38 | // First it draws a gradient object with shaders and convers the image to the Base64 string.
39 | // Then it enumerates all WebGL extensions & capabilities and appends them to the Base64 string, resulting in a huge WebGL string, potentially very unique on each device
40 | // Since iOS supports webgl starting from version 8.1 and 8.1 runs on several graphics chips, the results may be different across ios devices, but we need to verify it.
41 | var result = []
42 | var vShaderTemplate = 'attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}'
43 | var fShaderTemplate = 'precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}'
44 | var vertexPosBuffer = gl.createBuffer()
45 | gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer)
46 | var vertices = new Float32Array([-0.2, -0.9, 0, 0.4, -0.26, 0, 0, 0.732134444, 0])
47 | gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW)
48 | vertexPosBuffer.itemSize = 3
49 | vertexPosBuffer.numItems = 3
50 | var program = gl.createProgram()
51 | var vshader = gl.createShader(gl.VERTEX_SHADER)
52 | gl.shaderSource(vshader, vShaderTemplate)
53 | gl.compileShader(vshader)
54 | var fshader = gl.createShader(gl.FRAGMENT_SHADER)
55 | gl.shaderSource(fshader, fShaderTemplate)
56 | gl.compileShader(fshader)
57 | gl.attachShader(program, vshader)
58 | gl.attachShader(program, fshader)
59 | gl.linkProgram(program)
60 | gl.useProgram(program)
61 | program.vertexPosAttrib = gl.getAttribLocation(program, 'attrVertex')
62 | program.offsetUniform = gl.getUniformLocation(program, 'uniformOffset')
63 | gl.enableVertexAttribArray(program.vertexPosArray)
64 | gl.vertexAttribPointer(program.vertexPosAttrib, vertexPosBuffer.itemSize, gl.FLOAT, !1, 0, 0)
65 | gl.uniform2f(program.offsetUniform, 1, 1)
66 | gl.drawArrays(gl.TRIANGLE_STRIP, 0, vertexPosBuffer.numItems)
67 | try {
68 | result.push(gl.canvas.toDataURL())
69 | } catch (e) {
70 | /* .toDataURL may be absent or broken (blocked by extension) */
71 | }
72 |
73 |
74 |
75 | return {
76 | hash: md5(result[0]),
77 | rawData: result[0]
78 | };
79 | }
80 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import Fingerprint2 from 'fingerprintjs2'
2 |
3 | import canvasFP from './core/canvasFP'
4 | import webglFp from './core/webglFP'
5 | import audioFP from './core/audioFP'
6 | import netFP from './core/netFP'
7 |
8 |
9 | function log(info) {
10 | let ele = document.createElement("p");
11 | ele.style.fontSize = "12px";
12 | ele.innerHTML = info;
13 | document.body.appendChild(ele)
14 | }
15 |
16 |
17 | // 记住需要延时一段时间之后再去获取浏览器的指纹,因为网页加载时候立即调用会偶发出现不准确的问题。
18 | // 500ms 延时是Fingerprint2推荐的做法
19 | setTimeout(function () {
20 | Fingerprint2.get(function (components) {
21 | console.log(components)
22 | });
23 |
24 |
25 | log("浏览器指纹组合实例:
");
26 | log("记住需要延时一段时间之后再去获取浏览器的指纹,因为网页加载时候立即调用会偶发出现不准确的问题。
");
27 | log("这个小栗子采用的源码来自 Fingerprint2 开源项目,傲天我只是将audio,webgl,canvas指纹相关的源代码拆分出来到单个文件中,方便读者学习每个指纹其内部的原理。
");
28 | log("同时我写了一篇 知乎文章 链接介绍了浏览器的属性检测话题
");
29 | log("记住如果你在产线环境使用指纹来辨别用户的唯一性,一定要知道这些指纹数据不是百分之百准确的!或者说不是百分之百唯一的!而且单个指纹发生碰撞的几率比较高。什么是碰撞?碰撞就是美国有个用户浏览器的canvas指纹与某个在中国的用户的canvas指纹是相同的。
")
30 |
31 | let canvasStartTime = + new Date();
32 | log("canvas fingerprint : " + canvasFP().hash);
33 | console.log(`canvas fp generate time ${+ new Date() - canvasStartTime} ms`);
34 |
35 | let webglStartTime = + new Date();
36 | log("webgl fingerprint : " + webglFp().hash);
37 | console.log(`webgl fp generate time ${+ new Date() - webglStartTime} ms`);
38 |
39 | let audioStartTime = + new Date();
40 | audioFP().then(({hash}) => {
41 | console.log(`audio generate time : ${+ new Date - audioStartTime } ms`)
42 | log("audio fingerprint : " + hash);
43 | })
44 | netFP().then(offer => {
45 | log("rtcpeerconnection offer", offer);
46 | })
47 | }, 500);
48 |
49 | //
50 | // var components = [
51 | // { key: 'userAgent', getData: UserAgent },
52 | // { key: 'webdriver', getData: webdriver },
53 | // { key: 'language', getData: languageKey },
54 | // { key: 'colorDepth', getData: colorDepthKey },
55 | // { key: 'deviceMemory', getData: deviceMemoryKey },
56 | // { key: 'pixelRatio', getData: pixelRatioKey },
57 | // { key: 'hardwareConcurrency', getData: hardwareConcurrencyKey },
58 | // { key: 'screenResolution', getData: screenResolutionKey },
59 | // { key: 'availableScreenResolution', getData: availableScreenResolutionKey },
60 | // { key: 'timezoneOffset', getData: timezoneOffset },
61 | // { key: 'timezone', getData: timezone },
62 | // { key: 'sessionStorage', getData: sessionStorageKey },
63 | // { key: 'localStorage', getData: localStorageKey },
64 | // { key: 'indexedDb', getData: indexedDbKey },
65 | // { key: 'addBehavior', getData: addBehaviorKey },
66 | // { key: 'openDatabase', getData: openDatabaseKey },
67 | // { key: 'cpuClass', getData: cpuClassKey },
68 | // { key: 'platform', getData: platformKey },
69 | // { key: 'doNotTrack', getData: doNotTrackKey },
70 | // { key: 'plugins', getData: pluginsComponent },
71 | // { key: 'canvas', getData: canvasKey },
72 | // { key: 'webgl', getData: webglKey },
73 | // { key: 'webglVendorAndRenderer', getData: webglVendorAndRendererKey },
74 | // { key: 'adBlock', getData: adBlockKey },
75 | // { key: 'hasLiedLanguages', getData: hasLiedLanguagesKey },
76 | // { key: 'hasLiedResolution', getData: hasLiedResolutionKey },
77 | // { key: 'hasLiedOs', getData: hasLiedOsKey },
78 | // { key: 'hasLiedBrowser', getData: hasLiedBrowserKey },
79 | // { key: 'touchSupport', getData: touchSupportKey },
80 | // { key: 'fonts', getData: jsFontsKey, pauseBefore: true },
81 | // { key: 'fontsFlash', getData: flashFontsKey, pauseBefore: true },
82 | // { key: 'audio', getData: audioKey },
83 | // { key: 'enumerateDevices', getData: enumerateDevicesKey }
84 | // ]
85 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack');
2 | const path = require('path');
3 | const HtmlWebpackPlugin = require('html-webpack-plugin');
4 |
5 | /*
6 | * SplitChunksPlugin is enabled by default and replaced
7 | * deprecated CommonsChunkPlugin. It automatically identifies modules which
8 | * should be splitted of chunk by heuristics using module duplication count and
9 | * module category (i. e. node_modules). And splits the chunks…
10 | *
11 | * It is safe to remove "splitChunks" from the generated configuration
12 | * and was added as an educational example.
13 | *
14 | * https://webpack.js.org/plugins/split-chunks-plugin/
15 | *
16 | */
17 |
18 | /*
19 | * We've enabled UglifyJSPlugin for you! This minifies your app
20 | * in order to load faster and run less javascript.
21 | *
22 | * https://github.com/webpack-contrib/uglifyjs-webpack-plugin
23 | *
24 | */
25 |
26 | const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
27 |
28 | module.exports = {
29 | module: {
30 | rules: [
31 | {
32 | include: [path.resolve(__dirname, 'src')],
33 | loader: 'babel-loader',
34 |
35 | options: {
36 | plugins: ['syntax-dynamic-import'],
37 |
38 | presets: [
39 | [
40 | '@babel/preset-env',
41 | {
42 | modules: false
43 | }
44 | ]
45 | ]
46 | },
47 |
48 | test: /\.js$/
49 | },
50 | {
51 | test: /\.(less|css)$/,
52 |
53 | use: [
54 | {
55 | loader: 'css-loader',
56 |
57 | options: {
58 | sourceMap: true
59 | }
60 | },
61 | {
62 | loader: 'less-loader',
63 |
64 | options: {
65 | sourceMap: true
66 | }
67 | }
68 | ]
69 | }
70 | ]
71 | },
72 |
73 | output: {
74 | chunkFilename: '[name].[chunkhash].js',
75 | filename: '[name].[chunkhash].js'
76 | },
77 |
78 | mode: 'development',
79 |
80 | plugins: [
81 | new HtmlWebpackPlugin({
82 | title: 'Development'
83 | })
84 | ],
85 |
86 | devServer: {
87 | contentBase: './dist',
88 | host: '0.0.0.0',
89 | https: true
90 | },
91 |
92 | optimization: {
93 | splitChunks: {
94 | cacheGroups: {
95 | vendors: {
96 | priority: -10,
97 | test: /[\\/]node_modules[\\/]/
98 | }
99 | },
100 |
101 | chunks: 'async',
102 | minChunks: 1,
103 | minSize: 30000,
104 | name: true
105 | }
106 | }
107 | };
108 |
--------------------------------------------------------------------------------