예제 #1
0
        public int FunctionByte(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);

            parser.Parse();

            if (options.Byte)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToLower() == "-b" | args[i].ToLower() == "--byte")
                    {
                        int iByte = 0;

                        bool booleanByte = int.TryParse(args[i + 1], out iByte);

                        if (booleanByte == false)
                        {
                            Console.WriteLine("\nThe value entered with the -b option is incorrect\n");
                            Environment.Exit(0);
                        }
                        else
                        {
                            if (args[i + 2].ToLower() == "kib")
                            {
                                iByte *= 1024;
                            }
                            else if (args[i + 2].ToLower() == "mib")
                            {
                                iByte *= 1048576;
                            }
                            else if (args[i + 2].ToLower() == "gib")
                            {
                                iByte *= 1073741824;
                            }

                            //Statistical.DefaultSizeFileInOctet = iByte;
                            Statistical obj = new Statistical();
                            Parameter.NumberLine = obj.CalculSizeFile(iByte, Parameter.NumberOfChar, Parameter.TypesAtGenerate, Parameter.NumberOfAllCombination);
                        }
                    }
                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return(-1);
            }
            // No errors present and all arguments correct
            // Do work according to arguments
            return(0);
        }
예제 #2
0
        internal BigInteger CalculSizeFile(int sizeFile, int numberOfChar, int typesOfGeneration, BigInteger numberOfAllCombination)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);

            parser.Parse();
            BigInteger numberLine = 0;

            if (options.Line == false)
            {
                numberLine = sizeFile / (numberOfChar + 2);
            }

            return(numberLine);
        }
예제 #3
0
        public int HelpPrint(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);

            parser.Parse();

            if (options.Help)
            {
                Console.Write(parser.UsageInfo.ToString(80, false));
            }
            else if (options.WordlistHelp)
            {
                Pattern.SfrPrint();
                Pattern.LiveboxPrint();
                Pattern.MenuHexaPrint();
                Pattern.MenuNumericPrint();
                Pattern.MenuSpecialCharacteresPrint();

                Pattern.LatinCharacteUppercasePrint();
                Pattern.LatinCharacterLowercasePrint();
                Pattern.LatinCharacterUppercaseLowercasePrint();

                Pattern.CyrillicCharacterLowercasePrint();
                Pattern.CyrillicCharacterUppercasePrint();
                Pattern.CyrillicCharacterUppercaseLowercasePrint();

                Pattern.SwddishCharacterUppercasePrint();
                Pattern.SwddishCharacterLowercasePrint();
                Pattern.SwddishCharacterLowercaseUppercasePrint();

                Pattern.SyllableCharacteUppercasePrint();
                Pattern.SyllableCharacterLowercasePrint();
                Pattern.SyllableCharacterUppercaseLowercasePrint();
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return(-1);
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return(0);
        }
예제 #4
0
        public int SelectPattern(string[] args)
        {
            CLI options = new CLI();

            CommandLineParser parser = new CommandLineParser(options);

            parser.Parse();

            if (options.Dictionnary)
            {
                Parameter.SelectPattern(args);
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
            }
            // No errors present and all arguments correct
            // Do work according to arguments
            return(0);
        }
예제 #5
0
        public int FunctionLine(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);

            parser.Parse();

            if (options.Line)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToLower() == "-c" | args[i].ToLower() == "--line")
                    {
                        int c;

                        bool booleanLine = int.TryParse(args[i + 1], out c);

                        if (booleanLine == false)
                        {
                            Console.WriteLine("\nThe value entered with the -c option is incorrect\n");
                            Environment.Exit(0);
                        }
                        else
                        {
                            Parameter.NumberLine = c;
                        }
                    }
                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return(-1);
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return(0);
        }
예제 #6
0
        public int FunctionLenght(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);

            parser.Parse();

            if (options.Lenght)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToLower() == "-l" | args[i].ToLower() == "--lenght")
                    {
                        byte l;

                        bool b = byte.TryParse(args[i + 1], out l);

                        if (b == false)
                        {
                            Console.WriteLine("\nThe value entered with the -l option is incorrect\n");
                            Environment.Exit(0);
                        }
                        else
                        {
                            Parameter.NumberOfChar = l;
                        }
                    }  // End For
                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return(-1);
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return(0);
        }
예제 #7
0
        public int StartblockPattern(string[] args)
        {
            Utility           obj2    = new Utility();
            CLI               options = new CLI();
            CommandLineParser parser  = new CommandLineParser(options);

            parser.Parse();

            if (options.Startblock)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToString().ToLower() == "-s" | args[i].ToString().ToLower() == "--startblock")
                    {
                        string s = args[i + 1].ToString();

                        if (s.Length > Parameter.CharsetSelecting.Count)
                        {
                            obj2.DoubleCapacityList(Parameter.CharsetSelecting, Parameter.NumberOfChar);
                        }
                        else
                        {
                            obj2.StartblockPattern(s, Parameter.CharsetSelecting);
                        }
                    }
                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return(-1);
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return(0);
        }
