mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-03-03 14:52:34 +01:00
Detection over navigator and DOMRect getters was possible
This commit is contained in:
parent
79a9034051
commit
e0dda5ec0f
@ -170,8 +170,8 @@
|
||||
],
|
||||
name: property,
|
||||
getterGenerator: function(){
|
||||
const temp = {
|
||||
get [property](){
|
||||
const temp = eval(`({
|
||||
get ${property}(){
|
||||
const registration = getDOMRectRegistration(this);
|
||||
if (registration){
|
||||
return getFakeDomRect(
|
||||
@ -179,24 +179,24 @@
|
||||
this,
|
||||
registration.prefs,
|
||||
registration.notify
|
||||
)[property];
|
||||
).${property};
|
||||
}
|
||||
return this[property];
|
||||
return this.${property};
|
||||
}
|
||||
};
|
||||
})`);
|
||||
return Object.getOwnPropertyDescriptor(temp, property).get;
|
||||
}
|
||||
};
|
||||
if (!readonly){
|
||||
changedGetter.setterGenerator = function(window, original, prefs){
|
||||
const temp = {
|
||||
set [property](newValue){
|
||||
const temp = eval(`({
|
||||
set ${property}(newValue){
|
||||
const registration = getDOMRectRegistration(this);
|
||||
if (registration){
|
||||
const fakeDomRect = getFakeDomRect(window, this, prefs, registration.notify);
|
||||
registeredRects.delete(getWrapped(this));
|
||||
["x", "y", "width", "height"].forEach((prop) => {
|
||||
if (prop === property){
|
||||
if (prop === "${property}"){
|
||||
this[prop] = newValue;
|
||||
}
|
||||
else {
|
||||
@ -208,7 +208,7 @@
|
||||
original.apply(this, window.Array.from(arguments));
|
||||
}
|
||||
}
|
||||
};
|
||||
})`);
|
||||
return Object.getOwnPropertyDescriptor(temp, property).set;
|
||||
};
|
||||
}
|
||||
|
@ -20,19 +20,19 @@
|
||||
objectGetters: [function(window){return window.Navigator && window.Navigator.prototype;}],
|
||||
name: property,
|
||||
getterGenerator: function(checker){
|
||||
const temp = {
|
||||
get [property](){
|
||||
const temp = eval(`({
|
||||
get ${property}(){
|
||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {prefs, notify, window, original} = check;
|
||||
const originalValue = original.apply(this, window.Array.from(args));
|
||||
const returnValue = navigator.getNavigatorValue(property);
|
||||
const returnValue = navigator.getNavigatorValue("${property}");
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedNavigatorReadout");
|
||||
}
|
||||
return returnValue;
|
||||
});
|
||||
}
|
||||
};
|
||||
})`);
|
||||
return Object.getOwnPropertyDescriptor(temp, property).get;
|
||||
}
|
||||
};
|
||||
|
@ -24,6 +24,7 @@ Version 0.5.9:
|
||||
- improved DOMRect performance
|
||||
- improved general performance when stack list is disabled
|
||||
- preventing double interception (increased performance and reduced detectability)
|
||||
- detection over navigator and DOMRect getters was possible
|
||||
|
||||
known issues:
|
||||
- if a data URL is blocked the page action button does not appear
|
||||
|
@ -106,6 +106,7 @@ addTest("function code", function(log){
|
||||
}
|
||||
return false;
|
||||
}
|
||||
log("canvas functions");
|
||||
codeDetected = checkFunctionCode(
|
||||
CanvasRenderingContext2D.prototype.getImageData,
|
||||
"getImageData"
|
||||
@ -114,10 +115,12 @@ addTest("function code", function(log){
|
||||
HTMLCanvasElement.prototype.toDataURL,
|
||||
"toDataURL"
|
||||
) || codeDetected;
|
||||
log("history getter");
|
||||
codeDetected = checkFunctionCode(
|
||||
history.__lookupGetter__("length"),
|
||||
"(get )?length"
|
||||
) || codeDetected;
|
||||
log("window getters");
|
||||
codeDetected = checkFunctionCode(
|
||||
window.__lookupGetter__("name"),
|
||||
"(get )?name"
|
||||
@ -126,6 +129,22 @@ addTest("function code", function(log){
|
||||
window.__lookupSetter__("name"),
|
||||
"(set )?name"
|
||||
) || codeDetected;
|
||||
log("navigator getters");
|
||||
Object.keys(navigator.__proto__).forEach(function(property){
|
||||
if (typeof navigator[property] === "string"){
|
||||
codeDetected = checkFunctionCode(
|
||||
navigator.__proto__.__lookupGetter__(property),
|
||||
"(get )?" + property
|
||||
) || codeDetected;
|
||||
}
|
||||
});
|
||||
log("DOMRect getters");
|
||||
["x", "y", "height", "width"].forEach(function(property){
|
||||
codeDetected = checkFunctionCode(
|
||||
DOMRect.prototype.__lookupGetter__(property),
|
||||
"(get )?" + property
|
||||
) || codeDetected;
|
||||
});
|
||||
return codeDetected;
|
||||
});
|
||||
addTest("toString modified", function(log){
|
||||
|
Loading…
x
Reference in New Issue
Block a user