mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2024-11-01 00:53:11 +01:00
Optimized file structur
This commit is contained in:
parent
1017fa2257
commit
550b689c12
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
data/decrypted/splitted_password_files/*
|
data/decrypted/group_files/*
|
||||||
data/decrypted/password_files/*
|
data/decrypted/user_files/*
|
||||||
data/encrypted/splitted_password_files/*
|
data/encrypted/group_files/*
|
||||||
data/encrypted/password_files/*
|
data/encrypted/user_files/*
|
||||||
|
accumulated.json*
|
||||||
__pycache__
|
__pycache__
|
@ -3,7 +3,9 @@ from .Cli import Cli
|
|||||||
class AbstractSplittedSecret(Cli):
|
class AbstractSplittedSecret(Cli):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Cli, self).__init__()
|
super(Cli, self).__init__()
|
||||||
self.encrypted_splitted_password_files_folder = "data/encrypted/splitted_password_files/"
|
self.encrypted_folder="data/encrypted/"
|
||||||
self.encrypted_password_files_folder = "data/encrypted/password_files/"
|
self.decrypted_folder="data/encrypted/"
|
||||||
self.encrypted_password_files_folder = "data/encrypted/password_files/"
|
self.encrypted_group_files_folder = self.encrypted_folder + "group_files/"
|
||||||
self.decrypted_password_files_folder="data/decrypted/password_files/"
|
self.decrypted_group_files_folder = self.decrypted_folder + "group_files/"
|
||||||
|
self.encrypted_user_files_folder = self.encrypted_folder + "user_files/"
|
||||||
|
self.decrypted_user_files_folder = self.encrypted_folder + "user_files/"
|
@ -2,8 +2,8 @@ from .AbstractSplittedSecret import AbstractSplittedSecret
|
|||||||
class Cleanup(AbstractSplittedSecret):
|
class Cleanup(AbstractSplittedSecret):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Cleanup, self).__init__()
|
super(Cleanup, self).__init__()
|
||||||
self.encrypted_files_folders = [self.decrypted_password_files_folder,self.decrypted_password_files_folder]
|
self.encrypted_files_folders = [self.decrypted_group_files_folder,self.decrypted_user_files_folder]
|
||||||
self.decrypted_files_folders = [self.encrypted_splitted_password_files_folder,self.encrypted_password_files_folder]
|
self.decrypted_files_folders = [self.encrypted_group_files_folder,self.encrypted_user_files_folder]
|
||||||
|
|
||||||
def deleteAllFilesInFolder(self,folder_path):
|
def deleteAllFilesInFolder(self,folder_path):
|
||||||
try:
|
try:
|
||||||
|
@ -89,7 +89,7 @@ class Generate(AbstractSplittedSecret):
|
|||||||
|
|
||||||
def generateEncryptedGroupFiles(self):
|
def generateEncryptedGroupFiles(self):
|
||||||
for password_group_index_int in self.group_mapped_data:
|
for password_group_index_int in self.group_mapped_data:
|
||||||
encrypted_splitted_password_file = AbstractSplittedSecret().encrypted_splitted_password_files_folder + str(password_group_index_int) + ".txt"
|
encrypted_splitted_password_file = AbstractSplittedSecret().encrypted_group_files_folder + str(password_group_index_int) + ".txt"
|
||||||
self.encryptStringToFile(self.master_password,encrypted_splitted_password_file,self.group_mapped_data[password_group_index_int]['password'])
|
self.encryptStringToFile(self.master_password,encrypted_splitted_password_file,self.group_mapped_data[password_group_index_int]['password'])
|
||||||
|
|
||||||
def encryptToJsonFile(self,data,file_path,password):
|
def encryptToJsonFile(self,data,file_path,password):
|
||||||
@ -97,11 +97,11 @@ class Generate(AbstractSplittedSecret):
|
|||||||
|
|
||||||
def encryptUserMappedData(self):
|
def encryptUserMappedData(self):
|
||||||
for user_id in self.user_mapped_data:
|
for user_id in self.user_mapped_data:
|
||||||
file_path=self.encrypted_password_files_folder+user_id+'.json'
|
file_path=self.encrypted_user_files_folder+user_id+'.json'
|
||||||
self.encryptToJsonFile(self.user_mapped_data[user_id]['groups'],file_path,self.user_mapped_data[user_id]['user_password'])
|
self.encryptToJsonFile(self.user_mapped_data[user_id]['groups'],file_path,self.user_mapped_data[user_id]['user_password'])
|
||||||
|
|
||||||
def encryptAccumulatedMappedData(self):
|
def encryptAccumulatedMappedData(self):
|
||||||
file_path=self.encrypted_password_files_folder+'accumulated.json'
|
file_path=self.encrypted_folder+'accumulated.json'
|
||||||
data={"user_mapped": self.user_mapped_data, "group_mapped": self.group_mapped_data}
|
data={"user_mapped": self.user_mapped_data, "group_mapped": self.group_mapped_data}
|
||||||
self.encryptToJsonFile(data,file_path,self.master_password)
|
self.encryptToJsonFile(data,file_path,self.master_password)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user