예제 #8
0
        public int HelpPrint(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.Help)
            {
                Console.Write(parser.UsageInfo.ToString(80, false));

            }
            else if (options.WordlistHelp)
            {
                Pattern.SfrPrint();
                Pattern.LiveboxPrint();
                Pattern.MenuHexaPrint();
                Pattern.MenuNumericPrint();
                Pattern.MenuSpecialCharacteresPrint();

                Pattern.LatinCharacteUppercasePrint();
                Pattern.LatinCharacterLowercasePrint();
                Pattern.LatinCharacterUppercaseLowercasePrint();

                Pattern.CyrillicCharacterLowercasePrint();
                Pattern.CyrillicCharacterUppercasePrint();
                Pattern.CyrillicCharacterUppercaseLowercasePrint();

                Pattern.SwddishCharacterUppercasePrint();
                Pattern.SwddishCharacterLowercasePrint();
                Pattern.SwddishCharacterLowercaseUppercasePrint();

                Pattern.SyllableCharacteUppercasePrint();
                Pattern.SyllableCharacterLowercasePrint();
                Pattern.SyllableCharacterUppercaseLowercasePrint();

            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
예제 #9
0
        public int EndPattern(string[] args)
        {
            Utility tools = new Utility();
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.EndBlock)
            {
                string s = null;
                for (int i = 0; i < args.Length; i++)
                {
                    
                    if (args[i].ToString().ToLower() == "-e" | args[i].ToString().ToLower() == "--end")
                    {
                        s = args[i + 1];
                    }                    
                }

                tools.EndPattern(s, Parameter.NumberOfChar, Parameter.CharsetSelecting);
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
예제 #10
0
        public int StartblockPattern(string[] args)
        {
            Utility obj2 = new Utility();
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.Startblock)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToString().ToLower() == "-s" | args[i].ToString().ToLower() == "--startblock")
                    {
                        string s = args[i + 1].ToString();

                        if (s.Length > Parameter.CharsetSelecting.Count)
                        {
                            obj2.DoubleCapacityList(Parameter.CharsetSelecting, Parameter.NumberOfChar);
                        }
                        else
                        {
                            obj2.StartblockPattern(s, Parameter.CharsetSelecting);
                        }
                    }
                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
예제 #11
0
        public int FunctionLine(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.Line)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToLower() == "-c" | args[i].ToLower() == "--line")
                    {
                        int c;

                        bool booleanLine = int.TryParse(args[i + 1], out c);

                        if (booleanLine == false)
                        {
                            Console.WriteLine("\nThe value entered with the -c option is incorrect\n");
                            Environment.Exit(0);
                        }
                        else
                        {
                           Parameter.NumberLine = c;
                        }
                    }
                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
예제 #12
0
        public int FunctionSaveFiles(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.SaveFile)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToLower() == "-o")
                    {
                        string pathBackupFile = args[i + 1];

                        if (pathBackupFile[0].ToString() == @"/" || pathBackupFile[1].ToString() == ":")
                        {
                            Parameter.PathBackUpFiles = pathBackupFile;
                        }

                    }
                }                
                
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
예제 #13
0
        public int FunctionByte(string[] args)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.Byte)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToLower() == "-b" | args[i].ToLower() == "--byte")
                    {
                        int iByte = 0;

                        bool booleanByte = int.TryParse(args[i + 1], out iByte);

                        if (booleanByte == false)
                        {
                            Console.WriteLine("\nThe value entered with the -b option is incorrect\n");
                            Environment.Exit(0);
                        }
                        else
                        {
                            if (args[i + 2].ToLower() == "kib")
                            {
                                iByte *= 1024;
                            }
                            else if (args[i + 2].ToLower() == "mib")
                            {
                                iByte *= 1048576;

                            }
                            else if (args[i + 2].ToLower() == "gib")
                            {
                                iByte *= 1073741824;
                            }

                            //Statistical.DefaultSizeFileInOctet = iByte;
                            Statistical obj = new Statistical();
                            Parameter.NumberLine = obj.CalculSizeFile(iByte,Parameter.NumberOfChar,Parameter.TypesAtGenerate,Parameter.NumberOfAllCombination);
                        }
                    }

                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }
            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
예제 #14
0
         public int FunctionLenght(string[] args)
         {
             CLI options = new CLI();
             CommandLineParser parser = new CommandLineParser(options);
             parser.Parse();

             if (options.Lenght)
             {
                 for (int i = 0; i < args.Length; i++)
                 {
                     if (args[i].ToLower() == "-l" | args[i].ToLower() == "--lenght")
                     {
                         byte l;

                         bool b = byte.TryParse(args[i + 1], out l);

                         if (b == false)
                         {
                             Console.WriteLine("\nThe value entered with the -l option is incorrect\n");
                             Environment.Exit(0);
                         }
                         else
                         {
                             Parameter.NumberOfChar = l;
                         }
                     } // End For               
                 }
             }
             else if (parser.HasErrors)
             {
                 Console.WriteLine(parser.UsageInfo.ToString(78, true));
                 return -1;
             }

             // No errors present and all arguments correct
             // Do work according to arguments
             return 0;
         }
