diff --git a/scripts/classes/AbstractSplittedSecret.py b/scripts/classes/AbstractSplittedSecret.py index f5c5748..f53473a 100644 --- a/scripts/classes/AbstractSplittedSecret.py +++ b/scripts/classes/AbstractSplittedSecret.py @@ -1,3 +1,6 @@ -class AbstractSplittedSecret: +from .Cli import Cli + +class AbstractSplittedSecret(Cli): def __init__(self): + super(Cli, self).__init__() self.encrypted_splitted_password_files_folder = "data/encrypted/splitted_password_files/" \ No newline at end of file diff --git a/scripts/classes/Cleanup.py b/scripts/classes/Cleanup.py index bf09b3f..e0efc7e 100644 --- a/scripts/classes/Cleanup.py +++ b/scripts/classes/Cleanup.py @@ -1,7 +1,10 @@ from .AbstractSplittedSecret import AbstractSplittedSecret class Cleanup(AbstractSplittedSecret): def __init__(self): - pass + super(Cleanup, self).__init__() + def deleteAllEncryptedFiles(self): + self.executeCommand('rm -v ' + self.encrypted_splitted_password_files_folder + '*') + print(self.getCommandString()) + print(self.getOutputString()) def deleteAll(self): - - pass \ No newline at end of file + self.deleteAllEncryptedFiles() \ No newline at end of file diff --git a/scripts/classes/Cli.py b/scripts/classes/Cli.py index 04b1de2..eec05c9 100644 --- a/scripts/classes/Cli.py +++ b/scripts/classes/Cli.py @@ -24,7 +24,7 @@ class Cli(object): return self.output def getOutputString(self): - return str(' '.join(self.output)) + return str('\n'.join(self.output)) def getCommandString(self): return self.command \ No newline at end of file diff --git a/scripts/classes/Generate.py b/scripts/classes/Generate.py index b7023cb..f5f37a0 100644 --- a/scripts/classes/Generate.py +++ b/scripts/classes/Generate.py @@ -3,14 +3,12 @@ import string import math import numpy import re -from .Cli import Cli from .AbstractSplittedSecret import AbstractSplittedSecret -class Generate(AbstractSplittedSecret,Cli): +class Generate(AbstractSplittedSecret): def __init__(self, amount_of_secret_holders, decryption_quota): super(Generate, self).__init__() - super(Cli, self).__init__() self.amount_of_secret_holders = amount_of_secret_holders self.decryption_quota = decryption_quota self.decrypted_master_password_file_path="data/decrypted/password_files/master-password.txt" diff --git a/scripts/main.py b/scripts/main.py index ed30f15..dce2f90 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -4,13 +4,14 @@ from classes.Cleanup import Cleanup if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument('-m', '--mode',type=str, dest='mode',required=True,choices=['cleanup','generate']) - parser.add_argument('-a', '--amount',type=int, dest='amount_of_secret_holders',required=False,choices=range(1,9)) - parser.add_argument('-q', '--quota', type=int, dest='decryption_quota', choices=range(1,101),required=False) + parser.add_argument('--mode',type=str, dest='mode',required=True,choices=['cleanup','generate']) + parser.add_argument('--amount',type=int, dest='amount_of_secret_holders',required=False,choices=range(1,9)) + parser.add_argument('--quota', type=int, dest='decryption_quota', choices=range(1,101),required=False) args = parser.parse_args() if args.mode == 'cleanup': cleanup = Cleanup() + cleanup.deleteAll() exit() if args.mode == 'generate':