Facebook
From Kia, 7 Months ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 221
  1. // ==UserScript==
  2. // @name        Soft98 - Gigachad
  3. // @namespace   Violentmonkey Scripts
  4. // @match       http://*.soft98.ir/*
  5. // @match       https://*.soft98.ir/*
  6. // @grant       none
  7. // @version     1.0
  8. // @author      -
  9. // @description 10/18/2023, 10:33:07 AM
  10. // @run-at      document-start
  11. // ==/UserScript==
  12.  
  13.  
  14. (function() {
  15.   'use strict';
  16.  
  17.   const safe = {
  18.     'log': window.console.log.bind(console),
  19.     'getPropertyValue': CSSStyleDeclaration.prototype.getPropertyValue,
  20.     'setAttribute': Element.prototype.setAttribute,
  21.     'getAttribute': Element.prototype.getAttribute,
  22.     'appendChild': Element.prototype.appendChild,
  23.     'remove': Element.prototype.remove,
  24.     'cloneNode': Element.prototype.cloneNode,
  25.     'Element_attributes': Object.getOwnPropertyDescriptor(Element.prototype, 'attributes').get,
  26.     'Array_splice': Array.prototype.splice,
  27.     'Array_join': Array.prototype.join,
  28.     'createElement': document.createElement,
  29.     'getComputedStyle': window.getComputedStyle,
  30.     'Reflect': Reflect,
  31.     'Proxy': Proxy,
  32.     'crypto': window.crypto,
  33.     'Uint8Array': Uint8Array,
  34.     'Object_defineProperty': Object.defineProperty.bind(Object),
  35.     'Object_getOwnPropertyDescriptor': Object.getOwnPropertyDescriptor.bind(Object),
  36.     'String_replace': String.prototype.replace,
  37.   };
  38.   const getRandomValues = safe.crypto.getRandomValues.bind(safe.crypto);
  39.  
  40.   const genericGet = function(target, thisArg, args) {
  41.     if (thisArg === 'toString') {
  42.       return target.toString.bind(target)
  43.     };
  44.     return safe.Reflect.get(target, thisArg, args)
  45.   };
  46.  
  47.   const generateID = function(len) {
  48.     const dec2hex = function(dec) {
  49.       return dec.toString(16).padStart(2, '0')
  50.     };
  51.     const arr = new safe.Uint8Array((len || 40) / 2);
  52.     getRandomValues(arr);
  53.     const result = safe.String_replace.call(safe.Array_join.call(Array.from(arr, dec2hex), ''), /^\d+/g, '');
  54.     if (result.length < 3) {
  55.       return generateID(len);
  56.     };
  57.     return result;
  58.   };
  59.  
  60.   const randomName = generateID(15);
  61.    window.Mutati safe.Proxy(window.MutationObserver, {
  62.     construct: function(target, args) {
  63.       const callback = args[0];
  64.       const proxiedCallback = function(mutations, observer) {
  65.         for (let len = mutations.length, i = len - 1; i >= 0; --i) {
  66.           const mutation = mutations[i];
  67.           if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
  68.             const nodes = mutation.addedNodes;
  69.             for (let j = 0, len2 = nodes.length; j < len2; ++j) {
  70.               const node = nodes[j];
  71.               if (node.localName === randomName) {
  72.                 safe.Array_splice.call(mutations, i, 1);
  73.                 break;
  74.               }
  75.             }
  76.           }
  77.         };
  78.         if (mutations.length !== 0) {
  79.           callback(mutations, observer);
  80.         };
  81.       };
  82.       args[0] = proxiedCallback;
  83.       const observer = safe.Reflect.construct(target, args);
  84.       return observer
  85.     },
  86.     get: genericGet
  87.   });
  88.  
  89.    window.getComputed safe.Proxy(window.getComputedStyle, {
  90.     apply(target, thisArg, args) {
  91.        let  thisArg, args);
  92.       if (safe.getPropertyValue.call(style, 'clip-path') === 'none') {
  93.         return style;
  94.       };
  95.       const node = args[0];
  96.        const cl randomName);
  97.       safe.setAttribute.call(clonedNode, 'class', safe.getAttribute.call(node, 'class'));
  98.       safe.setAttribute.call(clonedNode, 'id', safe.getAttribute.call(node, 'id'));
  99.       safe.setAttribute.call(clonedNode, 'style', safe.getAttribute.call(node, 'style'));
  100.       safe.appendChild.call(document.body, clonedNode);
  101.       const value = safe.getPropertyValue.call(safe.getComputedStyle.call(window, clonedNode), 'clip-path');
  102.       safe.remove.call(clonedNode);
  103.  
  104.       //safe.log(safe.Object_getOwnPropertyDescriptor(style, 'clipPath'));
  105.       /*safe.Object_defineProperty(style, 'clipPath', {
  106.         get: function() {
  107.           return value;
  108.         }
  109.       });*/
  110.       // https://palant.info/2020/12/10/how-anti-fingerprinting-extensions-tend-to-make-fingerprinting-easier/#barking-the-wrong-tree
  111.       safe.Object_defineProperty(style, 'clipPath', {
  112.         get: (() => value).bind(null)
  113.       });
  114.       //safe.log(safe.Object_getOwnPropertyDescriptor(style, 'clipPath'));
  115.  
  116.  
  117.       style.getPropertyValue = new safe.Proxy(style.getPropertyValue, {
  118.         apply(target, thisArg, args) {
  119.           if (args[0] !== 'clip-path') {
  120.             return safe.Reflect.apply(target, thisArg, args)
  121.           };
  122.           return value;
  123.         },
  124.         get: genericGet
  125.       });
  126.  
  127.       return style;
  128.     },
  129.     get: genericGet
  130.   });
  131.  
  132. })();