fix: anti-detection

This commit is contained in:
Xmader 2020-11-06 13:43:56 -05:00
parent 33d53b73eb
commit a583f52a5e
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
1 changed files with 10 additions and 2 deletions

View File

@ -53,14 +53,22 @@ export const hideFromArrFilter = (() => {
const qsaHook = (_fn) => {
return function (...args) {
const arr = _fn.apply(this, args)
const nodes = _fn.apply(this, args)
const results = Array.prototype.filter.call(nodes, (e) => !l.has(e))
// convert back to a NodeList/HTMLCollection instead of an Array
Object.setPrototypeOf(results, Object.getPrototypeOf(nodes))
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Array.prototype.filter.call(arr, (e) => !l.has(e))
return results
}
}
hookNative(Element.prototype, 'querySelectorAll', qsaHook)
hookNative(document, 'querySelectorAll', qsaHook)
hookNative(Element.prototype, 'getElementsByClassName', qsaHook)
hookNative(document, 'getElementsByClassName', qsaHook)
return (item: any) => {
l.add(item)
}