/// <summary> /// Reads the information from the given .ab file /// </summary> /// <param name="path">The path of the .ab file</param> /// <param name="password">The password to use</param> /// <returns>The BackupFileInfo instance</returns> public static BackupFileInfo FromFile(string path, string password = "******") { BackupFileInfo result = new BackupFileInfo(); Java.Update(); string output = Java.RunJarWithOutput(ResourceManager.abePath, new string[] { "-debug", "info", "\"" + path + "\"", password }); result.magic = output.Between("Magic: ", "\r\n"); result.algorithm = output.Between("Algorithm: ", "\r\n"); result.compressed = (output.Between("Compressed: ", "\r\n").Contains("1") ? true : false); result.version = (output.Between("Version: ", "\r\n").Contains("1") ? BackupFileVersion.Version1 : BackupFileVersion.Version2); BackupFileEncryptedInformation ei = new BackupFileEncryptedInformation(); if (!output.Contains("Exception") && output.Contains("IV: ")) { ei.iV = output.Between("IV: ", "\r\n"); ei.keyBytes = output.Between("key bytes: ", "\r\n"); ei.keyFormat = output.Between("Key format: ", "\r\n"); ei.mK = output.Between("MK: ", "\r\n"); ei.mKAsString = output.Between("MK as string: ", "\r\n"); ei.mKChecksum = output.Between("MK checksum: ", "\r\n"); ei.saltBytes = output.Between("salt bytes: ", "\r\n"); } result.encrytedInformation = ei; return(result); }
public BackupFileInfo() { version = BackupFileVersion.Version1; magic = "ANDROID BACKUP"; compressed = true; algorithm = "none"; encrytedInformation = new BackupFileEncryptedInformation(); }
/// <summary> /// Reads the information from the given .ab file /// </summary> /// <param name="path">The path of the .ab file</param> /// <param name="password">The password to use</param> /// <returns>The BackupFileInfo instance</returns> public static BackupFileInfo FromFile(string path, string password = "******") { BackupFileInfo result = new BackupFileInfo(); Java.Update(); string output = Java.RunJarWithOutput(ResourceManager.abePath, new string[] { "-debug", "info", "\"" + path + "\"", password }); result.magic = output.Between("Magic: ", "\r\n"); result.algorithm = output.Between("Algorithm: ", "\r\n"); result.compressed = (output.Between("Compressed: ", "\r\n").Contains("1") ? true : false); result.version = (output.Between("Version: ", "\r\n").Contains("1") ? BackupFileVersion.Version1 : BackupFileVersion.Version2); BackupFileEncryptedInformation ei = new BackupFileEncryptedInformation(); if(!output.Contains("Exception") && output.Contains("IV: ")) { ei.iV = output.Between("IV: ", "\r\n"); ei.keyBytes = output.Between("key bytes: ", "\r\n"); ei.keyFormat = output.Between("Key format: ", "\r\n"); ei.mK = output.Between("MK: ", "\r\n"); ei.mKAsString = output.Between("MK as string: ", "\r\n"); ei.mKChecksum = output.Between("MK checksum: ", "\r\n"); ei.saltBytes = output.Between("salt bytes: ", "\r\n"); } result.encrytedInformation = ei; return result; }