public override bool Run() { BruteForce b = new BruteForce(); if (!b.CompilePicture(ConfigFile == null ? null : ConfigFile.FullName, ConfigPicture)) { return(false); } WriteInfo("Sets loaded", b.Sets.ToString(), b.Sets <= 0 ? ConsoleColor.Red : ConsoleColor.Green); WriteInfo("Steps loaded", b.Steps.ToString(), b.Steps <= 0 ? ConsoleColor.Red : ConsoleColor.Green); int step = 0; long split = SplitInBytes; string file = FileDest.FullName; if (split > 0) { WriteInfo("Split files in", StringHelper.Convert2Kb(split), ConsoleColor.Green); } ulong gen = b.Count(); ulong va = 0; StartProgress(gen); FileStream sw = new FileStream(split > 0 ? GetNextFile(file, ref step) : file, FileMode.Append, FileAccess.Write); long ps = sw.Position; foreach (string password in b.Run()) { byte[] data = Encoding.UTF8.GetBytes(password + "\n"); sw.Write(data, 0, data.Length); ps += data.Length; va++; WriteProgress(va); if (split > 0 && ps >= split) { sw.Dispose(); sw = new FileStream(GetNextFile(file, ref step), FileMode.Append, FileAccess.Write); ps = sw.Position; } } sw.Dispose(); EndProgress(); WriteInfo("Generated file successful ", gen.ToString(), ConsoleColor.Green); return(true); }
public override ECheck Check() { BruteForce b = new BruteForce(); if (!b.CompilePicture(ConfigFile == null ? null : ConfigFile.FullName, ConfigPicture)) { return(ECheck.Error); } WriteInfo("Sets loaded", b.Sets.ToString(), b.Sets <= 0 ? ConsoleColor.Red : ConsoleColor.Green); WriteInfo("Steps loaded", b.Steps.ToString(), b.Steps <= 0 ? ConsoleColor.Red : ConsoleColor.Green); WriteInfo("Count ", b.Count().ToString(), ConsoleColor.Green); return(ECheck.Ok); }