Skip to content

Instantly share code, notes, and snippets.

@mrjeremyt
Created November 22, 2016 20:57

Revisions

  1. mrjeremyt created this gist Nov 22, 2016.
    32 changes: 32 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    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;
    }
    }
    32 changes: 32 additions & 0 deletions spockthemagicdragon.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    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;
    }
    }