예제 #15
0
        public int SelectPattern(string[] args)
        {
            CLI options = new CLI();

            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.Dictionnary)
            {
                Parameter.SelectPattern(args);
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));                
            }
            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
        internal BigInteger CalculSizeFile(int sizeFile, int numberOfChar, int typesOfGeneration, BigInteger numberOfAllCombination)
        {
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();
            BigInteger numberLine = 0;

            if (options.Line == false)
            {
                 numberLine = sizeFile / (numberOfChar + 2);
            }

            return numberLine;
        }
예제 #17
0
        private bool GenerateWordlist(CLI cmd)
        {
            CombinationPattern obj2 = new CombinationPattern();

            if (cmd.Crunch)
            {
                obj2.GenerateIncrementing(Parameter.CharsetSelecting, Parameter.NumberLine, cmd.SaveFile, cmd.Zip, false, 1, Parameter.NumberOfChar, PathBackUpFiles, extension);
            }
            else if (cmd.Combination)
            {
                obj2.GenerateIncrementing(Parameter.CharsetSelecting, Parameter.NumberLine, cmd.SaveFile, cmd.Zip, cmd.Repeat, 2, Parameter.NumberOfChar, PathBackUpFiles, extension);
            }
            else if (cmd.Random | cmd.Wifi)
            {
                Randomizer obj = new Randomizer();
                obj.GenerateRandomString(Parameter.CharsetSelecting, Parameter.NumberLine, cmd.SaveFile, Parameter.NumberOfAllCombination,  cmd.Zip, Parameter.NumberOfChar, PathBackUpFiles, extension);
            }
            else if (cmd.Variation)
            {
                VariationnPattern obj = new VariationnPattern();
                obj.GenerateVariationString(Parameter.CharsetSelecting,Parameter.NumberOfAllCombination, Parameter.NumberLine, cmd.SaveFile, cmd.Zip, cmd.Repeat, Parameter.NumberOfChar, PathBackUpFiles, extension);
            }
            else if (cmd.Permutation)
            {
                PermutationPattern obj = new PermutationPattern();
                obj.GeneratePermutationString(Parameter.CharsetSelecting, Parameter.NumberOfAllCombination,Parameter.NumberLine, Parameter.NumberOfChar,  cmd.SaveFile, cmd.Zip, cmd.Repeat, 5,  PathBackUpFiles, extension);
            }

            return false;
        }
예제 #18
0
        public Run(string[] args)
        {
            CLI cmd = new CLI();
            CommandLineParser parser = new CommandLineParser(cmd);
            parser.Parse();
            

            try
            {
                if (cmd.Help || cmd.WordlistHelp)
                {
                    cmd.HelpPrint(args);
                }
                else
                {
                    cmd.SelectPattern(args);
                    cmd.FunctionLenght(args);

                    if (cmd.Invert)
                    {
                        CharsetSelecting.Reverse();
                    }

                    if (cmd.Startblock)
                    {
                        cmd.StartblockPattern(args);
                    }

                    if (cmd.EndBlock)
                    {
                        cmd.EndPattern(args);
                    }

                    if (cmd.Line)
                    {
                        cmd.FunctionLine(args);
                    }

                    if (cmd.Byte)
                    {
                        cmd.FunctionByte(args);
                    }

                    if (cmd.SaveFile)
                    {
                        cmd.FunctionSaveFiles(args);                                            
                    }

                    if (cmd.Crunch)
                    {
                        Parameter.TypesAtGenerate = 1;
                    }
                    else if (cmd.Combination)
                    {
                        Parameter.TypesAtGenerate = 2;
                    }
                    else if (cmd.Random)
                    {
                        Parameter.TypesAtGenerate = 3;
                    }
                    else if(cmd.Variation)
                    {
                        Parameter.TypesAtGenerate = 4;                        
                    }
                    else if(cmd.Permutation)
                    {
                        Parameter.TypesAtGenerate = 5;                        
                    }

                                        
                    Parameter.NumberOfAllCombination = tools.CalculOfAllCombinaison(cmd.Repeat, Parameter.TypesAtGenerate, Parameter.NumberOfChar, Parameter.CharsetSelecting);

                    if (cmd.Line == false & cmd.Byte == false)
                    {
                        Parameter.NumberLine = Parameter.NumberOfAllCombination;
                    }

                    if (cmd.Disables == false)
                    {
                        Main.Version();
                        tools.StatiscalInfoSize(Parameter.NumberOfAllCombination, Parameter.TypesAtGenerate, Parameter.NumberOfChar);
                    }

                    this.GenerateWordlist(cmd);
                    Console.ReadKey();

                }               

            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            /// Debug pause, must commenting for release
            Console.ReadKey();
        }