import java.util.Arrays;
public class BruteForce
{
public static void main(String[] args)
{
//String password = "pass";
char[] charset = "abcdefghijklmnopqrstuvwxyz".toCharArray();
BruteForce bf = new BruteForce(charset, 1);
Boolean checked=false;
String attempt = bf.toString();
while (true)
{
if(attempt.length()>3)
{
attempt=bf.toString();
if(!(attempt.contains("xx")|| attempt.contains("ww")|| attempt.contains("zz")|| attempt.contains("qq")|| attempt.contains("vv")))
{
char[] ch = new char[attempt.length()] ;
ch=attempt.toCharArray();
for(int i=0;i<=attempt.length()-3;i++)
{
if((ch[i]=='a'||ch[i]=='e'||ch[i]=='i'||ch[i]=='o'||ch[i]=='u'||ch[i]=='y') || (ch[i+1]=='a'||ch[i+1]=='e'||ch[i+1]=='i'||ch[i+1]=='o'||ch[i+1]=='u'||ch[i+1]=='y') || (ch[i+2]=='a'||ch[i+2]=='e'||ch[i+2]=='i'||ch[i+2]=='o'||ch[i+2]=='u'||ch[i+2]=='y'))
{
checked=true;
}
else
{
checked=false;
break;
}
}
if(checked)
{
bf.toString();
System.out.println("" + attempt);
checked=false;
}
}
}
else
{
attempt=bf.toString();
System.out.println(""+attempt);
}
bf.increment();
}
}
private char[] cs; // Character Set
private char[] cg; // Current Guess
public BruteForce(char[] characterSet, int guessLength)
{
cs = characterSet;
cg = new char[guessLength];
Arrays.fill(cg, cs[0]);
}
public void increment()
{
int index = cg.length - 1;
while(index >= 0)
{
if (cg[index] == cs[cs.length-1])
{
if (index == 0)
{
cg = new char[cg.length+1];
Arrays.fill(cg, cs[0]);
break;
}
else
{
cg[index] = cs[0];
index--;
}
}
else
{
cg[index] = cs[Arrays.binarySearch(cs, cg[index]) + 1];
break;
}
}
}
@Override
public String toString()
{
return String.valueOf(cg);
}
}
No comments:
Post a Comment