예제 #1
0
 /// <summary>
 /// Separa una palabra en todos los posibles caracteres que puede tener cada caracter
 /// </summary>
 /// <param name="word">Palabra a separar</param>
 public static BruteForceAllowedChars[] SplitWordMixed(string word, bool lowerAndUpper, bool onlyFirstUpper, bool mixCase)
 {
     BruteForceAllowedChars[] ar = new BruteForceAllowedChars[word.Length];
     for (int x = 0; x < ar.Length; x++)
     {
         ar[x] = new BruteForceAllowedChars(word[x], lowerAndUpper || onlyFirstUpper && x == 0, mixCase);
     }
     return(ar);
 }
예제 #2
0
 /// <summary>
 /// Obtiene los AllowedChars desde varias cadenas de strings
 /// </summary>
 /// <param name="alloweds">Caracteres permitidos</param>
 public static BruteForceAllowedChars[] SplitAllowed(params string[] alloweds)
 {
     BruteForceAllowedChars[] ar = new BruteForceAllowedChars[alloweds.Length];
     for (int x = 0; x < ar.Length; x++)
     {
         ar[x] = new BruteForceAllowedChars(alloweds[x]);
     }
     return(ar);
 }
예제 #3
0
        public static BruteForceStep[] FromWord(bool appendEmpty, string[] input, bool lowerAndUpper, bool upperOnlyFirst, bool mix)
        {
            List <BruteForceStep> ls = new List <BruteForceStep>();

            if (appendEmpty)
            {
                ls.Add(new BruteForceStep());
            }

            foreach (string sinput in input)
            {
                BruteForceStep c = new BruteForceStep();
                c.ret = BruteForceAllowedChars.SplitWordMixed(sinput, lowerAndUpper, upperOnlyFirst, mix);
                ls.Add(c);
            }
            return(ls.ToArray());
        }
예제 #4
0
        bool Increment(int[] indexes, char[] current, BruteForceAllowedChars[] chars)
        {
            int position = indexes.Length - 1;

            while (position >= 0)
            {
                indexes[position]++;
                BruteForceAllowedChars ch = chars[position];
                if (indexes[position] < ch.Allowed.Length)
                {
                    current[position] = ch.Allowed[indexes[position]];
                    return(true);
                }
                indexes[position] = 0;
                current[position] = ch.Allowed[0];
                position--;
            }
            return(false);
        }