-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPassSave.py
More file actions
189 lines (169 loc) · 6.06 KB
/
PassSave.py
File metadata and controls
189 lines (169 loc) · 6.06 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
import PassEnd
import sqlite3
import sys
import subprocess
from SendEmail import Sender
import PassEnd
def deleteTable():
connect = sqlite3.connect('login.db')
cur = connect.cursor()
cur.execute("DROP TABLE login")
def delete_Table():
connect = sqlite3.connect('email.db')
cur = connect.cursor()
cur.execute("DROP TABLE email")
def create_new_login():
connect = sqlite3.connect('login.db')
cur = connect.cursor()
cur.execute("""CREATE TABLE login (
loginpassword text
)""")
connect.commit()
connect.close()
def create_new_email():
connect = sqlite3.connect('email.db')
cur = connect.cursor()
cur.execute("""CREATE TABLE email (
email text
)""")
connect.commit()
connect.close()
def create_password_database():
connect = sqlite3.connect('passwords.db')
cur = connect.cursor()
cur.execute(""" CREATE TABLE passwords (
passwords text
)""")
def add_email(email):
connect = sqlite3.connect('email.db')
cur = connect.cursor()
cur.execute("INSERT INTO email VALUES (?)", (email,))
connect.commit()
connect.close()
def add_login(password):
connect = sqlite3.connect('login.db')
cur = connect.cursor()
#newpassword = PassEnd.encryption(password)
#print(newpassword)
cur.execute("INSERT INTO login VALUES (?)", (password,))
connect.commit()
connect.close()
def login():
global count
global begin
count = '2'
if dec == 'N':
login_pass = input("Make a password for enter!")
login_email = input("Type in an email!")
create_new_login()
create_new_email()
PassEnd.create()
add_login(login_pass)
add_email(login_email)
print("You made a new password!")
count = '2'
elif dec == 'Y':
#PassEnd.create()
newpassword = input("Type in password")
#encryptednewpassword = PassEnd.encryption(newpassword)
connect = sqlite3.connect('login.db')
cur = connect.cursor()
check = cur.execute("SELECT rowid, * FROM login")
for c in check:
if newpassword == c[1]: #encrpytednewpassword instead
count = '2'
elif newpassword != c[1]:
count = '22'
connect.commit()
connect.close()
else:
print("Please put a 'Y' or 'N' please!")
if __name__ == '__main__':
#Aran was here
#Xalan was here
count = '2'
dec = input("Do you have a login password? (Y/N)")
begin = 0
login()
if len(count) == 2:
print("WRONG!!")
elif len(count) == 1:
print("WELCOME TO PASSWORD SAVER!!")
while begin==0:
print("\n1. Show All Password")
print("2. Show One Password")
print("3. Add Password")
print("4. Delete Password")
print("5. Update Password")
print("6. Delete Password Table")
print("7. Change Login Password")
print("8. Exit")
print("Select an option......")
option = input()
if option == '1':
PassEnd.display()
elif option == '2':
website = input("Which website do you want to look for?")
PassEnd.one_look(website)
elif option == '3':
website = input("Type in your website:")
email = input("Type in your email: ")
user = input("Type in your username: ")
password = input("Type in your password: ")
PassEnd.add(website, email, user, password)
PassEnd.check_dup()
elif option == '4':
PassEnd.display()
id = input("Select ID to delete")
PassEnd.delete(id)
PassEnd.order()
elif option == '5':
# PassEnd.display()
# id = input("Select the ID that you want to update")
# email = input("Whats your new email?")
# user = input("Whats your new username?")
# password = input("Whats your new passsword?")
# PassEnd.update(email, user, password, id)
# print("UPDATED!")
print("What do you want to update?: email, username, or password")
choice = input()
if choice == "email":
PassEnd.display()
id = input("Select ID to update")
new_email = input("what's your new email?")
PassEnd.email_update(new_email, id)
print("Email Updated!")
elif choice == "username":
PassEnd.display()
id = input("Select ID to update")
new_user = input("what's your new username?")
PassEnd.user_update(new_user, id)
print("Username Updated!")
elif choice == "password":
PassEnd.display()
id = input("Select ID to update")
new_password = input("what's your new password?")
PassEnd.password_update(new_password, id)
print("Password Updated!")
elif option == '6':
PassEnd.drop()
PassEnd.create()
print("All passwords deleted!")
elif option == '7':
try:
new_password = input("What is your new login password?")
new_email = input("Type in an email!")
send = Sender.sender(new_email)
deleteTable()
delete_Table()
create_new_login()
create_new_email()
add_login(new_password)
add_email(new_email)
print("New password changed!")
except:
print("Password change not successful!")
elif option == '8':
break
else:
print("Not a Valid choice! Pick again!")