def main(): '''Start time''' start_time = time.time() '''Gets all user arguments''' input_dir, output_dir, recreate, decrypt, out_type, ir_mode, bulk, password, logger = parseArgs( ) '''Parse a single backup''' if not bulk and not ir_mode: logger.info("Starting to read backup at: " + input_dir) plist_parser.parsePlists(input_dir, output_dir, out_type, decrypt, logger) if recreate and not decrypt: logger.debug( "User chose to recreate folders. Starting process now") recreator.startRecreate(input_dir, output_dir, password, 0, logger) '''Just decrypt backup and no recreate''' if decrypt and not recreate: if password is None: logger.error("You need to supply a password for decryption") sys.exit() recreator.startRecreate(input_dir, output_dir, password, decrypt, logger) if decrypt and recreate: logger.error( "Cannot use -d and -r flags together. -r will decrypt the backup and recreate" ) sys.exit() '''Bulk parse''' if bulk: subfolders = os.listdir(input_dir) for folders in subfolders: current_folder = os.path.join(input_dir, folders) logger.info("Starting to read backup at: " + current_folder) plist_parser.parsePlists(current_folder, output_dir, out_type, decrypt, logger) if recreate: logger.info( "User chose to recreate folders. Starting process now") recreator.startRecreate(current_folder, output_dir, password, logger) if ir_mode: path = "\\Users\\*\\AppData\\Roaming\\Apple Computer\\MobileSync\\Backup\\*" all_paths = glob.glob(path) for folders in all_paths: logger.info("Starting to read backup at: " + folders) plist_parser.parsePlists(folders, output_dir, out_type, logger) if recreate: logger.info( "User chose to recreate folders. Starting process now") recreator.startRecreate(folders, output_dir, password, logger) end_time = time.time() logger.info("Program ended in: " + str(end_time - start_time) + " seconds")
def main(): '''Start time''' start_time = time.time() '''Gets all user arguments''' input_dir, output_dir, recreate, out_type, ir_mode, bulk, password, logger = parseArgs() '''Parse a single backup''' if not bulk and not ir_mode: logger.info("Starting to read backup at: " + input_dir) plist_parser.parsePlists(input_dir, output_dir, out_type, logger) if recreate: logger.debug("User chose to recreate folders. Starting process now") recreator.startRecreate(input_dir, output_dir, password, logger) '''Bulk parse''' if bulk: subfolders = os.listdir(input_dir) for folders in subfolders: current_folder = os.path.join(input_dir, folders) logger.info("Starting to read backup at: " + current_folder) plist_parser.parsePlists(current_folder, output_dir, out_type, logger) if recreate: logger.info("User chose to recreate folders. Starting process now") recreator.startRecreate(current_folder, output_dir, password, logger) if ir_mode: path = "\\Users\\*\\AppData\\Roaming\\Apple Computer\\MobileSync\\Backup\\*" all_paths = glob.glob(path) for folders in all_paths: logger.info("Starting to read backup at: " + folders) plist_parser.parsePlists(folders, output_dir, out_type, logger) if recreate: logger.info("User chose to recreate folders. Starting process now") recreator.startRecreate(folders, output_dir, password, logger) end_time = time.time() logger.info("Program ended in: " + str(end_time - start_time) + " seconds")