Last active
December 13, 2015 22:59
-
-
Save spotco/4988755 to your computer and use it in GitHub Desktop.
JABBA PASSWORD CRACKER STUB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.ArrayList; | |
| import java.util.List; | |
| public class PasswordGen { | |
| public static void main(String[] args) { | |
| List<Character> cs = new ArrayList<Character>(); | |
| cs.add('a'); | |
| cs.add('b'); | |
| cs.add('c'); | |
| cs.add('d'); | |
| PasswordGen pw = new PasswordGen(cs,10); | |
| pw.CHEAT(); | |
| } | |
| private String pass; | |
| private int maxlen; | |
| private List<Character> charset; | |
| public PasswordGen(List<Character> charset, int maxlen) { | |
| this.charset = charset; | |
| this.maxlen = maxlen; | |
| int tarlen = (int) (Math.random()*this.maxlen)+1; | |
| StringBuilder b = new StringBuilder(); | |
| for(int i = 0; i < tarlen; i++) { | |
| b.append(this.charset.get((int) (this.charset.size()*Math.random()))); | |
| } | |
| this.pass = b.toString(); | |
| } | |
| public int get_maxlen() { | |
| return this.maxlen; | |
| } | |
| public boolean is_correct(String tar) { | |
| return pass.equals(tar); | |
| } | |
| public List<Character> get_charset() { | |
| return this.charset; | |
| } | |
| public void CHEAT() { | |
| System.out.printf("CHEAT:'%s', maxlen:%d charset:%s\n", this.pass,this.charset.size(),this.charset.toString()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment