28 lines
983 B
JavaScript
28 lines
983 B
JavaScript
|
function httpGet(theUrl, elem) {
|
||
|
function reqListener() {
|
||
|
let res = this.responseText
|
||
|
if(res === "wrong"){
|
||
|
alert("Nope, sorry. This is the wrong key!")
|
||
|
}else if(res === "nope" || res === "missing"){
|
||
|
alert(`Could you send a message to J00LZ##9386 on Discord with the challenge name, he apparently misconfigured this... (${res})`)
|
||
|
}else if(res === "ok"){
|
||
|
alert("Good job! You solved the challenge!")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var oReq = new XMLHttpRequest();
|
||
|
oReq.addEventListener("load", reqListener);
|
||
|
oReq.open("GET", theUrl);
|
||
|
oReq.send();
|
||
|
}
|
||
|
|
||
|
function check(challenge, elem) {
|
||
|
flag = document.querySelector(`input#${elem}`).value
|
||
|
flagExp = flag.match(/(?:flag)\{([\w]+)\}/i)
|
||
|
if(flagExp == null || flagExp == undefined){
|
||
|
alert("That isn't even a flag?")
|
||
|
return
|
||
|
}
|
||
|
console.log(flagExp)
|
||
|
httpGet(`https://challengeverify.voidcorp.nl/${challenge}/${flagExp[1]}`, elem)
|
||
|
}
|