-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.py
More file actions
67 lines (58 loc) · 2.29 KB
/
Copy pathMenu.py
File metadata and controls
67 lines (58 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import GoogleApI
import Encryption
import sys
#import mysql.connector as mariadb
#connect
#mydb = mariadb.connect(
# user = "test",
# password = "password",
# host = "localhost",
# database = "GoogleEn_Db"
#)
#create cursor
#mycursor = mydb.cursor()
def menu():
try:
while True:
userIn = input("|U - Upload file | D - Dowload file | E - Exit").lower()
if(userIn == "u"):
while True:
print("upload file:")
print("\nEnter m to return to main menu.\n")
userIn = input("Enter file name: ")
if(userIn == "m"):
break
else:
Encryption.encrpyt(userIn)
upload = userIn + ".enc"
GoogleApI.uploadFile(upload)
GoogleApI.uploadFile('AESKEY')
elif(userIn == "e"):
print("Exiting")
sys.exit()
elif(userIn == "d"):
while True:
print("Dowload:\n")
userIn1 = input("\n|S - Search for a file|D - Dowload File|E - exit to main menu|\n ").lower()
if(userIn1 == "s"):
userIn = input("Enter file name: ")
GoogleApI.searchFile(userIn)
elif(userIn1 == "d"):
print("Enter names of encrypted file then encrypted keys\n")
userIn=input("Enter file name: ")
userIn2=input("Enter file name: ")
fileID = GoogleApI.fileID(userIn)
fileID2= GoogleApI.fileID(userIn2)
GoogleApI.downloadFile(fileID,userIn)
GoogleApI.downloadFile(fileID2,userIn2)
Encryption.decryption(userIn2,userIn)
elif(userIn == "e"):
break
else:
print("Wrong input try again!")
else:
print("Wrong input try again!")
except Exception:
pass
#with open("user.p", "rb") as myFile:
# data = pickle.load(myFile)