Created
May 17, 2021 22:17
-
-
Save l-portet/72a1d39fcb86a7fcd2054e5db6d06e79 to your computer and use it in GitHub Desktop.
Find all the custom properties created in the window object. Very useful to debug or reverse engineer a web app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
let results; | |
let currentWindow; | |
let customizedWindow = {}; | |
let iframe = document.createElement('iframe'); | |
iframe.style.display = 'none'; | |
document.body.appendChild(iframe); | |
currentWindow = Object.getOwnPropertyNames(window); | |
results = currentWindow.filter(function (prop) { | |
return !iframe.contentWindow.hasOwnProperty(prop); | |
}); | |
for (const result of results) { | |
customizedWindow[result] = window[result]; | |
} | |
console.log(results); | |
window.customizedWindow = customizedWindow; | |
console.log(customizedWindow); | |
document.body.removeChild(iframe); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment