Created
May 30, 2014 18:57
-
-
Save jborg/78bbb98f3b95275131d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from binascii import hexlify | |
import sys | |
from attic.archive import Archive | |
from attic.remote import RemoteRepository | |
from attic.repository import Repository | |
from attic.helpers import Location, Manifest | |
if __name__ == '__main__': | |
location = Location(sys.argv[1]) | |
if location.proto == 'ssh': | |
repository = RemoteRepository(location) | |
else: | |
repository = Repository(location.path) | |
manifest, key = Manifest.load(repository) | |
archive = Archive(repository, key, manifest, location.archive) | |
for i, item_id in enumerate(archive.metadata[b'items']): | |
data = key.decrypt(item_id, repository.get(item_id)) | |
filename = '{}_{}.items'.format(i, hexlify(item_id).decode('ascii')) | |
print('Dumping', filename) | |
with open(filename, 'wb') as fd: | |
fd.write(data) | |
print('Done') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment