Skip to content

Instantly share code, notes, and snippets.

@revcozmo
Forked from najlepsiwebdesigner/bruteforce.html
Created February 4, 2018 00:19
Show Gist options
  • Select an option

  • Save revcozmo/6b1a6c21448d25b14d0596479dcd989f to your computer and use it in GitHub Desktop.

Select an option

Save revcozmo/6b1a6c21448d25b14d0596479dcd989f to your computer and use it in GitHub Desktop.
Javascript bruteforce password attack
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bruteforce!</title>
</head>
<body>
<script>
var password = '89p8zk',
passwordLength = 4,
alphabetLength = 36,
numberOfTries = 30000,
printAfter = 1000,
startFrom = 500000000;
count = Math.pow(passwordLength, alphabetLength);
document.write('<strong>Number of required tries in worst case:</strong> ' + count + '<br>');
document.write('<strong>Print every</strong> ' + printAfter + 'th try:' + '<br><br>');
var thing = [];
for (i = startFrom; i < (numberOfTries+startFrom); i++){
if (i % printAfter == 0){
thing.push("" + i.toString(alphabetLength) + " ");
}
if (password == i.toString(alphabetLength)){
alert('Found password on ' + i + 'th try! Here it is: ' + i.toString(alphabetLength));
}
}
document.write(thing.join(''));
document.write('<br><br>Last is: a' + i.toString(alphabetLength));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment