else: log_to_file = None log_file = None if args.block_size: block_size = args.block_size else: block_size = get_peb_size(path) perms = args.permissions quiet = args.quiet if not os.path.exists(output_path): os.makedirs(output_path) ufile = ubi_file(path, block_size) uubi = ubi(ufile) for image in uubi.images: for volume in image.volumes: vol_out_path = os.path.join(output_path, volume) if not os.path.exists(vol_out_path): os.makedirs(vol_out_path) elif os.listdir(vol_out_path): parser.error('Volume output directory is not empty. %s' % vol_out_path) ufsfile = leb_virtual_file(uubi, image.volumes[volume]) uubifs = ubifs(ufsfile) uubifs.log.log_file = log_file uubifs.log.log_to_file = log_to_file uubifs.log.quiet = quiet print 'Wait almost over ...\nLoading the image to: %s' % vol_out_path extract_files(uubifs, vol_out_path, perms) sys.exit(0)
# Determine block size if not provided if args.block_size: block_size = args.block_size else: block_size = get_leb_size(path) if not os.path.exists(output_path): os.makedirs(output_path) perms = args.permissions quiet = args.quiet # Create file object ufsfile = ubi_file(path, block_size) # Create UBIFS object uubifs = ubifs(ufsfile) # Set up logging uubifs.log.log_file = log_file uubifs.log.log_to_file = log_to_file uubifs.quiet = quiet if not os.path.exists(output_path): os.makedirs(output_path) elif os.listdir(output_path): parser.error('Volume output directory is not empty. %s' % output_path) # Run extract all files print 'Writing to: %s' % output_path extract_files(uubifs, output_path, perms) sys.exit()
log_to_file = True log_file = args.logpath else: log_to_file = None log_file = None if args.block_size: block_size = args.block_size else: block_size = get_peb_size(path) perms = args.permissions quiet = args.quiet if not os.path.exists(output_path): os.makedirs(output_path) ufile = ubi_file(path, block_size) uubi = ubi(ufile) for image in uubi.images: for volume in image.volumes: vol_out_path = os.path.join(output_path, volume) if not os.path.exists(vol_out_path): os.makedirs(vol_out_path) elif os.listdir(vol_out_path): parser.error('Volume output directory is not empty. %s' % vol_out_path) ufsfile = leb_virtual_file(uubi, image.volumes[volume]) uubifs = ubifs(ufsfile) uubifs.log.log_file = log_file uubifs.log.log_to_file = log_to_file uubifs.log.quiet = quiet print 'Writing to: %s' % vol_out_path extract_files(uubifs, vol_out_path, perms) sys.exit(0)