Behavioral Obfuscator

Anti-Fingerprinting Timing & Scroll Protection - Introduces randomized timing jitter to prevent fingerprinting via scroll and typing patterns without affecting UX.

  1. // ==UserScript==
  2. // @name Behavioral Obfuscator
  3. // @version 0.1.0
  4. // @description Anti-Fingerprinting Timing & Scroll Protection - Introduces randomized timing jitter to prevent fingerprinting via scroll and typing patterns without affecting UX.
  5. // @author PolyMegos (https://github.com/polymegos)
  6. // @namespace https://github.com/polymegos/behavioral-obfuscator
  7. // @supportURL https://github.com/polymegos/behavioral-obfuscator/issues
  8. // @license MIT
  9. // @match *://*/*
  10. // @run-at document-start
  11. // @grant none
  12. // @compatible chrome
  13. // @compatible firefox
  14. // @compatible opera
  15. // @compatible edge
  16. // @compatible safari
  17. // ==/UserScript==
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. // Small-range subtle jitter generation
  23. function generateJitter(range) {
  24. return (Math.random() * 2 - 1) * range;
  25. }
  26.  
  27. // Apply typing jitter only when a keys are pressed
  28. let typingTimer = null;
  29. window.addEventListener('keydown', (e) => {
  30. if (typingTimer) clearTimeout(typingTimer);
  31. // Some small delay before processing key event
  32. typingTimer = setTimeout(() => {
  33. const delay = Math.random() * 40 + Math.random() * 40; // 0-80ms delay for typing
  34. e.preventDefault();
  35. setTimeout(() => {
  36. // Simulate the keypress after random delay
  37. document.dispatchEvent(new KeyboardEvent('keydown', {
  38. key: e.key,
  39. code: e.code,
  40. keyCode: e.keyCode,
  41. which: e.which
  42. }));
  43. }, delay);
  44. }, 5); // Prefix with tiny added initial delay before simulating keypress
  45. });
  46.  
  47. // Apply scroll delay jitter only when user actually scrolls
  48. let lastScrollTime = 0;
  49. window.addEventListener('scroll', () => {
  50. const now = performance.now();
  51. const delay = Math.random() * 75 + Math.random() * 75; // 0-150ms delay between scrolls
  52. // Add small jitter to scroll position when the user scrolls
  53. if (now - lastScrollTime < delay) return; // Don't interrupt if scrolling too fast
  54. lastScrollTime = now;
  55. let scrollX = window.scrollX;
  56. let scrollY = window.scrollY;
  57. // Add small jitter to scroll position (1-2 pixels offset)
  58. const noiseX = generateJitter(2);
  59. const noiseY = generateJitter(2);
  60. window.scrollTo(scrollX + noiseX, scrollY + noiseY);
  61. }, { passive: true });
  62.  
  63. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址