Added pyperclip module copy feature for dec(msg)

Also now empty msgs will not be encrypted.
This commit is contained in:
Kaushal Kumar Agarwal 2018-06-25 22:36:57 +05:30 committed by GitHub
parent 0c367699ed
commit 24bae73368
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
main.py
View File

@ -9,6 +9,7 @@ import subprocess
from more_itertools import sliced
import json
from fpdf import FPDF
import pyperclip
# This function splits the secret and returns a list of shares
def splitSecret(secret,threshold,splits):
@ -251,13 +252,16 @@ class GUI:
splits = int(self.PE1.get())
threshold = int(self.PE2.get())
if (threshold > splits or threshold<2) :
messagebox.showwarning("Invalid!", "Minimum-Shares-Required should be greater than 2 and lesser than or equal to Total-Shares ")
messagebox.showwarning("Invalid!", "Minimum-Shares-Required should be greater than 2 and lesser than or equal to Total-Shares")
return
self.PE1.config(state='disabled')
self.PE2.config(state='disabled')
self.PTextBox.config(state='disabled')
key = keyGen()
plaintext = self.PTextBox.get("1.0",'end-1c')
if (plaintext== ""):
messagebox.showwarning("Invalid!","Message Text Box Cannot Be Left Blank!")
return
shared_key = splitSecret(key,threshold,splits)
ciphertext = encryptMsg(plaintext,key)
try:
@ -345,7 +349,9 @@ class GUI:
GScroll.pack(side = RIGHT,fill = Y)
GTextFrame.grid(column=1,columnspan=2)
self.GBackButton=Button(self.GetFrame,text="Back",command=self.Main)
self.GBackButton.grid(column=1)
self.GBackButton.grid(column=1)
self.CopyButton=Button(self.GetFrame,text="Copy",command=pyperclip.copy(plaintext))
self.CopyButton.grid(column=1)
root = Tk()
root.title("FloSecret")