mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2026-07-23 02:14:15 +00:00
autoformat
This commit is contained in:
@@ -21,7 +21,7 @@ class Cleanup():
|
||||
def deleteAllFilesInFolder(self,folder_path):
|
||||
try:
|
||||
self.cli.executeCommand('rm -r ' + folder_path + '*')
|
||||
except Exception as error:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def cleanupFiles(self,file_type):
|
||||
@@ -31,7 +31,7 @@ class Cleanup():
|
||||
def cleanupForUser(self,user):
|
||||
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:
|
||||
except Exception:
|
||||
pass
|
||||
self.cleanupFiles(Paths.TYPE_DECRYPTED)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class AutomaticIdentificationImpossibleException(Exception):
|
||||
class Decryption():
|
||||
|
||||
def __init__(self,cli,paths):
|
||||
self.user_id='0';
|
||||
self.user_id='0'
|
||||
self.user_password=''
|
||||
self.cli = cli
|
||||
self.paths = paths
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import random
|
||||
import string
|
||||
import math
|
||||
import numpy
|
||||
import re
|
||||
import json
|
||||
from .Paths import Paths
|
||||
@@ -32,13 +31,13 @@ class Encryption():
|
||||
user_count = 1
|
||||
while user_count <= self.amount_of_secret_holders:
|
||||
self.user_mapped_data[str(user_count)] = {"groups":{},"user_password":self.createPassword(self.USER_PASSWORD_LENGTHS),"about":{}}
|
||||
user_count += 1;
|
||||
user_count += 1
|
||||
|
||||
def initializeGroupData(self):
|
||||
self.group_mapped_data = {}
|
||||
|
||||
def addInformationToUser(self,user_id,label,content):
|
||||
self.user_mapped_data[user_id]['about'][label] = content;
|
||||
self.user_mapped_data[user_id]['about'][label] = content
|
||||
|
||||
def getCoSecretHoldersRange():
|
||||
return range(Encryption.MINIMUM_SECRET_HOLDERS,(Encryption.MAXIMUM_SECRET_HOLDERS+1))
|
||||
@@ -89,14 +88,14 @@ class Encryption():
|
||||
password_group_name = ''.join(sorted(str(index)))
|
||||
if self.isGroupValid(password_group_name):
|
||||
password_group_index_int = int(password_group_name)
|
||||
if not password_group_index_int in self.group_mapped_data:
|
||||
if password_group_index_int not in self.group_mapped_data:
|
||||
self.group_mapped_data[password_group_index_int] = {}
|
||||
self.group_mapped_data[password_group_index_int]['members'] = {}
|
||||
self.group_mapped_data[password_group_index_int]['password'] = ''
|
||||
password = ''
|
||||
for secret_holder_index in password_group_name:
|
||||
self.group_mapped_data[password_group_index_int]['members'][secret_holder_index]={}
|
||||
particial_password_length= int(self.OVERALL_PASSWORD_LENGTHS*self.quota_factor);
|
||||
particial_password_length= int(self.OVERALL_PASSWORD_LENGTHS*self.quota_factor)
|
||||
password_part = self.createPassword(particial_password_length)
|
||||
self.group_mapped_data[password_group_index_int]['members'][secret_holder_index] = password_part
|
||||
password += password_part
|
||||
|
||||
@@ -34,10 +34,10 @@ class Paths():
|
||||
return '.json' + self.getFileExtension(file_type)
|
||||
|
||||
def getUserFilePath(self,user_id,file_type):
|
||||
return self.getUserFilesPath(file_type) + user_id + self.getUserFileSuffix(file_type);
|
||||
return self.getUserFilesPath(file_type) + user_id + self.getUserFileSuffix(file_type)
|
||||
|
||||
def getGroupFilePath(self,group_id,file_type):
|
||||
return self.getGroupFilesFolderPath(file_type) + str(group_id) + '.txt' + self.getFileExtension(file_type);
|
||||
return self.getGroupFilesFolderPath(file_type) + str(group_id) + '.txt' + self.getFileExtension(file_type)
|
||||
|
||||
def getAccumulatedFilePath(self,file_type):
|
||||
return self.getDataFolderPath(file_type) + 'accumulated.json' + self.getFileExtension(file_type);
|
||||
return self.getDataFolderPath(file_type) + 'accumulated.json' + self.getFileExtension(file_type)
|
||||
Reference in New Issue
Block a user