30 lines
835 B
Python
30 lines
835 B
Python
from Crypto.Random import get_random_bytes
|
|
import os
|
|
|
|
import backup
|
|
from backup import Backup
|
|
|
|
if not os.path.exists("key"):
|
|
key = get_random_bytes(32) # 32 bytes * 8 = 256 bits (1 byte = 8 bits)
|
|
open("key", 'wb').write(key)
|
|
print("Saved")
|
|
else:
|
|
key = open("key", 'rb').read()
|
|
print("Recovered")
|
|
|
|
print(key)
|
|
|
|
application_key_id = '003aa00745ec42a0000000004'
|
|
application_key = 'K003RNvGfy+pazc6pD97xuUzPcDEqS0'
|
|
bucket_id = '6a1a9000075465fe7cc4021a'
|
|
|
|
bdd = "bdd.db"
|
|
|
|
#bck = Backup().backblaze(key, bdd=bdd, app_key_id=application_key_id, app_key=application_key, bucket_id=bucket_id)
|
|
bck = Backup().local(key, bdd=bdd, save_location="crypted")
|
|
|
|
rootdir = "test"
|
|
bck.save(rootdir).save("share", recurse=False)
|
|
|
|
bck.recover_file(paths=["test\\tmp597556213336506368.jpg", "share/archive.tar"], save_path="recovered")
|