Skip to content

Instantly share code, notes, and snippets.

@najlepsiwebdesigner
Created February 24, 2013 13:08
Show Gist options
  • Save najlepsiwebdesigner/5023781 to your computer and use it in GitHub Desktop.
Save najlepsiwebdesigner/5023781 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>
@sketchedgrey
Copy link

Where do we put the URL/Username of the account I want to attack?? I'm going to make a login and create a password that Brute Force will have trouble guessing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment