I am trying to write a kind of brute force script in javascript! This is what I have so far:
var charset = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j,", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
function bruteForce() {
var password = document.getElementById("enteredPassword").value;
var crackedPassword = "";
while (true) {
if (crackedPassword != password) {
for (int i; i < charset.lenght; i++) {
crackedPassword += charset[i];
document.getElementById("currentPassword").value = crackedPassword;
}
} else {
document.getElementById("currentPassword").value = crackedPassword;
alert("finished");
}
}
}
It gives me the following error: Uncaught SyntaxError: Unexpected identifier
the line causing the problem:
for(int i = 0; i < charset.lenght; i++){
And: Uncaught ReferenceError: bruteForce is not defined
line: <input onClick = "bruteForce()" name="input" type="image" src="arrow.jpg" align="right" />
I thing it has to do with that crackedPassword += charset[i];
But what I saw here, confused me, because there has to be another cause!