The magic word [web]

The magic word

Ask and you shall receive...that is as long as you use the magic word.


If we look at the source of the page we see the following javascript:

    var msg = document.getElementById("magic");
    setInterval(function() {
        if (magic.innerText == "please give flag") {
            fetch("/flag?msg=" + encodeURIComponent(msg.innerText))
                .then(res => res.text())
                .then(txt => magic.innerText = txt.split``.map(v => String.fromCharCode(v.charCodeAt(0) ^ 0xf)).join``);
    }, 1000);

We simply opened the Developer tools and changed the text of the magic element to please give flag, the javascript then will give us the flag.