forked from lotaku/Python-GoogleDrive-VideoStream
-
Notifications
You must be signed in to change notification settings - Fork 1
/
encryptFolder.py
36 lines (27 loc) · 995 Bytes
/
encryptFolder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from resources.lib import encryption
#from subprocess import call
import sys
import re
import os
saltFile = str(sys.argv[1])
password = str(sys.argv[2])
source = str(sys.argv[3])
target = str(sys.argv[4])
encrypt = encryption.encryption(saltFile,password)
#encrypt.encryptString(file)
#print encrypt.decryptString(file)
def encrypt_dir(source, target):
current, dirs, files = os.walk(source).next()
for file in files:
encFile = encrypt.encryptString(file)
encrypt.encryptFile(str(source) + '/' + str(file), str(target) +'/'+ str(encFile))
print str(source) + '/' + str(file) + ' -> ' + str(target) +'/'+ str(encFile)
for dir in dirs:
encDIR = encrypt.encryptString(dir)
try:
os.mkdir(str(target) + '/' + str(encDIR))
except:pass
encrypt_dir(str(source) + '/' + str(dir), str(target) +'/'+str(encDIR))
print str(source) + '/' + str(dir) + ' -> ' + str(target) + '/' + str(encDIR)
#print encrypt.generateSalt()
encrypt_dir(source, target)