VELAMMAL VIDHYASHRAM
SURAPET
COMPUTER SCIENCE
Topic: Password Management System
Academic year: 2021-2022
Done by
TEJESWARAN.M
XII-A2
BONAFIDE CERTIFICATE
This is to certify that this COMPUTER SCIENCE Project on the topic
“PASSWORD MANAGEMENT SYSTEM” has been successfully completed by
M.TEJESWARAN of class XII-A2, Roll.no………………... at Velammal Vidhyashram,
Surapet, for the partial fulfilment of this project as a part of All India Senior School
Certificate Examination-CBSE, New Delhi for the academic Year 2021- 2022.
Date: ……………………..
Signature of Principal Teacher in charge
Signature of the Signature of the
Internal Examiner External Examiner
2
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on the encouragement and
guidelines of many others. I take this opportunity to express my gratitude to the people who have been
instrumental in the successful completion of this project.
I express deep sense of gratitude to almighty God for giving me strength for the successful
completion of the project.
I express my heartfelt gratitude to my parents for constant encouragement while carrying out this
project.
I gratefully acknowledge the contribution of the individuals who contributed in bringing this project
up to this level, who continues to look after me despite my flaws,
I express my deep sense of gratitude to the luminary The Principal, Mrs. Chitra Madhavan
Bharathi WingVelammal Vidhyashram Surapet who has been continuously motivating and extending
their helping hand to us.
I express my sincere thanks to the CEO. Mr. VelMurugan Velammal Vidhyashram Surapet,
for providing these opportunity in doing these project
My sincere thanks to Mrs. Kavitha.K, Teacher In-charge, A guide, Mentor all the above a friend,
who critically reviewed my project and helped in solving each and every problem, occurred during
implementation of the project
The guidance and support received from all the members who contributed and who are contributing
to this project, was vital for the success of the project. I am grateful for their constant support and help.
3
TABLE OF CONTENT:
PAGE
S.NO CONTENTS NO.
1. ABSTRACT 5
2. SYSTEM CONFIGURATION 5
3. INTRODUCTION 6
4. OBJECTIVES OF THE PROJECT 6
5. PROPOSED SYSTEM 6
6. LIBRARIES AND FUNCTIONS USED 7
7. MYSQL QUERIES USED IN THIS PROJECT 8
8. SOURCE CODE 9
9. OUTPUT(SCREENSHOT) 26
10. CONCLUSION 28
11. BIBILOGRAPHY 29
4
ABSTRACT:
Password Management System project is developed using Python and MySQL Database. This is a simple
project which helps user in managing their password in a easy and encrypted way. The main aim of this
project is to manage password for different accounts. Password Management system project in Python is a
simple console application. In this project, users can perform certain functions like add, view and delete.
SYSTEM CONFIGURATION:
HARDWARE CONFIGURATION
Microsoft windows 7 professional/windows 8/windows 8.2:
Processor : Intel Core i3 or equivalent
Memory : 2 GB (32-bit), 4 GB(64-bit)
Disk space : 1.5 GB of free disk space
SOFTWARE REQUIREMENTS
1 GB RAM (2 GB+ recommended)
9-58 GB free hard disk space depending on edition and configuration, including space
required for temporary files
DVD-ROM drive (if installing from a Media Kit DVD)
Basic GPU – Any vendor DirectX 9.0 class or better (Pixel Shader Level2)
Intel® Pentium® or compatible, 1.6 GHz minimum (2GHz+recommended)
1024x768 or higher-resolution monitor
MOUSE OR OTHER POINTING DEVICE
5
INTRODUCTION
"PASSWORD MANAGEMENT SYSTEM" This project is to manage passwords for different accounts on
the internet. The user shall be able to save all the username and passwords information of the accounts he
holds on the internet using this system. These details shall be saved in the database in encrypted format. This
will help the user to remember different usernames and passwords for accounts on the internet. The user shall
be able to add account, edit and delete account using the system. . All the details related to the account like the
user name, password, account type, etc shall be stored.
OBJECTIVES OF THE PROJECT
The objective of this project is to let the students apply the programming knowledge into a real-
world situation/problem and exposed the student show programming skills helps in developing a good
software.
1. Write programs utilizing modern software tools.
2. Apply object oriented programming principles effectively when developing small to medium sized
projects.
3. Write effective procedural code to solve small to medium sized problems.
4. Students will demonstrate a breadth of knowledge. In computer science, as exemplified in the areas
of systems, theory and software development.
5. Students will demonstrate ability to conduct are search or applied Computer Science project,
requiring writing and presentation skills which exemplify scholarly style in computer science.
PROPOSED SYSTEM
Today one cannot afford to rely on the fallible human beings of be really wants to stand against
today’s merciless competition where not to wise saying “to err is human” no longer valid, it’s outdated to
rationalize your mistake. So, to keep pace with time, to bring about the best result without malfunctioning
and greater efficiency so to replace the unending heaps of flies with a much sophisticated hard disk of the
computer.
6
One has to use the data management software. Software has been an ascent in atomization various
organizations. Many software products working are now in markets, which have helped in
making the organizations work easier and efficiently. Data management initially had to maintain a lot of
ledgers and a lot of paperwork has to be done but now software product on this organization has made their
work faster and easier. Now only this software has to be loaded on the computer and work can be done. This
prevents a lot of time and money. The work becomes fully automated and any information regarding the
organization can be obtained by clicking the button. Moreover, now it’s an age of computers of and
automating such an organization gives the better look.
LIBRARIES AND FUNCTIONS USED:
1. mysqlconnector - MySQL Connector/Python enables Python programs to access MySQL databases,
using an API that is compliant with the Python Database API Specification v2.0 (PEP 249). It is written in
pure Python and does not have any dependencies except for the Python Standard Library.
2. Cryptography - Cryptography package that helps us encrypt and decrypt data. The fernet module of the
cryptography package has inbuilt functions for the generation of the key, encryption of plaintext into
ciphertext, and decryption of ciphertext into plaintext using the encrypt and decrypt methods
respectively. The fernet module guarantees that data encrypted using it cannot be further manipulated
or read without the key.
7
FUNCTIONS USED: WRITE IN DETAIL ABOUT
PURPOSE OFTHE FUNCTION.
1. _init_() - The login window design.
2. log_in( ) - Verify the account, if it does not exist, ask to create new.
3. passwordstoragewindow( ) - The storage window design.
4. character_limit() - Limit the length of a stringvar to 16.
5. readnotes() - Create a extra notes window after double clicking the
Password.
6. deleterow() - Delete a password after press the backspace key or delete key from
keyboard.
7. passwordtabler( ) - Create the table where the password are
8. insertnewpassword() - Add new password to the storage.
9. on_closing() - Stop the process.
SQL QUERIES USED IN THIS PROJECT:
1. conectionDB() - This is a decorator to open and close the database.
2. createDB() - This is a function to create the database if is not yet created.
3. Loginuser() - Function to login.
4. Createuser() - Function to create new user.
5. Insertpassworddata() - Function to save new password in the storage.
6. Readpasswords() - Read all passwords from the user storage @return: a list, in each
row there is a password with its corresponding name and notes.
7. Deletepassword() - Delete a password from the user storage.
8. Readnotes() - Read a password notes.
8
SOURCE CODE:
#MAIN:
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import db
class MainApplication:
def __init__(self, master):
# the login window design
self.large_font = ('Verdana', 25)
self.small_font = ('Verdana', 10)
self.user = tk.StringVar()
self.password = tk.StringVar()
self.master = master
self.master.title("Password Storage")
self.master.resizable(False, False)
9
self.loginLabel = tk.Label(self.master, text="**Login**", width=3, height=2,
font=self.large_font)
self.loginLabel.grid(row=0, column=1, sticky=tk.W+tk.E+tk.N+tk.S , padx=10,
pady=5)
self.userLabel = tk.Label(self.master, text="User:", width=3, height=3,
font=self.large_font)
self.userLabel.grid(row=1, column=1, sticky=tk.W+tk.E+tk.N+tk.S, padx=10,
pady=5)
self.userEntry = tk.Entry(self.master, textvariable=self.user, font=self.large_font)
self.userEntry.grid(row=2, column=0, padx=10, pady=5, columnspan=3)
self.userEntry.config(fg="black", justify="left")
self.passwordLabel = tk.Label(self.master, text="Password:", width=3, height=3,
font=self.large_font)
self.passwordLabel.grid(row=3, column=1, sticky=tk.W+tk.E+tk.N+tk.S,
padx=10, pady=5)
self.passwordEntry = tk.Entry(self.master, textvariable=self.password,
font=self.large_font)
10
self.passwordEntry.grid(row=4, column=0, padx=10, pady=5, columnspan=3)
self.passwordEntry.config(show="*", justify="left")
self.bottonLog = tk.Button(self.master, text="enter", width=40, height=3,
cursor="hand2", font=self.small_font, command=lambda:self.log_in())
self.bottonLog.grid(row=5, column=1, padx=10, pady=11)
self.user.trace("w", lambda *args: self.character_limit(self.user))
self.password.trace("w", lambda *args: self.character_limit(self.password))
def log_in(self):
"""Verify the account, if it does not exist, ask to create a new"""
value = db.loginUser(self.user.get(), self.password.get())
if value == "yes":
self.password = ""
self.passwordStorageWindow()
elif value == "no":
messagebox.showwarning("Incorrect Password", "You typed a wrong
password")
elif value == "error":
answer = messagebox.askquestion("Unregistered User", "Do you want to create
11
a new one?")
if answer == "yes":
db.createUser(self.user.get(), self.password.get())
self.password = ""
self.passwordStorageWindow()
def passwordStorageWindow(self):
# The storage window design
self.newNameList = tk.StringVar()
self.newPasswordList = tk.StringVar()
self.master.withdraw()
self.passwordsScreen = tk.Toplevel(self.master)
self.passwordsScreen.resizable(False, False)
self.frame1 = tk.Frame(self.passwordsScreen)
self.frame1.pack()
self.frame2 = tk.Frame(self.passwordsScreen)
self.frame2.pack()
self.addPasswordLabel = tk.Label(self.frame1, text="Add New Password",
font=self.large_font)
self.addPasswordLabel.grid(row=0, column=1, sticky=tk.W+tk.E+tk.N+tk.S)
12
self.nameLabel = tk.Label(self.frame1, text="Name:", font=self.large_font)
self.nameLabel.grid(row=1, column=0, sticky=tk.E)
self.nameEntry = tk.Entry(self.frame1, font=self.large_font,
textvariable=self.newNameList)
self.nameEntry.grid(row=1, column=1)
self.nameEntry.config(fg="black", justify="left")
self.passwordLabel = tk.Label(self.frame1, text="Password:",
font=self.large_font)
self.passwordLabel.grid(row=2, column=0, sticky=tk.E, pady=5)
self.passwordEntry = tk.Entry(self.frame1, font=self.large_font,
textvariable=self.newPasswordList)
self.passwordEntry.grid(row=2, column=1)
self.passwordEntry.config(fg="black", justify="left")
self.noteLabel = tk.Label(self.frame1, text="Notes:", font=self.large_font)
self.noteLabel.grid(row=3, column=0, sticky=tk.N+tk.E)
self.noteText = tk.Text(self.frame1,width=20,height=3, font=self.large_font)
13
self.noteText.grid(row=3, column=1)
self.scrollVertNoteText = tk.Scrollbar(self.frame1, command=self.noteText.yview)
self.scrollVertNoteText.grid(row=3, column=2, sticky="nsew")
self.noteText.config(yscrollcommand=self.scrollVertNoteText.set)
self.savePasswordButton = tk.Button(self.frame1, text="Save New Password",
width=20, height=3, cursor="hand2", font=('Arial', 13), command=lambda:
self.insertNewPassword())
self.savePasswordButton.grid(row=4, column=1)
self.label = tk.Label(self.frame2, text="Passwords List", font=("Arial",
30)).grid(row=0, columnspan=3)
self.cols = ('Password', 'Notes')
self.style = ttk.Style()
self.style.configure("mystyle.Treeview.Heading", font=('Calibri', 13, 'bold'))
self.passwordsList = ttk.Treeview(self.frame2, columns=self.cols,
style="mystyle.Treeview")
self.passwordsList.grid(row=1, column=0, columnspan=2)
self.scrollVertPasswordsList = tk.Scrollbar(self.frame2,
14
command=self.passwordsList.yview)
self.scrollVertPasswordsList.grid(row=1, column=3, sticky="nsew")
self.passwordsList.config(yscrollcommand=self.scrollVertPasswordsList.set)
self.passwordsList.heading("#0", text="Name")
self.passwordsList.column("#0", width=150)
self.passwordsList.heading("Password", text="Password")
self.passwordsList.column("Password", width=150)
self.passwordsList.heading("Notes", text="Notes")
self.passwordsList.column("Notes", width=300)
self.passwordsList.grid(row=1, column=0, columnspan=2, pady=5, padx=5)
self.passwordsList.bind("<Double-1>", self.readNotes)
self.passwordsList.bind("<BackSpace>", self.deleterow)
self.passwordsList.bind("<Delete>", self.deleterow)
self.newNameList.trace("w", lambda *args:
self.character_limit(self.newNameList))
self.newPasswordList.trace("w", lambda *args:
self.character_limit(self.newPasswordList))
self.passwordsScreen.protocol("WM_DELETE_WINDOW", self.on_closing)
15
self.passwordTabler()
def character_limit(self, entry_text):
"""limit the length of a StringVar to 16"""
value = entry_text.get()
if len(value) > 16:
entry_text.set(value[:16])
def readNotes(self, event):
""" Create a extra notes window after double clicking the password"""
name = self.passwordsList.item(self.passwordsList.selection(), "text")
notes = db.readNotes(self.user.get(), name)
if not notes:
pass
else:
self.notesScreen = tk.Toplevel(self.passwordsScreen)
self.notesScreen.title("Notes")
self.notesScreen.resizable(False, False)
self.label = tk.Label(self.notesScreen, text=notes[0][0], font=("Arial",
30)).grid(row=0, columnspan=3)
16
def deleterow(self, event):
"""Delete a password after press the backspace key or delete key from the
keyboard"""
name = self.passwordsList.item(self.passwordsList.selection(), "text")
row_selected = self.passwordsList.selection()
answer = messagebox.askquestion("Delete Password", "Are you sure you want to
delete "+name+" password?")
if answer == "yes":
db.deletePassword(self.user.get(), name)
self.passwordsList.delete(row_selected)
def passwordTabler(self):
# Create the table where the passwords are
self.tempList = db.readPasswords(self.user.get())
for i, (name, password, notes) in enumerate(self.tempList, start=1):
decoded_pass = db.cipher_suite.decrypt(password)
decoded_pass = decoded_pass.decode("utf-8")
self.passwordsList.insert("", "end", text=name, values=(decoded_pass,
notes.partition('\n')[0]))
17
def insertNewPassword(self):
# Add new password to the storage
if self.newPasswordList.get().isspace() or self.newPasswordList.get() == "" or
self.newNameList.get().isspace() or self.newNameList.get() == "":
messagebox.showwarning("Warning!", "Name and Password cannot be
empty")
else:
db.insertPasswordData(self.user.get(), self.newNameList.get(),
self.newPasswordList.get(), self.noteText.get("1.0", tk.END))
self.newNameList.set("")
self.newPasswordList.set("")
self.noteText.delete(1.0, tk.END)
messagebox.showinfo("Congratulations!", "New password added
successfully!")
self.passwordsList.delete(*self.passwordsList.get_children())
self.passwordTabler()
def on_closing(self):
# Stop the procces
if messagebox.askokcancel("Quit", "Do you want to quit?"):
root.destroy()
18
if __name__ == "__main__":
db.createDB()
root = tk.Tk()
app = MainApplication(root)
root.mainloop()
#DB:
import sqlite3
from cryptography.fernet import Fernet
key = "Be1PA8snHgb1DS6oaWek62WLE9nxipFw3o3vB4uJ8ZI=" # "secret key"
This must be kept secret
cipher_suite = Fernet(key) # This class provides both encryption and decryption
facilities.
19
def conectionDB(func):
"""This is a decorator to open and close the database"""
def wrapper(*args, **kwargs):
global myConection
global myCursor
myConection = sqlite3.connect("PasswordsDB")
myCursor = myConection.cursor()
result = func(*args, **kwargs)
myConection.commit()
myConection.close()
return result
return wrapper
@conectionDB
def createDB():
"""This is a function to create the database if is not yet created"""
try:
myCursor.execute('''
20
CREATE TABLE USERS (
USER VARCHAR(17) UNIQUE,
PASSWORD VARCHAR(17))
''')
myCursor.execute('''
CREATE TABLE PASSWORDS_DATA (
USER VARCHAR(17),
NAME VARCHAR (17),
PASSWORD VARCHAR(17),
NOTES VARCHAR(100))
''')
except sqlite3.OperationalError:
pass
@conectionDB
def loginUser(user, password):
""" Function to login
@Return: "yes" if the password is correct, "no" if it is incorrect, "error" if it
does not exist"""
myCursor.execute("SELECT PASSWORD FROM USERS WHERE
21
USER='"+user+"'")
passwordDB = myCursor.fetchall()
try:
passwordDB = cipher_suite.decrypt(passwordDB[0][0])
passwordDB = passwordDB.decode("utf-8")
if passwordDB == password:
return "yes"
else:
return "no"
except IndexError:
return "error"
@conectionDB
def createUser(user, password):
"""Function to create new user"""
password = cipher_suite.encrypt(bytes(password, encoding='utf-8'))
data = (user, password)
myCursor.execute("INSERT INTO USERS VALUES(?,?)", data)
22
@conectionDB
def insertPasswordData(user, name, password, notes):
"""Function to save new password in the storage"""
password = cipher_suite.encrypt(bytes(password, encoding='utf-8'))
data = (user, name, password, notes)
myCursor.execute("INSERT INTO PASSWORDS_DATA VALUES(?,?,?,?)", data)
@conectionDB
def readPasswords(user):
""" Read all passwords from the user storage
@return: A list, in each row there is a password with its corresponding name and
notes"""
myCursor.execute("SELECT NAME,PASSWORD,NOTES FROM
PASSWORDS_DATA WHERE USER='"+user+"'")
passwords = myCursor.fetchall()
return passwords
@conectionDB
def deletePassword(user, name):
23
""" Delete a password from the user storage
@param: the user and the name associated with the password"""
myCursor.execute("DELETE FROM PASSWORDS_DATA WHERE
USER='"+user+"' AND NAME='"+name+"'")
@conectionDB
def readNotes(user, name):
""" Read a password notes
@param: the user and the name associated with the password"""
myCursor.execute("SELECT NOTES FROM PASSWORDS_DATA WHERE
USER='"+user+"' AND NAME='"+name+"'")
notes = myCursor.fetchall()
return notes
24
OUTPUT
(SCREENSHOT)
1.
PYTHON INTERFACE USING TKINTER
2. TO CREATE A NEW USER AND MASTER PASSWORD
25
3. ADDIND PASSWORD DETAILS
4. STORED
DETAILS
26
CONCLUSION:
Password Management software is designed to track and record the account details of the user.
It has all the modules that help user to maintain all the account details like managing
Username, passwords, account type, and all other required information for the account.
overall it is specially designed to maintain all the account details of user.
This computerized system store all the data in the database which makes it easy to fetch and update
whenever needed.
27
BIBILOGRAPHY:
Computer Science With Python by Sumita Arora for Class 11& 12
HTTPS://WWW.W3SCHOOLS.COM/PYTHON/PYTHON_MYSQL_GETSTARTED.ASP
HTTPS://WWW.TUTORIALSPOINT.COM/PYTHON/PYTHON_DATABASE_ACCESS.
HTM HTTPS://PYTHONSPOT.COM/MYSQL-WITH-PYTHON/
28