Esempio n. 1
0
        private static void Main(string[] args)
        {
            List <string>       dictionary       = null;
            StopwatchController stopwatch        = new StopwatchController(new System.Diagnostics.Stopwatch());
            DitionaryCreator    ditionaryCreator = new DitionaryCreator();

            if (args.Any(a => a == "help"))
            {
                PrintManual();
                return;
            }
            if (args.Any(a => a == "-bd"))
            {
                PrintPDfForce();
                dictionary = GenerateBirthdayDictionary(stopwatch, ditionaryCreator);
            }
            if (args.Any(a => a == "-kw"))
            {
                PrintPDfForce();
                dictionary = GenerateKeywordsDictionary(stopwatch, ditionaryCreator);
            }
            if (args.Any(a => a == "-df"))
            {
                PrintPDfForce();
                dictionary = LoadDictionary();
            }
            FindPassword(args, dictionary, stopwatch);
        }
Esempio n. 2
0
        private static List <string> GenerateBirthdayDictionary(StopwatchController stopwatch, DitionaryCreator ditionaryCreator)
        {
            List <string> dictionary;
            DateTime      startDate  = new DateTime(1960, 1, 1);
            DateTime      finishDate = DateTime.Now.AddYears(-10);

            Console.WriteLine($"Generate dictionary between {startDate.ToString("dd/MM/yyyy")} and {finishDate.ToString("dd/MM/yyyy")}");
            stopwatch.Start();
            dictionary = ditionaryCreator.GenerateForBirthday(startDate, finishDate);
            stopwatch.Stop();
            Console.WriteLine($"Working time: {stopwatch.Time}\tDictionary length: {dictionary.Count}");
            return(dictionary);
        }
Esempio n. 3
0
        private static List <string> GenerateKeywordsDictionary(StopwatchController stopwatch, DitionaryCreator ditionaryCreator)
        {
            List <string> dictionary = new List <string>();
            string        str        = "";
            List <string> keywords   = new List <string>();

            while (true)
            {
                Console.WriteLine("Write keyword or stop for exit:");
                str = Console.ReadLine();
                if (str == "stop")
                {
                    break;
                }
                if (!string.IsNullOrEmpty(str))
                {
                    keywords.Add(str);
                }
            }
            stopwatch.Start();
            try
            {
                keywords   = ditionaryCreator.FirstCharUp(keywords);
                dictionary = ditionaryCreator.GenerateForKeywords(keywords, 2);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                stopwatch.Stop();
                Console.WriteLine($"Working time: {stopwatch.Time}\tKeywords: {keywords?.Count}\tDictionary length: {dictionary?.Count}");
            }
            return(dictionary);
        }