Example #1
0
 public CrackerJacHashCracker(CrackerJacConfig config)
 {
     Config  = config;
     threads = new Thread[config.ThreadCount];
 }
        public CrackerJacConfig Parse()
        {
            CrackerJacConfig config = new CrackerJacConfig();

            for (position = 0; position < args.Length; position++)
            {
                switch (args[position++].ToLower())
                {
                case "-a":
                case "--append":
                    while (position < args.Length)
                    {
                        if (args[position].StartsWith("-"))
                        {
                            position--;
                            break;
                        }
                        config.TryAppends.Add(args[position++]);
                    }
                    break;

                case "-ar":
                case "--append-range":
                    int min = Convert.ToInt32(expectData("[MIN]"));
                    position++;
                    int max = Convert.ToInt32(expectData("[MAX]"));
                    while (min <= max)
                    {
                        config.TryAppends.Add(min++.ToString());
                    }
                    break;

                case "-b":
                case "--brute":
                    config.IsBruteForce     = true;
                    config.BruteForceLength = Convert.ToInt32(expectData("[LENGTH]"));
                    position++;
                    config.BruteForceLettersFile = expectData("[FILE]");
                    break;

                case "-c":
                case "--caps":
                    config.TryCaps = true;
                    position--;
                    break;

                case "-d":
                case "--dict":
                    config.DictionaryFile = expectData("[FILE]");
                    break;

                case "-h":
                case "--help":
                    displayHelp();
                    break;

                case "-f":
                case "--file":
                    config.HashFile = expectData("[FILE]");
                    break;

                case "-g":
                case "--generate":
                    Console.WriteLine(new CrackerJacHashCracker(config).Hash(expectData("[STRING]")));
                    Environment.Exit(0);
                    break;

                case "-m":
                case "--method":
                    config.Method = expectData("[ALGO]");
                    break;

                case "-o":
                case "--output":
                    config.OutputFile = expectData("[FILE]");
                    break;

                case "-t":
                case "--threads":
                    config.ThreadCount = Convert.ToInt32(expectData("[NUM]"));
                    break;

                default:
                    Console.WriteLine("Unknown flag or floating data {0}!", args[position - 1]);
                    Environment.Exit(0);
                    break;
                }
            }
            return(config);
        }