Compare commits

..

1 Commits

7 changed files with 17 additions and 25 deletions

7
.github/FUNDING.yml vendored
View File

@@ -1,7 +0,0 @@
github: kevinveenbirkenbach
patreon: kevinveenbirkenbach
buy_me_a_coffee: kevinveenbirkenbach
custom: https://s.veen.world/paypaldonate

View File

@@ -1,6 +1,4 @@
# Split Secret (sisec) 🔐
[![GitHub Sponsors](https://img.shields.io/badge/Sponsor-GitHub%20Sponsors-blue?logo=github)](https://github.com/sponsors/kevinveenbirkenbach) [![Patreon](https://img.shields.io/badge/Support-Patreon-orange?logo=patreon)](https://www.patreon.com/c/kevinveenbirkenbach) [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20me%20a%20Coffee-Funding-yellow?logo=buymeacoffee)](https://buymeacoffee.com/kevinveenbirkenbach) [![PayPal](https://img.shields.io/badge/Donate-PayPal-blue?logo=paypal)](https://s.veen.world/paypaldonate)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![GitHub stars](https://img.shields.io/github/stars/kevinveenbirkenbach/split-secret.svg?style=social)](https://github.com/kevinveenbirkenbach/split-secret/stargazers)

View File

@@ -21,7 +21,7 @@ class Cleanup():
def deleteAllFilesInFolder(self,folder_path):
try:
self.cli.executeCommand('rm -r ' + folder_path + '*')
except Exception:
except Exception as error:
pass
def cleanupFiles(self,file_type):
@@ -31,7 +31,7 @@ class Cleanup():
def cleanupForUser(self,user):
try:
self.cli.executeCommand('find "' + self.paths.getDataFolderPath(Paths.TYPE_ENCRYPTED) + '" -not -name "*' + str(user) +'*" -type f -print | xargs rm -v')
except Exception:
except Exception as error:
pass
self.cleanupFiles(Paths.TYPE_DECRYPTED)

View File

@@ -9,7 +9,7 @@ class AutomaticIdentificationImpossibleException(Exception):
class Decryption():
def __init__(self,cli,paths):
self.user_id='0'
self.user_id='0';
self.user_password=''
self.cli = cli
self.paths = paths

View File

@@ -1,6 +1,7 @@
import random
import string
import math
import numpy
import re
import json
from .Paths import Paths
@@ -31,13 +32,13 @@ class Encryption():
user_count = 1
while user_count <= self.amount_of_secret_holders:
self.user_mapped_data[str(user_count)] = {"groups":{},"user_password":self.createPassword(self.USER_PASSWORD_LENGTHS),"about":{}}
user_count += 1
user_count += 1;
def initializeGroupData(self):
self.group_mapped_data = {}
def addInformationToUser(self,user_id,label,content):
self.user_mapped_data[user_id]['about'][label] = content
self.user_mapped_data[user_id]['about'][label] = content;
def getCoSecretHoldersRange():
return range(Encryption.MINIMUM_SECRET_HOLDERS,(Encryption.MAXIMUM_SECRET_HOLDERS+1))
@@ -88,14 +89,14 @@ class Encryption():
password_group_name = ''.join(sorted(str(index)))
if self.isGroupValid(password_group_name):
password_group_index_int = int(password_group_name)
if password_group_index_int not in self.group_mapped_data:
if not password_group_index_int in self.group_mapped_data:
self.group_mapped_data[password_group_index_int] = {}
self.group_mapped_data[password_group_index_int]['members'] = {}
self.group_mapped_data[password_group_index_int]['password'] = ''
password = ''
for secret_holder_index in password_group_name:
self.group_mapped_data[password_group_index_int]['members'][secret_holder_index]={}
particial_password_length= int(self.OVERALL_PASSWORD_LENGTHS*self.quota_factor)
particial_password_length= int(self.OVERALL_PASSWORD_LENGTHS*self.quota_factor);
password_part = self.createPassword(particial_password_length)
self.group_mapped_data[password_group_index_int]['members'][secret_holder_index] = password_part
password += password_part

View File

@@ -34,10 +34,10 @@ class Paths():
return '.json' + self.getFileExtension(file_type)
def getUserFilePath(self,user_id,file_type):
return self.getUserFilesPath(file_type) + user_id + self.getUserFileSuffix(file_type)
return self.getUserFilesPath(file_type) + user_id + self.getUserFileSuffix(file_type);
def getGroupFilePath(self,group_id,file_type):
return self.getGroupFilesFolderPath(file_type) + str(group_id) + '.txt' + self.getFileExtension(file_type)
return self.getGroupFilesFolderPath(file_type) + str(group_id) + '.txt' + self.getFileExtension(file_type);
def getAccumulatedFilePath(self,file_type):
return self.getDataFolderPath(file_type) + 'accumulated.json' + self.getFileExtension(file_type)
return self.getDataFolderPath(file_type) + 'accumulated.json' + self.getFileExtension(file_type);

View File

@@ -1,7 +1,7 @@
import argparse
from classes.Encryption import Encryption
from classes.Cleanup import Cleanup
from classes.Decryption import Decryption
from classes.Decryption import Decryption, AutomaticIdentificationImpossibleException
from getpass import getpass
import traceback
from classes.Cli import Cli
@@ -56,7 +56,7 @@ try:
print("Deleting all encrypted and decrypted files.")
cleanup.deleteAll()
standard_exit()
print("Deleting all files which aren't related to user: " + str(args.user))
print("Deleting all files which aren't related to user: " + str(args.user));
cleanup.cleanupForUser(args.user)
standard_exit()
print("Deleting all " + args.file_types + " files.")
@@ -94,15 +94,15 @@ try:
decrypt.setUserPassword(getpass())
print("Decrypting User File...")
try:
decrypt.initializeUserDataDecryption()
break
decrypt.initializeUserDataDecryption();
break;
except Exception as error:
print("An error occured. Propably you typed in a wrong password :( The error is: " + str(error))
else:
decrypt.setUserPassword(args.user_password)
print("Decrypting User File...")
try:
decrypt.initializeUserDataDecryption()
decrypt.initializeUserDataDecryption();
except Exception as error:
print("An error occured. Propably you passed a wrong password :( The error is: " + str(error))
clean_exit()
@@ -144,7 +144,7 @@ try:
print("\nDecrypting group password file.\n")
decrypt.initializeGroupDataEncryption()
print("THE MASTER PASSWORD IS: " + decrypt.getMasterPassword())
break
break;
except:
print("An unexpected error occured: \n" + traceback.format_exc())
print("Decrypting main data.")