I don't know python, so I am trying to create something similar with javascript, which I only know the basics of. The program I am working on will not actually hack into anything, it just gives you an idea of how long it would take a computer to guess an unencrypted password that someone might use. It has the user enter a password, then use brute force to guess all possibilities for each character in the password, and then print out the time it took to guess.
I am not sure how to set up the function at the bottom so that it loops through all of the possible characters.
Should it look something like this?
var x =0
var y =0
while (Passlength>=x) {
if (y<Guesses.length) {
y++
}
if
(Passcode.charAt(x) != [y])
{
y++
}
x++
}
Or this?
for(var x=0;x<Passlength;x+=1){
for(var y=0;y<Guesses.length;y+=1){
if(Passcode.charAt(x) == Guesses[y]){
Passcode += [y];
If anyone knows javascript and could help me out, that would be fantastic! Here is what I have so far.
Code: Select all
var Passcode = prompt("Enter Password");
var Passlength = Passcode.length;
console.time ("GuessTime");
var Guesses = [ "e","a","r","o","n","i","s","t","l","c","d","m","h","u","b","g","p","y","1","k","f","w","2","v","j","3","z","0","x","4","5","9","6","7","8","q","E","A","R","O","N","I","S","T","L","C","D","M","H","U","B","G","P","Y","K","F","W","V","J","Z","X","Q","!","@","#","$","%","^","*","(",")","?","/","<",">","+","=","-","_",
];
for(var x=0;x<Passlength;x+=1){
for(var y=0;y<Guesses.length;y+=1){
if(Passcode.charAt(x) == Guesses[y]){
Passcode += [y];
}
}
}
document.write (console.timeEnd ("GuessTime"));