diff --git a/README.md b/README.md index 5a3a8f5..b28b376 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ python scripts/main.py --mode cleanup ``` ### delete decrypted data -To delete all encrypted data execute: +To delete all decrypted data execute: ```bash python scripts/main.py --mode cleanup --file-types decrypted @@ -65,7 +65,7 @@ python scripts/main.py --mode decrypt --user "<>" ``` ### addtional instructions -In the [INSTRUCTIONS.md](./Instruction.md) file the master encrypter can leave additional instructions. +In the [INSTRUCTIONS.md](./INSTRUCTIONS.md) file the master encrypter can leave additional instructions. ## encrypt @@ -74,9 +74,32 @@ In the [INSTRUCTIONS.md](./Instruction.md) file the master encrypter can leave a python scripts/main.py --secret-holders-amount "<>" --quota "<>" --mode encrypt --master-password "<>" --input-directory "<>" ``` -### encrypt master password +### generate encryption data To encrypt the master-password file and to create the neccessary encrypted meta data execute: ```bash python scripts/main.py --secret-holders-amount "<>" --quota "<>" --mode encrypt --add-user-information --master-password "<>" --meta ``` + +### generate encryption data with user info +To encrypt the master-password file and to create the neccessary encrypted meta data with additional user infos data execute: + +```bash +python scripts/main.py --secret-holders-amount "3" --quota "50" --mode encrypt --add-user-information --master-password "<>" --meta --add-user-information << EOL +Nutzer 1 ++123456-1 +test@test1.de +Addresse Nutzer 1 +Zusätzliche Notizen Nutzer 1 +Nutzer 2 ++123456-2 +test@test2.de +Addresse Nutzer 2 +Zusätzliche Notizen Nutzer 2 +Nutzer 3 ++123456-3 +test@test3.de +Addresse Nutzer 3 +Zusätzliche Notizen Nutzer 3 +EOL +``` diff --git a/scripts/classes/Cleanup.py b/scripts/classes/Cleanup.py index b6ab248..ecc6099 100644 --- a/scripts/classes/Cleanup.py +++ b/scripts/classes/Cleanup.py @@ -4,13 +4,16 @@ class Cleanup(): def __init__(self,cli,paths): self.cli = cli self.paths = paths - - def getAllFilePaths(self,file_type): - all_file_paths = [ + + def getMetaFilePaths(self,file_type): + return [ self.paths.getGroupFilesFolderPath(file_type), self.paths.getUserFilesPath(file_type), self.paths.getAccumulatedFilePath(file_type) - ] + ] + + def getAllFilePaths(self,file_type): + all_file_paths = self.getMetaFilePaths(file_type) if file_type == Paths.TYPE_DECRYPTED: all_file_paths.append(self.paths.getDecryptedMainDataStandartFolder()) return all_file_paths @@ -32,6 +35,10 @@ class Cleanup(): pass self.cleanupFiles(Paths.TYPE_DECRYPTED) + def cleanupMetaData(self,file_type): + for folder_path in self.getMetaFilePaths(file_type): + self.deleteAllFilesInFolder(folder_path) + def deleteAll(self): self.cleanupFiles(Paths.TYPE_ENCRYPTED) self.cleanupFiles(Paths.TYPE_DECRYPTED) \ No newline at end of file diff --git a/scripts/main.py b/scripts/main.py index 022ad20..d9967e5 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -166,6 +166,8 @@ try: encrypt.addInformationToUser(user_id, label, str(input())) encrypt.compileData() if args.meta_data is True: + print('Cleaning up encrypted meta data.') + cleanup.cleanupMetaData(Paths.TYPE_ENCRYPTED) print("Create and encrypt meta data.") encrypt.encryptMetaData() if args.input_directory is not None: