I'm creating an XSS challenge and, if the user can show the alert() direcly in the page he can get the flag (password) to validate the challenge.
I have a problem, my code returns a console.log("password") so I obfuscated it but if the user go to the console of his browser and write "alert();", he will get the password of the challenge directly without finding by own.
My code is :
(function(proxy) {
window.alert = function() {
console.log("PasswordOfTheChallenge");
return proxy.apply(this, arguments);
};
})(window.alert);
I'm using https://obfuscator.io/ to obfuscate my code.
So is it possible to detect, if the alert() provides from the page direcly or if it's providing of the browser console direcly ?
PS: even if my code is obfscated, I still can input alert() int the browser console and the console.log() will retrun me the good password (readable).