antibot - basic pow with javascript

This commit is contained in:
bunkerity
2021-05-19 17:36:29 +02:00
parent 16e5ede130
commit 6645632846
3 changed files with 19 additions and 8 deletions

View File

@@ -7,7 +7,15 @@
return hashHex;
}
(async () => {
const digestHex = await digestMessage('%s');
const nonce = '%s';
var i = 0;
while (true) {
var digestHex = await digestMessage(nonce + i.toString());
if (digestHex.startsWith("0000")) {
break;
}
i++;
}
xhr = new XMLHttpRequest();
xhr.open('POST', '%s');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
@@ -16,6 +24,6 @@
window.location.replace('%s');
}
};
xhr.send(encodeURI('challenge=' + digestHex));
xhr.send(encodeURI('challenge=' + i.toString()));
})();
</script>