public static void ShowEncryptedFileMessage() { var msg = "This file is encrypted, its encrypted content will be shown. You'll need to decrypted the file to see its real content.\nType 'help cracker' for more info."; msg = TextUtil.Warning(msg); TerminalUtil.ShowText(msg); }
public static void Execute(ProgramExecutionOptions options) { if (ProgramUtil.ShowHelpIfNeeded(options)) { return; } if (CommandLineUtil.ValidateArguments(options.ParsedArguments, Validations)) { var path = options.ParsedArguments[0].Value; HashDir dir; HashFile file; if (FileSystem.DirExists(path, out dir)) { FileSystem.ChangeDir(dir); } else if (FileSystem.FileExistsAndIsAvailable(path, out file)) { var msg = string.Format("The path '{0}' points to a file. Use 'open {0}' to open this file.", path); msg = TextUtil.Warning(msg); TerminalUtil.ShowText(msg); } else { var msg = string.Format("The path '{0}' points nowhere. Please supply a valid path.", path); msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } } else { string msg = null; var result = PathValidation.ValidationResult; if (MathUtil.ContainsFlag((int)result, (int)ArgValidationResult.EmptyValue)) { msg = "Please supply a path."; } else if (MathUtil.ContainsFlag((int)result, (int)ArgValidationResult.NotFound)) { msg = "Please supply a path."; } msg = TextUtil.Error(msg); TerminalUtil.ShowText(msg); } }
public static IEnumerator ExecuteOnPassword(string password, string rawGuess, Action <bool> callback) { var guessArray = rawGuess.Split(';'); var guess = string.Concat(guessArray); TerminalUtil.BlockPlayerInput("[BLOCKED WHILE RUNNING CRACKER]"); var percentage = GetEqualPercentage(password, guessArray); var msg = "Generating passowords based on given hints... This might take a few seconds."; msg = TextUtil.Warning(msg); TerminalUtil.ShowText(msg); float time = Mathf.Log10(guess.Length); time = Mathf.LerpUnclamped(0, 3, time); yield return(new WaitForSecondsRealtime(time)); var random = new System.Random(guess.Length / guessArray.Length); var minCount = (guessArray.Length * guessArray.Length); var passwordsCount = random.Next(minCount, Mathf.CeilToInt((float)(minCount * Math.PI))); msg = string.Format("{0} passwords generated.", passwordsCount); TerminalUtil.ShowText(msg); msg = string.Format("Trying password {0}/{1}", 1, passwordsCount); TerminalUtil.ShowText(msg); for (int i = 1; i < passwordsCount; i++) { msg = string.Format("Trying password {0}/{1}", i + 1, passwordsCount); TerminalUtil.ChangeLastText(msg); yield return(new WaitForSecondsRealtime(.01f)); } TerminalUtil.UnblockPlayerInput(); yield return(null); var success = percentage >= PercentualThresholdToSuccess; callback(success); }