/// <summary> /// Get Password List from file or from github. If downloaded from github it will save that new list to file /// </summary> /// <param name="redownload">Wheter or not to redownload the list from github</param> /// <returns></returns> public static List <string> GetPasswords(bool redownload = false) { Log.Output("Getting password list..."); JetPassword jet = new JetPassword(); List <string> passwords = new List <string>(); if (!jet.PasswordsFileExist() || redownload) { passwords = jet.CreatePasswordsList(); } else { passwords = jet.CreatePasswordsList(File.ReadAllText(jet.passwordsFilePath)); } JetPasswordEventArgs args = new JetPasswordEventArgs(); args.PasswordList = passwords; if (passwords != null && passwords.Count > 0) { jet.OnPasswordListAquired(args); } else { jet.OnFailedToAquirePasswordList(args); } return(passwords); }
/// <summary> /// Find the correct password for the Jet, or identify that the password is completely unknown /// </summary> /// <param name="jet">The ZipFile you want the password for</param> /// <returns>The password or null if password not found</returns> public static string FindJetPassword(ZipFile jet) { var passwords = JetPassword.GetPasswords(); foreach (var pass in passwords) { var result = Zip.IsPasswordCorrect(jet, pass); if (!result) { continue; } return(pass); } return(null); }