1var BitFire = (function() { 2 3 var version = 5000; 4 5function bf_time_stamp() { 6 return Math.floor(Date.now() / 1000); 7} 8 9function bf_new_page() { 10 return {"page": window.location.href, "t": bf_time_stamp(), "n": "page"}; 11} 12 13function bf_new_click(x) { 14 let v = ""; 15 let type = ""; 16 if (x.target && x.target.nodeName) { 17 type = x.target.nodeName; 18 if (x.target.nodeName == "INPUT") { 19 v = (x.target.type == "checkbox") ? x.target.checked : x.target.value; 20 } else if (x.target.nodeName == "SELECT") { 21 v = x.target.value; 22 } else if (x.target.nodeName == "A") { 23 v = x.target.href; 24 } else if (x.target.nodeName == "BUTTON") { 25 v = x.target.innerText; 26 } 27 } 28 return ({"n":"click", "t": bf_time_stamp(), "scroll": window.scrollY, "type": type, "x": window.pageXOffset + x.pageX, "y": window.pageYOffset + x.pageY, "v": v}); 29} 30 31function bf_key_time() { 32 if (!bf_key_time.last_time) { 33 bf_key_time.last_time = Date.now(); 34 bf_key_time.rates = []; 35 bf_key_time.ctr = 0 36 return; 37 } else { 38 bf_key_time.this_time = Date.now(); 39 if (bf_key_time.this_time - bf_key_time.last_time < 2000) { 40 bf_key_time.ctr++; 41 } else { 42 bf_key_time.rates.push(bf_key_time.ctr); 43 bf_key_time.ctr = 0; 44 bf_key_time.last_time = bf_key_time.this_time; 45 } 46 } 47} 48function getPosition(el) { 49 var xPosition = 0; 50 var yPosition = 0; 51 52 while (el) { 53 if (el.tagName == "BODY") { 54 // deal with browser quirks with body/window/document and page scroll 55 var xScrollPos = el.scrollLeft || document.documentElement.scrollLeft; 56 var yScrollPos = el.scrollTop || document.documentElement.scrollTop; 57 58 xPosition += (el.offsetLeft - xScrollPos + el.clientLeft); 59 yPosition += (el.offsetTop - yScrollPos + el.clientTop); 60 } else { 61 xPosition += (el.offsetLeft - el.scrollLeft + el.clientLeft); 62 yPosition += (el.offsetTop - el.scrollTop + el.clientTop); 63 } 64 65 el = el.offsetParent; 66 } 67 return { 68 x: xPosition, 69 y: yPosition 70 }; 71} 72 73function bf_clicks(event) { 74 //console.log(event); 75 if (!bf_clicks.clicks) { 76 bf_clicks.clicks = []; 77 } 78 let r = event.target.getBoundingClientRect(); 79 let w = event.target.innerWidth; 80 let h = event.target.innerHeight; 81 82 let pos = getPosition(event.target); 83 /* 84 bf_clicks.clicks.push({ 85 "absx":pos.x, 86 "absy":pos.y, 87 "x": event.clientX, 88 "y": event.clientY, 89 "w": event.target.innerWidth, 90 "h": event.target.innerHeight, 91 "t": Date.now(), 92 "n": event.target.tagName, 93 "i": event.target.id, 94 }); 95 */ 96 bf_clicks.clicks.push([ 97 pos.x, 98 pos.y, 99 event.clientX, 100 event.clientY, 101 event.target.innerWidth, 102 event.target.innerHeight, 103 Date.now(), 104 event.target.tagName, 105 event.target.id, 106 ]); 107 108 //bf_clicks.clicks.push({event.clientX + pos.x, event.clientY + pos.y, , Date.now()]); 109} 110 111function bf_scroll() { 112 if (!bf_scroll.last_time) { 113 bf_scroll.last_time = Date.now(); 114 bf_scroll.positions = []; 115 bf_scroll.position = 0 116 return; 117 } else { 118 bf_scroll.this_time = Date.now(); 119 if (bf_scroll.this_time - bf_scroll.last_time < 2000) { 120 bf_scroll.position = window.scrollY; 121 } else { 122 bf_scroll.positions.push(bf_scroll.position); 123 bf_scroll.position = 0; 124 bf_scroll.last_time = bf_scroll.this_time; 125 } 126 } 127} 128 129function vector_to_byte(velocity_x, velocity_y) { 130 let x = Math.min(velocity_x * 0.092, 46); 131 let y = Math.min(velocity_y * 0.092, 46); 132 133 let xc = Math.min(Math.max(79+x, 33), 126); 134 let yc = Math.min(Math.max(79+y, 33), 126); 135 136 return String.fromCharCode(xc) + String.fromCharCode(yc); 137} 138 139function bf_mouse(event) { 140 if (!bf_mouse.last_time) { 141 bf_mouse.moves = ""; 142 bf_mouse.pos = [] 143 bf_mouse.last_pos = [event.screenX, event.screenY]; 144 //console.log("first", bf_mouse.last_pos); 145 bf_mouse.last_time = Date.now(); 146 } else { 147 var from = event.relatedTarget || event.toElement; 148 //console.log(event, from); 149 if (event.relatedTarget) { console.log("TARGET: ", event.relatedTarget); } 150 if (Date.now() - bf_mouse.last_time > 100) { 151 window.clearTimeout(window.BF_LAST); 152 let vector = [event.movementX, event.movementY]; 153 let velocity = Math.abs(vector[0]) + Math.abs(vector[1]); 154 if (velocity > 10) { 155 bf_mouse.moves += vector_to_byte(vector[0], vector[1]); 156 bf_mouse.pos.push([(vector[0] - bf_mouse.last_pos[0]) + (vector[1] - bf_mouse.last_pos[1])])
157 if (bf_mouse.moves.length > 256) { 158 bf_mouse.moves = bf_mouse.moves.slice(-250); 159 bf_mouse.pos = bf_mouse.pos.slice(-250); 160 } 161 bf_mouse.last_pos = vector; 162 } 163 bf_mouse.last_time = Date.now(); 164 window.BF_LAST = window.setTimeout(function() { 165 }, 250) 166 } 167 } 168} 169 170 171 172//window.addEventListener('DOMContentLoaded', (event) => { 173window.addEventListener('never_execute', (event) => { 174 /* 175 var t = sessionStorage.getItem("bitfire_page"); 176 if (!t) { p = 0;} 177 else { p = (parseInt(t) + 1) % 10; } 178 console.log("page p", p); 179 //sessionStorage.setItem("bitfire_page", p); 180 //sessionStorage.setItem("bitfire"+p, JSON.stringify([bf_new_page()])); 181 */ 182 183 document.addEventListener("keydown", bf_key_time); 184 document.addEventListener("click", bf_clicks); 185 document.addEventListener("scroll", bf_scroll); 186 document.addEventListener("mousemove", bf_mouse); 187 document.addEventListener("mouseleave", function() { 188 bf_mouse.moves += " M"; 189 bf_mouse.pos.push("0"); 190 }); 191 192 //console.log("event listeners 1"); 193 /* 194 document.addEventListener("scroll", function() { 195 if (!window.BF_EVT) { 196 window.BF_EVT = window.setTimeout(function() { 197 if (window.BF_SCROLL == window.scrollY) { 198 events.push({"n":"scr", "t": bf_time_stamp(), "scroll": window.scrollY}); 199 } 200 }, 1500); 201 window.BF_SCROLL = window.screenY; 202 } 203 }); 204 205 /* 206 function(x) { 207 let raw = sessionStorage.getItem("bitfire"+p); 208 let events = JSON.parse(raw); 209 events.push(bf_new_click(x)); 210 sessionStorage.setItem("bitfire"+p, JSON.stringify(events)); 211 }); 212 */ 213 document.addEventListener("visibilitychange", function(event) { 214 //console.log(event.target); 215 //let raw = sessionStorage.getItem("bitfire"+p); 216 //let events = JSON.parse(raw); 217 //events.push({"n":"vis", "t": bf_time_stamp(), "scroll": window.scrollY, "type": document.visibilityState}); 218 //sessionStorage.setItem("bitfire"+p, JSON.stringify(events)); 219 let type = document.visibilityState.substring(0,1); 220 bf_mouse.moves += " " + type; 221 222 if (document.visibilityState == "hidden") { 223 //console.log("VIS!"); 224 const data = new FormData(); 225 data.append("clicks", bf_clicks.clicks); 226 data.append("scrolls", bf_scroll.positions); 227 data.append("keys", bf_key_time.rates); 228 data.append("mouse", bf_mouse.moves); 229 data.append("width", window.innerWidth); 230 data.append("height", window.innerHeight); 231 navigator.sendBeacon("/bitfire-beacon.php", data); 232 } 233 }); 234 //console.log("event listeners"); 235}); 236 237function bt_fnt() { 238 let { fnts } = document; 239 const it = fnts.entries(); 240 241 let arr = []; 242 let done = false; 243 244 while (!done) { 245 const font = it.next(); 246 if (!font.done) { 247 arr.push(font.value[0]); 248 } else { 249 done = font.done; 250 } 251 } 252 253 return arr; 254} 255 256function bf_web_gl() { 257 var canvas = document.createElement("canvas"); 258 var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); 259 return gl ? gl.getParameter(gl.VENDOR) : "Deprecated Browser"; 260} 261 262function bf_head() { 263 navigator.permissions.query({name:'notifications'}).then(function(permissionStatus) { 264 if(Notification.permission === 'denied' && permissionStatus.state === 'prompt') { 265 return true; 266 } 267 return false; 268 }); 269} 270 271// calculate a 32bit fletcher sum on a string 272function bf_fletcher32(str) { 273 let sum1 = 0xffff, sum2 = 0xffff; 274 for (let i = 0, l = str.length; i < l; i++) { 275 let c = str.charCodeAt(i); 276 sum1 += c; 277 sum2 += sum1; 278 } 279 sum1 = (sum1 & 0xffff) + (sum1 >>> 16); 280 sum2 = (sum2 & 0xffff) + (sum2 >>> 16); 281 return sum2 << 16 | sum1; 282} 283 284 285function bf_info() { 286 let a = navigator.webdriver ? 1 : 0; 287 let d = document.$cdc_asdjflasutopfhvcZLmcfl_ ? 1 : 0; 288 let p = navigator.userAgent.includes(navigator.platform) ? 1 : 0; 289 let o = new Date().getTimezoneOffset(); 290 let f = bt_fnt(); 291 let u = navigator.plugins; 292 let g = bf_web_gl(); 293 let j = eval.toString().length; 294 let sum = bf_fletcher32(navigator.userAgent + a + d + p + o + f + u + g + j); 295 return {a, d, p, o, f, u, g, j, sum}; 296} 297 298return { 299 xhr: function (data) { 300 /* 301 const form = document.createElement('form'); form.method = "POST"; form.action = window.location.href; 302 for (const key in params) { 303 if (params.hasOwnProperty(key)) { 304 const field = document.createElement('input'); 305 field.type = 'hidden'; field.name = key; 306 field.value = params[key]; form.appendChild(field); 307 } 308 } 309 310 document.body.appendChild(form); 311 form.submit(); 312 */ 313 console.log(window.BitFire); 314 if (window.fetch) { 315 let params = {}; 316 params.method = "POST"; 317 params.mode = "same-origin"; 318 params.credentials = "same-origin"; 319 params.redirect = "follow"; 320 params.body = JSON.stringify(data); 321 fetch(window.BitFire['U'], params); 322 } 323 324 /* 325 if (navigator.sendBeacon && window.BitFire) { 326 let data = new FormData(); 327 data.append('fingerprint', window.BitFire['F1']); 328 data.append('fingerprint2', window.BitFire['F2']); 329 data.append('browser', window.BitFire['B']); 330 data.append('type', 'verify');
331 data.append('style', 'bitfire'); 332 data.append('ver', window.BitFire['V']); 333 navigator.sendBeacon("https://bitfire.co/ray.php", data); 334 } 335 */ 336 } 337}; 338 339})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.