Skip to content

Instantly share code, notes, and snippets.

@mrjeremyt
Created November 22, 2016 20:57
Show Gist options
  • Save mrjeremyt/3d5429cd9a91fb43e43b7e2a47072968 to your computer and use it in GitHub Desktop.
Save mrjeremyt/3d5429cd9a91fb43e43b7e2a47072968 to your computer and use it in GitHub Desktop.
class SpockTheMagicDragon
{
protected static Password p;
public SpockTheMagicDragon(Password pwd) {
p = pwd;
}
protected static char[] charset = {33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,
57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,
92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125,126};
protected static long num = 0;
public boolean generate(String str, int pos, int length)
{
if (length == 0) {
String s = jcrypt.crypt(p.salt, str);
if (s.equals(p.whole_password))
{
System.out.println("Password " + ++PasswordCrack.num_psswds_found + "/" + PasswordCrack.num_passwords + " for user " +
p.username + " is: " + str + ", at time: " + PasswordCrack.s.time() + " seconds." + " The encryption is: " + s);
return true;
}
} else {
for (int i = pos; i < charset.length; i++) {
generate(str + charset[i], i, length - 1);
}
}
return false;
}
}
class SpockTheMagicDragon
{
protected static Password p;
public SpockTheMagicDragon(Password pwd) {
p = pwd;
}
protected static char[] charset = {33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,
57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,
92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,
120,121,122,123,124,125,126};
protected static long num = 0;
public boolean generate(String str, int pos, int length)
{
if (length == 0) {
String s = jcrypt.crypt(p.salt, str);
if (s.equals(p.whole_password))
{
System.out.println("Password " + ++PasswordCrack.num_psswds_found + "/" + PasswordCrack.num_passwords + " for user " +
p.username + " is: " + str + ", at time: " + PasswordCrack.s.time() + " seconds." + " The encryption is: " + s);
return true;
}
} else {
for (int i = pos; i < charset.length; i++) {
generate(str + charset[i], i, length - 1);
}
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment