Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace GenerátorVariant
  9. {
  10.     class Program
  11.     {
  12.         static StreamWriter sw;
  13.         static string Cesta = @"D:\temp\";
  14.         static String NazevSouboru = "Hesla_0.txt";
  15.         static int Pocet = 0;
  16.         static Int64 Zaznamu = 0;
  17.  
  18.         static void Main(string[] args)
  19.         {
  20.            
  21.  
  22.             if (!Directory.Exists(Cesta))
  23.             {
  24.                 Directory.CreateDirectory(Cesta);
  25.             }
  26.  
  27.             sw = new StreamWriter(Cesta + "Hesla_0.txt", false);
  28.             char[] heslo = new char[10];
  29.             for (int a = 33; a < 126; a++)
  30.             {
  31.                 for (int b = 33; b < 126; b++)
  32.                 {
  33.                     for (int c = 33; c < 126; c++)
  34.                     {
  35.                         for (int d = 33; d < 126; d++)
  36.                         {
  37.                             for (int e = 33; e < 126; e++)
  38.                             {
  39.                                 for (int f = 33; f < 126; f++)
  40.                                 {
  41.                                     for (int g = 33; g < 126; g++)
  42.                                     {
  43.                                         for (int h = 33; h < 126; h++)
  44.                                         {
  45.                                             for (int i = 33; i < 126; i++)
  46.                                             {
  47.                                                 for (int j = 33; j < 126; j++)
  48.                                                 {
  49.                                                     heslo[0] = (char)a;
  50.                                                     heslo[1] = (char)b;
  51.                                                     heslo[2] = (char)c;
  52.                                                     heslo[3] = (char)d;
  53.                                                     heslo[4] = (char)e;
  54.                                                     heslo[5] = (char)f;
  55.                                                     heslo[6] = (char)g;
  56.                                                     heslo[7] = (char)h;
  57.                                                     heslo[8] = (char)i;
  58.                                                     heslo[9] = (char)j;
  59.                                                     Vypis(heslo);
  60.                                                     Zaznamu++;
  61.                                                 }
  62.                                             }
  63.                                         }
  64.                                     }
  65.                                 }
  66.                             }
  67.                         }
  68.                     }
  69.                 }
  70.             }
  71.             sw.Close();
  72.             Console.WriteLine("Hotovo!");
  73.             Console.ReadKey();
  74.         }
  75.  
  76.         static void Vypis(char[] Vstup)
  77.         {
  78.             string Vystup = "";
  79.             foreach (char a in Vstup)
  80.             {
  81.                 Vystup += a;
  82.             }
  83.             if (Zaznamu % 5000000 == 0)
  84.             {
  85.                 FileInfo FI = new FileInfo(Cesta + NazevSouboru);
  86.                 if (FI.Length > (Int32.MaxValue / 4))
  87.                 {
  88.                     Pocet++;
  89.                     NazevSouboru = "Hesla_" + Pocet + ".txt";
  90.                     sw = new StreamWriter(Cesta + NazevSouboru, false);
  91.                     Zaznamu = 0;
  92.                 }
  93.             }
  94.             sw.WriteLine(Vystup);
  95.  
  96.         }
  97.     }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement