Last active
May 2, 2024 12:32
-
-
Save Rawa/dcc636e45f95143a8ea65ba3ca366ae8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<html> | |
<script type="text/javascript"> | |
let makeId = function() { | |
var text = ""; | |
var possible = "abcdefghijklmnopqrstuvwxyz0123456789"; | |
for (var i = 0; i < 10; i++) | |
text += possible.charAt(Math.floor(Math.random() * possible.length)); | |
return text; | |
} | |
let session = makeId(); | |
var iteration = 0; | |
var fetchIterations = 0; | |
var successIterations = 0; | |
var failedIterations = 0; | |
let createUrl = function() { | |
let date = new Date().toISOString().replaceAll(':', '-').replace('.', '-').slice(11); | |
iteration++; | |
return "https://" + session + "-" + iteration + "-" + date + ".mullvad.test/"; | |
} | |
let updateText = function() { | |
document.getElementById("success").textContent = "Success " + successIterations; | |
document.getElementById("fetch").textContent = "Fetch: " + fetchIterations; | |
document.getElementById("failed").textContent = "Failed: " + failedIterations; | |
} | |
let makeFetch = function() { | |
let url = createUrl() | |
fetch(url, { | |
mode: 'no-cors' // 'cors' by default | |
}).then(function(data) { | |
successIterations++; | |
updateText(); | |
}).catch(function(err) { | |
failedIterations++; | |
updateText(); | |
}); | |
fetchIterations++; | |
updateText(); | |
} | |
let start = function() { | |
updateText() | |
setInterval(makeFetch, 30) | |
} | |
</script> | |
<body> | |
<button onclick="start()">Start</button> | |
<h1 id="fetch"></h1> | |
<h1 id="success"></h1> | |
<h1 id="failed"></h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment