mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2025-09-10 04:26:32 +02:00
Optimized code
This commit is contained in:
@@ -19,7 +19,7 @@ class Cleanup():
|
||||
try:
|
||||
self.cli.executeCommand('rm -r ' + folder_path + '*')
|
||||
except Exception as error:
|
||||
print(error)
|
||||
pass
|
||||
|
||||
def cleanupFiles(self,file_type):
|
||||
for folder_path in self.getAllFilePaths(file_type):
|
||||
@@ -29,7 +29,7 @@ class Cleanup():
|
||||
try:
|
||||
self.cli.executeCommand('find "' + self.paths.getDataFolderPath(Paths.TYPE_ENCRYPTED) + '" -not -name "*' + str(user) +'*" -type f -print | xargs rm -v')
|
||||
except Exception as error:
|
||||
print(error)
|
||||
pass
|
||||
self.cleanupFiles(Paths.TYPE_DECRYPTED)
|
||||
|
||||
def deleteAll(self):
|
||||
|
@@ -40,10 +40,10 @@ class Encryption():
|
||||
self.user_mapped_data[user_id]['about'][label] = content;
|
||||
|
||||
def getCoSecretHoldersRange():
|
||||
return range(Encryption.MINIMUM_SECRET_HOLDERS,Encryption.MAXIMUM_SECRET_HOLDERS)
|
||||
return range(Encryption.MINIMUM_SECRET_HOLDERS,(Encryption.MAXIMUM_SECRET_HOLDERS+1))
|
||||
|
||||
def getSecretHoldersRange():
|
||||
return range(1,Encryption.MAXIMUM_SECRET_HOLDERS)
|
||||
return range(1,(Encryption.MAXIMUM_SECRET_HOLDERS+1))
|
||||
|
||||
def getStartnumber(self):
|
||||
index = 0
|
||||
@@ -84,7 +84,7 @@ class Encryption():
|
||||
def compileData(self):
|
||||
self.compileContacts()
|
||||
index = self.getStartnumber()
|
||||
while index < self.getEndnumber():
|
||||
while index <= self.getEndnumber():
|
||||
password_group_name = ''.join(sorted(str(index)))
|
||||
if self.isGroupValid(password_group_name):
|
||||
password_group_index_int = int(password_group_name)
|
||||
@@ -126,11 +126,10 @@ class Encryption():
|
||||
data={"user_mapped": self.user_mapped_data, "group_mapped": self.group_mapped_data}
|
||||
self.encryptToJsonFile(data,file_path,self.master_password)
|
||||
|
||||
def encryptMainData(self):
|
||||
self.cli.executeCommand('tar -C"' + self.paths.getDecryptedMainDataStandartFolder() + '" -cvzf - ./ | gpg -c --batch --passphrase "' + self.master_password +'" > "' + self.paths.getEncryptedMainDataFile() + '"')
|
||||
def encryptMainData(self,input_directory):
|
||||
self.cli.executeCommand('tar -C"' + input_directory + '" -cvzf - ./ | gpg -c --batch --passphrase "' + self.master_password +'" > "' + self.paths.getEncryptedMainDataFile() + '"')
|
||||
|
||||
def encryptAll(self):
|
||||
def encryptMetaData(self):
|
||||
self.encryptUserFile()
|
||||
self.encryptAccumulatedFile()
|
||||
self.encryptGroupFiles()
|
||||
self.encryptMainData()
|
||||
self.encryptGroupFiles()
|
Reference in New Issue
Block a user