CS project Anirudh (change name in certificate)
CS project Anirudh (change name in certificate)
CS project Anirudh (change name in certificate)
2024-25
Password Manager
1
Certificate of Completion
SIGNATURE SIGNATURE
EXTERNAL EXAMINER INTERNAL EXAMINER
ACKNOWLEDGEMENT
2
I would like to express my sincere gratitude to all the
individuals who have supported and encouraged me
throughout this computer science project. Their kindness
and unwavering support have been instrumental in
motivating me to persevere through challenges and
achieve my goals.
INDEX
Sr Topic Pag
3
No. e
No.
1. CERTIFICATE OF COMPLETION 2
2. ACKNOLEDGEMENT 3
3. INTRODUCTION 5
4. OBJECTIVE AND SCOPE OF PROJECT 10
5. PROBLEM DEFINITION AND 12
ANALYSIS
6. ABOUT PYTHON 14
7. ABOUT MYSQL 17
8. MODULES USED 20
9. SOURCE CODE 22
10. OUTPUT 28
11. USER MANUAL 30
12. REQUIREMENTS 33
13. BIBLIOGRAPHY 36
INTRODUCTION
4
media accounts, checking work-related emails, or
streaming our favorite movies and TV shows, passwords
are essential. Despite their importance, managing
multiple passwords can often be an overwhelming and
challenging task for most users. The struggle to
remember numerous unique passwords often results in
individuals adopting unsafe practices, such as reusing the
same password across multiple accounts or creating weak
passwords that are easy to guess. These habits, while
convenient, significantly compromise the security of both
personal and organizational data, increasing the risk of
cyberattacks and data breaches.
5
their specific needs. Users can customize the
password length and select character sets, ensuring
the generated passwords meet security requirements
for different platforms. By eliminating the need to
manually create passwords, this feature reduces the
likelihood of individuals relying on weak or repetitive
passwords that are easy for attackers to compromise.
6
entries, searching for specific credentials, and
retrieving saved information. The seamless and
straightforward design enhances the overall user
experience, making the application suitable for both
tech-savvy individuals and those less familiar with
technology.
7
8. Integration with MySQL Database:
To provide a reliable and secure backend for data
storage, the application employs MySQL as its
database system. MySQL ensures robust
performance, scalability, and data integrity, making it
a trustworthy platform for securely storing sensitive
user credentials.
8
By fostering the widespread use of secure passwords, this
application contributes to the broader goal of building a
more secure and resilient digital environment.
Objective
This project aims to develop a secure and user-friendly
password manager application to address key challenges
in password management:
1. Enhance Password Security: Provide a platform to
create, store, and manage strong, unique passwords,
mitigating risks from weak or reused credentials.
2. Improve Efficiency: Simplify password
management with a centralized, organized system for
storing and accessing credentials.
9
3. Enhance User Experience: Offer an intuitive, user-
friendly interface suitable for users of all technical
backgrounds.
Scope
The project focuses on building a desktop application with
the following features:
1.Core Functionalities:
o Password Generation: Secure algorithm with
customizable options for length, character sets,
and complexity.
o Password Storage: Secure storage of
usernames, passwords, and website URLs with
encryption.
o User Interface: Intuitive GUI for easy
navigation and password retrieval.
o Search Functionality: Quick search for specific
passwords using keywords.
2.Technical Aspects:
o Language: Development in Python.
o Database: MySQL backend for secure and
scalable credential storage.
o Encryption: Robust algorithms like AES to
protect user data.
3.User Interaction:
10
o Interface Design: Accessible and visually
appealing GUI.
o User Experience: Simplified, intuitive workflows
for ease of use.
The application aims to provide a secure, efficient, and
user-friendly solution to modern password management
challenges.
Problem Definition
In today’s digital era, managing passwords has become a
complex and demanding task. Users frequently struggle
to remember numerous passwords, leading to the
creation of weak, predictable passwords or the reuse of
the same password across multiple accounts. Such
practices significantly increase the risk of security
breaches, identity theft, and financial fraud. The growing
sophistication of cyberattacks, combined with the
inadequacy of traditional password management methods
(e.g., manual tracking, note-taking, or browser-based
storage), further compounds the issue.
Problem Analysis
11
1.Security Risks: Weak passwords and repeated use
across accounts make users more susceptible to
cyber threats.
2.Inconvenience: Managing and recalling multiple
passwords is inefficient, often resulting in errors or
delays.
3.Limited Functionality: Many existing tools lack
essential features such as secure password
generation and robust security measures.
4. Human Error: Manual approaches are unreliable,
leading to mistakes such as forgotten credentials or
typos.
12
ABOUT PYTHON
13
developers to focus more on problem-solving than on
navigating complex programming constructs. Despite its
simplicity, Python is remarkably powerful, supported by
an extensive library ecosystem that includes tools like
NumPy for numerical computation, Pandas for data
manipulation, and TensorFlow for machine learning.
1. Web Development:
Frameworks like Django and Flask empower
developers to create everything from small websites
to large-scale web applications with ease.
2.Data Science and Machine Learning:
Python has become a cornerstone in data-centric
fields. Libraries such as NumPy, Pandas, Matplotlib,
Scikit-learn, and TensorFlow enable tasks ranging
from data visualization and analysis to building and
deploying machine learning models.
3.Scripting and Automation:
Python's compact syntax and extensive library
support make it ideal for automating repetitive tasks,
managing files, processing data, and web scraping.
4.Scientific Computing and Research:
Researchers and scientists use Python for
computational tasks and simulations, leveraging
libraries like SciPy, Matplotlib, and SymPy for their
14
computational and visualization needs.
15
ABOUT MYSQL
16
enterprise systems.
17
enterprise needs. This flexibility, combined with its robust
performance and extensive documentation, has made
MySQL a go-to choice for web development, data
analysis, and enterprise applications.
18
developers and organizations worldwide. Whether you're
managing small datasets or building enterprise-grade
solutions, MySQL offers the tools and reliability needed to
meet diverse data management requirements.
MODULES USED
19
simpledialog: This module provides tools for creating
simple dialog boxes, such as input boxes, to interact
with the user and obtain input.
random: This module provides functions for
generating random numbers, which are essential for
creating strong, unpredictable passwords.
mysql.connector: This module enables the application
to interact with MySQL databases. It provides
functions for connecting to the database, executing
SQL queries, and retrieving data.
hashlib: This module implements secure hashing
algorithms, such as SHA-256, to securely store user
passwords. Hashing ensures that even if the
database is compromised, the actual passwords
remain protected.
pyperclip: This module allows the application to
interact with the system clipboard, enabling users to
easily copy generated or stored passwords.
These modules provide the necessary foundation for
building a functional, secure, and user-friendly password
manager application.
20
SOURCE CODE
1. import tkinter as tk
2. from tkinter import ttk, messagebox
3. from tkinter import simpledialog
4. import random
5. import mysql.connector
6. import hashlib
7. import pyperclip
8.
9. def hash_password(password):
10. return hashlib.sha256(password.encode()).hexdigest()
11.
12. def connect_to_db():
13. return mysql.connector.connect(
14. host="localhost",
15. user="root",
16. password="root",
17. database="password_manager"
18. )
19.
20. def create_tables():
21. connection = connect_to_db()
22. cursor = connection.cursor()
23. cursor.execute("""
24. CREATE TABLE IF NOT EXISTS passwords (
25. id INT AUTO_INCREMENT PRIMARY KEY,
26. website VARCHAR(255),
27. username VARCHAR(255),
28. nickname VARCHAR(100),
29. password VARCHAR(255)
21
30. )
31. """)
32. cursor.execute("""
33. CREATE TABLE IF NOT EXISTS master_password (
34. id INT PRIMARY KEY,
35. password_hash VARCHAR(255)
36. )
37. """)
38. connection.close()
39.
40. create_tables()
41.
42. # GUI Functions
43. def generate_password(length):
44. characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$
%^&*()- _=+[{]}\\|;:'\",<.>/?"
45. return ''.join(random.choice(characters) for _ in range(length))
46.
47. def add_password(website_var, username_var, nickname_var, length_var,
custom_password_var, table):
48. website = website_var.get()
49. username = username_var.get()
50. nickname = nickname_var.get()
51. length = length_var.get()
52.
53. if not website or not username or not nickname:
54. messagebox.showwarning("Warning", "Please fill all fields!")
55. return
56.
57. if custom_password_var.get():
58. password = custom_password_var.get()
59. else:
60. password = generate_password(int(length))
61.
62. connection = connect_to_db()
63. cursor = connection.cursor()
64. cursor.execute("""
65. INSERT INTO passwords (website, username, nickname, password)
66. VALUES (%s, %s, %s, %s)
67. """, (website, username, nickname, password))
68. connection.commit()
69. connection.close()
70.
71. messagebox.showinfo("Success", f"Password added:\n{password}")
72. clear_form(website_var, username_var, nickname_var, length_var,
custom_password_var)
73. refresh_table(table)
74.
75. # clearing input after updation
76. def clear_form(website_var, username_var, nickname_var, length_var,
custom_password_var):
77. website_var.set("")
78. username_var.set("")
79. nickname_var.set("")
80. length_var.set("12")
81. custom_password_var.set("")
82.
83. def refresh_table(table):
84. for row in table.get_children():
85. table.delete(row)
22
86.
87. connection = connect_to_db()
88. cursor = connection.cursor()
89. cursor.execute("SELECT website, username, nickname, password FROM passwords")
90. rows = cursor.fetchall()
91. connection.close()
92.
93. for row in rows:
94. table.insert("", tk.END, values=row)
95.
96. for col in table["columns"]:
97. max_length = max([len(str(item)) for item in [col] + [row[col] for row in
rows]])
98. table.column(col, width=max_length * 10)
99.
100. def delete_password(table):
101. selected_item = table.selection()
102. if not selected_item:
103. messagebox.showwarning("Warning", "Please select a password to delete!")
104. return
105.
106. item = table.item(selected_item)
107. nickname = item['values'][2]
108. connection = connect_to_db()
109. cursor = connection.cursor()
110. cursor.execute("DELETE FROM passwords WHERE nickname = %s", (nickname,))
111. connection.commit()
112. connection.close()
113.
114. messagebox.showinfo("Success", f"Password for '{nickname}' deleted.")
115. refresh_table(table)
116.
117. def copy_password(table):
118. selected_item = table.selection()
119. if not selected_item:
120. messagebox.showwarning("Warning", "Please select a password to copy!")
121. return
122.
123. item = table.item(selected_item)
124. password = item['values'][3]
125. pyperclip.copy(password)
126. messagebox.showinfo("Copied", "Password copied to clipboard!")
127.
128. def enter_custom_password(custom_password_var):
129. custom_password = simpledialog.askstring("Custom Password", "Enter your custom
password:")
130. if custom_password:
131. custom_password_var.set(custom_password)
132.
133. def authenticate_master_password():
134. connection = connect_to_db()
135. cursor = connection.cursor()
136. cursor.execute("SELECT password_hash FROM master_password WHERE id = 1")
137. result = cursor.fetchone()
138. connection.close()
139.
140. if result:
141. stored_password_hash = result[0]
142. entered_password = simpledialog.askstring("Login", "Enter master password:",
show="*")
23
143. if hash_password(entered_password) == stored_password_hash:
144. password_manager_window()
145. else:
146. messagebox.showerror("Error", "Incorrect master password!")
147. else:
148. create_master_password()
149.
150. def create_master_password():
151. master_password = simpledialog.askstring("Setup", "Create a new master password:",
show="*")
152. confirm_password = simpledialog.askstring("Setup", "Confirm master password:",
show="*")
153.
154. if master_password != confirm_password:
155. messagebox.showerror("Error", "Passwords do not match!")
156. return
157.
158. connection = connect_to_db()
159. cursor = connection.cursor()
160. cursor.execute("INSERT INTO master_password (id, password_hash) VALUES (1, %s)",
(hash_password(master_password),))
161. connection.commit()
162. connection.close()
163. messagebox.showinfo("Success", "Master password set successfully!")
164. password_manager_window()
165.
166. # main gui
167.
168. def password_manager_window():
169. root.destroy()
170. manager = tk.Tk()
171. manager.title("Password Manager")
172. manager.geometry("800x600")
173.
174. notebook = ttk.Notebook(manager)
175. notebook.pack(fill="both", expand=True)
176.
177. # Variables
178. website_var = tk.StringVar()
179. username_var = tk.StringVar()
180. nickname_var = tk.StringVar()
181. length_var = tk.StringVar(value="12")
182. custom_password_var = tk.StringVar()
183.
184. # Tab 1: Add Password
185. frame_add = ttk.Frame(notebook)
186. notebook.add(frame_add, text="Add Passwords")
187.
188. ttk.Label(frame_add, text="Website:").grid(row=0, column=0, padx=10, pady=10,
sticky="e")
189. ttk.Entry(frame_add, textvariable=website_var).grid(row=0, column=1, padx=10,
pady=10, sticky="w")
190.
191. ttk.Label(frame_add, text="Username:").grid(row=1, column=0, padx=10, pady=10,
sticky="e")
192. ttk.Entry(frame_add, textvariable=username_var).grid(row=1, column=1, padx=10,
pady=10, sticky="w")
193.
194. ttk.Label(frame_add, text="Nickname:").grid(row=2, column=0, padx=10, pady=10,
sticky="e")
24
195. ttk.Entry(frame_add, textvariable=nickname_var).grid(row=2, column=1, padx=10,
pady=10, sticky="w")
196.
197. ttk.Label(frame_add, text="Password Length:").grid(row=3, column=0, padx=10,
pady=10, sticky="e")
198. ttk.Entry(frame_add, textvariable=length_var).grid(row=3, column=1, padx=10,
pady=10, sticky="w")
199.
200. ttk.Button(frame_add, text="Custom Password", command=lambda:
enter_custom_password(custom_password_var)).grid(row=4, column=0, columnspan=2, pady=10)
201. ttk.Button(frame_add, text="Generate & Add Password", command=lambda:
add_password(website_var, username_var, nickname_var, length_var, custom_password_var,
table)).grid(row=5, column=0, columnspan=2, pady=20)
202.
203. # Tab 2: View Passwords
204. frame_view = ttk.Frame(notebook)
205. notebook.add(frame_view, text="View Passwords")
206.
207. columns = ("Website", "Username", "Nickname", "Password")
208. table = ttk.Treeview(frame_view, columns=columns, show="headings", height=15)
209. for col in columns:
210. table.heading(col, text=col)
211. table.column(col, width=200)
212. table.pack(fill="both", expand=True)
213.
214. ttk.Button(frame_view, text="Copy Password", command=lambda:
copy_password(table)).pack(side="left", padx=10, pady=10)
215. ttk.Button(frame_view, text="Delete Password", command=lambda:
delete_password(table)).pack(side="left", padx=10, pady=10)
216.
217. # Tab 3: Instructions
218. frame_instructions = ttk.Frame(notebook)
219. notebook.add(frame_instructions, text="Instructions")
220. instructions_text = """
221.
222. Welcome to Your Password Manager
223.
224. How to Use:
225.
226. 1. Add a Password:
227. - Go to the "Add Password" tab.
228. - Fill in the website, username, and nickname fields.
229. - Choose a password length or enter your own.
230. - Click "Generate & Add Password" to create a new password.
231.
232. 2. View and Manage Passwords:
233. - Go to the "View Passwords" tab.
234. - Search for passwords using the search bar.
235. - Click "Copy Password" to copy a password to your clipboard.
236. - Click "Delete Password" to remove a password.
237.
238. 3. Stay Secure:
239. - Use strong, unique passwords for each account.
240. - Keep your master password secure.
241. - Regularly update your passwords.
242.
243. """
244.
245. instructions_label = tk.Label(frame_instructions, text=instructions_text,
justify="left", font=("Courier New", 12), wraplength=800)
25
246. instructions_label.pack(padx=20, pady=20)
247.
248. # Tab 4: Credits
249. frame_credits = ttk.Frame(notebook)
250. notebook.add(frame_credits, text="Credits")
251.
252. credits_text = """
253.
254. Password Manager Team:
255.
256. - Anirudh
257. - Aarin
258. - Priyanshu
259.
260. New Millenium School
261.
262.
263. Special Thanks to:
264.
265. - Anjaly Ma'am
266. - Edward Sir
267.
268. """
269.
270. credits_label = tk.Label(frame_credits, text=credits_text, justify="left",
font=("Courier New", 12), wraplength=800)
271. credits_label.pack(padx=20, pady=20)
272.
273. refresh_table(table)
274.
275. manager.mainloop()
276.
277.
278. # Main Authentication
279. root = tk.Tk()
280. root.withdraw()
281. authenticate_master_password()
282.
26
OUTPUT
27
28
29
USER MANUAL
30
o Nickname (optional): Assign a nickname for easy
identification.
Choose how to create your password:
o Generate Password: Select the desired password
length and let the app create a strong password.
o Custom Password: Enter a password of your
choice if you prefer.
Click "Generate & Add Password" to save the details
securely in the app.
2. View and Manage Saved Passwords
This feature helps you access and manage all your stored
passwords conveniently.
Go to the "View Passwords" tab.
Use the Search Bar to find specific passwords by
entering relevant keywords, such as the website or
nickname.
Perform actions on stored passwords:
o Copy Password: Click the "Copy Password" button
to copy the password to your clipboard for quick
use.
o Delete Password: Click the "Delete Password"
button to remove the entry permanently.
3. Maintain Security
To maximize your online security, follow these best
practices:
31
Always use strong and unique passwords for each
account to minimize the risk of breaches.
Keep your master password confidential and never
share it with anyone.
Regularly update your passwords to stay ahead of
potential security threats.
32
REQUIREMENTS
2. Hardware Requirements
To run the application efficiently, your system should
meet these minimum specifications:
Processor: Dual-core processor (2 GHz or higher
recommended).
RAM: Minimum 2 GB (4 GB or more recommended for
better performance).
Storage: At least 500 MB of free disk space for the
application and database. Additional storage may be
33
needed depending on the size of the stored password
data.
Display: Minimum resolution of 1024x768 pixels for
optimal GUI display.
3. Software Requirements
The following software and dependencies are required:
Python: Version 3.7 or higher.
MySQL Server: Version 5.7 or higher for database
storage.
Python Libraries Required:
o tkinter (for the graphical user interface).
o mysql-connector (for MySQL integration).
o hashlib (for data encryption).
o pyperclip (for clipboard operations).
4. Internet Requirements
Initial Setup: A stable internet connection is required
to download dependencies and set up the MySQL
database if hosted online.
Offline Usage: Once installed and configured, the
application can function offline if the MySQL database
is hosted locally.
34
Online Usage: If the MySQL database is hosted on a
remote server, a reliable internet connection is
necessary for database interactions.
BIBLIOGRAPHY
35
Comprehensive resource for Python programming, libraries, and
syntax.
Wikipedia Contributors. Password Manager. Retrieved from
https://en.wikipedia.org/wiki/Password_manager
Overview of password management tools, their importance, and
key features.
Oracle Corporation. MySQL Documentation. Retrieved from
https://dev.mysql.com/doc/
Authoritative resource for understanding MySQL database
installation, configuration, and query usage.
Real Python Team. Learn Python Programming. Retrieved from
https://realpython.com/
Detailed tutorials and articles on Python programming and
practical implementation.
OWASP Foundation. Password Storage Cheat Sheet. Retrieved
from https://owasp.org/
Guidelines for securely storing and managing passwords,
including encryption techniques.
Cryptography Library Developers. Cryptography
Documentation. Retrieved from https://cryptography.io/
Documentation on using encryption libraries in Python for secure
data handling.
36