Skip to content

Instantly share code, notes, and snippets.

@shugen002
Last active April 5, 2022 18:01
Show Gist options
  • Save shugen002/02cec60b5bd03e20c855950d46f62f38 to your computer and use it in GitHub Desktop.
Save shugen002/02cec60b5bd03e20c855950d46f62f38 to your computer and use it in GitHub Desktop.
try to take over the world!
// ==UserScript==
// @name try to take over the world!
// @version 0.3
// @description try to take over the world!
// @author You
// @match https://www.baidu.com/undefined
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
let getPN=Object.getOwnPropertyNames
let log=console.log
log(Object);
function clear(target,path='.',level=0){
if(level>10){
return ;
}
var list=getPN(target)
list.forEach((e)=>{
try{
try{
if(e.constructor){
clear(e.constructor,path+e+".constructor.",level+1)
}
}catch(er){
}
try{
if(e.prototype){
clear(e.prototype,path+e+".prototype.",level+1)
}
}catch(er){
}
//log(path+e)
delete target[e]
}catch(er){
try{
if(e=="location")return
target[e]=void 0;
}catch(er){
try{
clear(target[e],path+e+".",level+1);
}catch(er){
}
}
}
})
}
clear(window)
clear((function(){}).constructor)
clear((async function(){})().constructor)
clear([].constructor)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment