mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2024-11-25 11:41:03 +01:00
Finished work for today
This commit is contained in:
parent
e4217afe64
commit
e5806992ce
@ -36,6 +36,9 @@ python scripts/main.py --mode cleanup --user "1" && python scripts/main.py --mo
|
|||||||
# setup
|
# setup
|
||||||
```bash
|
```bash
|
||||||
pip install numpy
|
pip install numpy
|
||||||
|
gpg
|
||||||
|
python
|
||||||
|
pip
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further Information
|
## Further Information
|
||||||
|
@ -20,8 +20,8 @@ class Decryption(AbstractSplittedSecret):
|
|||||||
file.close()
|
file.close()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def getNeededEncryptersAmount(self):
|
def setNeededEncryptersAmount(self):
|
||||||
return len(str(list(self.user_data['groups'].keys())[0]))-1
|
self.needed_encrypters_amount = len(str(list(self.user_data['groups'].keys())[0]))-1
|
||||||
|
|
||||||
def decryptFile(self,password,input_file_path,output_file_path):
|
def decryptFile(self,password,input_file_path,output_file_path):
|
||||||
self.executeCommand('gpg --batch --passphrase "'+ password + '" -o "' + output_file_path +'" "'+ input_file_path+'"')
|
self.executeCommand('gpg --batch --passphrase "'+ password + '" -o "' + output_file_path +'" "'+ input_file_path+'"')
|
||||||
@ -35,6 +35,7 @@ class Decryption(AbstractSplittedSecret):
|
|||||||
output_file_path = self.getAccumulatedFilePath("decrypted")
|
output_file_path = self.getAccumulatedFilePath("decrypted")
|
||||||
self.decryptFile(self.user_password, input_file_path, output_file_path)
|
self.decryptFile(self.user_password, input_file_path, output_file_path)
|
||||||
|
|
||||||
def setUserData(self):
|
def initializeData(self):
|
||||||
self.decryptUserFile()
|
self.decryptUserFile()
|
||||||
self.user_data = self.loadJsonFile(self.user_file_decrypted_path)
|
self.user_data = self.loadJsonFile(self.user_file_decrypted_path)
|
||||||
|
self.setNeededEncryptersAmount()
|
@ -43,7 +43,7 @@ if __name__ == '__main__':
|
|||||||
decrypt.setUserPassword(getpass())
|
decrypt.setUserPassword(getpass())
|
||||||
print("Decrypting User File...")
|
print("Decrypting User File...")
|
||||||
try:
|
try:
|
||||||
decrypt.setUserData();
|
decrypt.initializeData();
|
||||||
break;
|
break;
|
||||||
except:
|
except:
|
||||||
print("Wrong password :(")
|
print("Wrong password :(")
|
||||||
@ -51,7 +51,7 @@ if __name__ == '__main__':
|
|||||||
decrypt.setUserPassword(args.user_password)
|
decrypt.setUserPassword(args.user_password)
|
||||||
print("Decrypting User File...")
|
print("Decrypting User File...")
|
||||||
try:
|
try:
|
||||||
decrypt.setUserData();
|
decrypt.initializeData();
|
||||||
except:
|
except:
|
||||||
print("Wrong password :(")
|
print("Wrong password :(")
|
||||||
exit()
|
exit()
|
||||||
@ -61,7 +61,7 @@ if __name__ == '__main__':
|
|||||||
print("user_id: " + contact_id)
|
print("user_id: " + contact_id)
|
||||||
for label in decrypt.user_data['contacts'][contact_id]:
|
for label in decrypt.user_data['contacts'][contact_id]:
|
||||||
print(label + ": " + decrypt.user_data['contacts'][contact_id][label])
|
print(label + ": " + decrypt.user_data['contacts'][contact_id][label])
|
||||||
print("You need at least <<" + str(decrypt.getNeededEncryptersAmount()) +">> aditional people to decrypt the secret.")
|
print("You need at least <<" + str(decrypt.needed_encrypters_amount) +">> other person to decrypt the secret.")
|
||||||
exit()
|
exit()
|
||||||
print("Decrypting accumulated file...")
|
print("Decrypting accumulated file...")
|
||||||
decrypt.setUserPassword(args.master_password)
|
decrypt.setUserPassword(args.master_password)
|
||||||
|
Loading…
Reference in New Issue
Block a user