Updated 4.2.1 User Scripts (markdown)

Thorin-Oakenpants 2020-01-13 00:43:47 +00:00
parent c73c491848
commit c3cb290266

@ -1,15 +1,11 @@
We recommend [Violentmonkey](https://addons.mozilla.org/firefox/addon/violentmonkey/), [Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) or [FireMonkey](https://addons.mozilla.org/firefox/addon/firemonkey/) some scripts...
👀 To test if a userscript is fingerprintable in any way, use CanvasBlocker's [Detection Tests](https://canvasblocker.kkapsner.de/test/detectionTest.html)
--- ---
### :small_orange_diamond: window.opener be gone ### :small_orange_diamond: window.opener be gone
* Author: [earthlng](https://github.com/earthlng) * Author: [earthlng](https://github.com/earthlng)
* Description: See [this](https://www.ghacks.net/2017/01/24/web-security-add-relnoopener-to-external-links/) ghacks article about rel=noopener * Description: See [this](https://www.ghacks.net/2017/01/24/web-security-add-relnoopener-to-external-links/) ghacks article about rel=noopener
* Works with: Greasemonkey | FireMonkey
* Test: https://mathiasbynens.github.io/rel-noopener/ * Test: https://mathiasbynens.github.io/rel-noopener/
```js ```js
@ -41,38 +37,47 @@ if (window.opener !== null) {
### :small_orange_diamond: Conceal history.length ### :small_orange_diamond: Conceal history.length
👼 Don't use this. If required (it's debatable if it really achieves anything), use [CanvasBlocker](https://addons.mozilla.org/en-US/firefox/addon/canvasblocker/), which supports `history.length` spoofing without leaking the custom function (see "History API") * Author: [earthlng](https://github.com/earthlng)
<details><summary>'Conceal history.length' userscript</summary><p>
* Author: [Thorin-Oakenpants](https://github.com/Thorin-Oakenpants)
* Description: This does not break history in any way. It just lies to any JS asking about it * Description: This does not break history in any way. It just lies to any JS asking about it
* Test: [BrowserSpy.dk](https://browserspy.dk/document.php) * Test: [BrowserSpy.dk](https://browserspy.dk/document.php)
```js ```js
// ==UserScript== // ==UserScript==
// @name Conceal history.length // @name Conceal window.name
// @description Intercepts read access to history.length property // @version 2.0
// @namespace localhost // @match http://*/*
// @include * // @match https://*/*
// @exclude /^https://www\.google\.com/recaptcha/api2/(?:anchor|frame)\?.+$/
// @run-at document-start // @run-at document-start
// @version 1.0.1 // @namespace ghacksuserjs
// @grant none // @grant GM.notification
// ==/UserScript== // ==/UserScript==
let _history={length:history.length}; const windowNames = new WeakMap();
Object.defineProperty(history,'length',{
get: function() {
if (_history.length > 2) {
return 2;
} else {
return _history.length;
}
}
});
const unsafeWindow = window.wrappedJSObject;
const descriptor = Object.getOwnPropertyDescriptor(unsafeWindow, 'name');
const originalget = descriptor.get;
const originalset = descriptor.set;
const fakeobj = {
get name() {
const originalName = originalget.apply(this);
const returnedName = windowNames.get(window) || '';
if (originalName !== returnedName)
GM.notification('Intercepted read access to window.name "'+originalName+'" from '+window.location);
return returnedName;
},
set name(newname) {
originalset.apply(this, window.Array.from(arguments));
windowNames.set(window, newname);
}
};
descriptor.get = exportFunction(Object.getOwnPropertyDescriptor(fakeobj, 'name').get, window);
descriptor.set = exportFunction(Object.getOwnPropertyDescriptor(fakeobj, 'name').set, window);
Reflect.defineProperty(unsafeWindow, 'name', descriptor);
``` ```
</p></details>
--- ---