mirror of
https://github.com/arkenfox/user.js.git
synced 2024-11-22 18:41:38 +01:00
Updated 4.2.1 User Scripts (markdown)
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/)
|
||||
|
||||
👀 To test if a userscript is fingerprintable in any way, use CanvasBlocker's [Detection Tests](https://canvasblocker.kkapsner.de/test/detectionTest.html)
|
||||
some scripts...
|
||||
|
||||
---
|
||||
|
||||
|
||||
### :small_orange_diamond: window.opener be gone
|
||||
|
||||
* 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
|
||||
* Works with: Greasemonkey | FireMonkey
|
||||
* Test: https://mathiasbynens.github.io/rel-noopener/
|
||||
|
||||
```js
|
||||
@ -41,38 +37,47 @@ if (window.opener !== null) {
|
||||
|
||||
### :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")
|
||||
|
||||
<details><summary>'Conceal history.length' userscript</summary><p>
|
||||
|
||||
* Author: [Thorin-Oakenpants](https://github.com/Thorin-Oakenpants)
|
||||
* Author: [earthlng](https://github.com/earthlng)
|
||||
* 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)
|
||||
|
||||
```js
|
||||
// ==UserScript==
|
||||
// @name Conceal history.length
|
||||
// @description Intercepts read access to history.length property
|
||||
// @namespace localhost
|
||||
// @include *
|
||||
// @name Conceal window.name
|
||||
// @version 2.0
|
||||
// @match http://*/*
|
||||
// @match https://*/*
|
||||
// @exclude /^https://www\.google\.com/recaptcha/api2/(?:anchor|frame)\?.+$/
|
||||
// @run-at document-start
|
||||
// @version 1.0.1
|
||||
// @grant none
|
||||
// @namespace ghacksuserjs
|
||||
// @grant GM.notification
|
||||
// ==/UserScript==
|
||||
|
||||
let _history={length:history.length};
|
||||
Object.defineProperty(history,'length',{
|
||||
get: function() {
|
||||
if (_history.length > 2) {
|
||||
return 2;
|
||||
} else {
|
||||
return _history.length;
|
||||
}
|
||||
}
|
||||
});
|
||||
const windowNames = new WeakMap();
|
||||
|
||||
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>
|
||||
|
||||
---
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user