示例#1
0
        public static void Execute()
        {
            string[] hashCodes =
            {
                "1115dd800feaacefdf481f1f9070374a2a81e27880f187396db67958b207cbad",
                "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
                "74e1bb62f8dabb8125a58852b63bdf6eaef667cb56ac7f7cdba6d7305c50a22f"
            };

            bool back = false;

            while (!back)
            {
                Console.Clear();

                Console.WriteLine("Choose a hash code to decipher:");
                Lib.CallInterface(hashCodes);

                string input = Console.ReadLine();
                switch (input)
                {
                case "1":
                case "2":
                case "3":
                    Console.Write("\nEnter the amount of threads (1 - 4): ");
                    int threadsCount = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine($"\nChosen hash: {hashCodes[Convert.ToInt32(input) - 1]}\nParallel threads amount: {threadsCount}");
                    Console.WriteLine("\nThe chosen hash is being deciphered, please stand by...\n");

                    Stopwatch stopwatch = new Stopwatch();
                    stopwatch.Start();
                    Console.WriteLine($"The password is: {BruteForceAsync(hashCodes[Convert.ToInt32(input) - 1], threadsCount).Result}");
                    stopwatch.Stop();
                    Console.WriteLine($"Time elapsed: {stopwatch.ElapsedMilliseconds} ms");
                    stopwatch.Reset();

                    Console.ForegroundColor = ConsoleColor.DarkGray;
                    Console.Write("Press any key to continue...");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.ReadKey();
                    break;

                case "exit":
                    back = true;
                    Console.WriteLine();
                    break;

                default:
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Wrong input received, try again!\n");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.ReadKey();
                    break;
                }
            }
        }
示例#2
0
        static async Task Main(string[] args)
        {
            Console.Title = "Pair tasks";

            while (true)
            {
                Console.Clear();

                Console.WriteLine("Choose the task:");
                Lib.CallInterface("Task 1. Drives", "Task 1. Directories", "Task 1. Files", "Task 2. FileStream", "Task 3. JSON", "Task 4. XML", "Task 5. ZIP", "Additional task. Threads");

                string input = Console.ReadLine();
                Console.Clear();
                switch (input)
                {
                case "1":
                    Task_classes.Task1.Task1_Drives.Execute();
                    break;

                case "2":
                    Task_classes.Task1.Task1_Directories.Execute();
                    break;

                case "3":
                    Task_classes.Task1.Task1_Files.Execute();
                    break;

                case "4":
                    Task2_FileStream.Execute();
                    break;

                case "5":
                    await Task3_JSON.Execute();

                    break;

                case "6":
                    Task4_XML.Execute();
                    break;

                case "7":
                    Task5_ZIP.Execute();
                    break;

                case "8":
                    AdditionalTask_AsyncHash.Execute();
                    break;

                case "exit":
                    Environment.Exit(0);
                    break;

                default:
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Wrong input received, try again!\n");
                    Console.ResetColor();
                    break;
                }
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Write("\nPress any key to continue...");
                Console.ResetColor();
                Console.ReadKey();
            }
        }