mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2024-11-22 10:11:05 +01:00
Implemented basic cleanup
This commit is contained in:
parent
f547b79675
commit
fa82f4d5da
@ -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/"
|
@ -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
|
||||
self.deleteAllEncryptedFiles()
|
@ -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
|
@ -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"
|
||||
|
@ -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':
|
||||
|
Loading…
Reference in New Issue
Block a user