CS Project Aarin12
CS Project Aarin12
2024-25
Password Manager
1
Certificate of Completion
SIGNATURE SIGNATURE
EXTERNAL EXAMINER INTERNAL EXAMINER
2
ACKNOWLEDGEMENT
3
INDEX
Sr Topic Page
No. No.
1. CERTIFICATE OF COMPLETION 2
2. ACKNOLEDGEMENT 3
3. INTRODUCTION 5
4. OBJECTIVE AND SCOPE OF 10
PROJECT
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
4
INTRODUCTION
5
The password manager application is designed with a
range of essential features that prioritize both user
convenience and security. These features include:
6
remains confidential and secure, even in the event of
unauthorized access, data breaches, or device theft.
By safeguarding sensitive information, the application
instills confidence in users about the safety of their
stored passwords.
7
not only enhances organization but also makes it
easier for users to locate specific credentials quickly
when needed.
8
By integrating these features, the password manager
application aims to simplify the process of managing
passwords while promoting best practices for digital
security. It encourages users to adopt strong, unique
passwords across their accounts, thereby reducing the
risks associated with weak credentials and password
reuse.
9
OBJECTIVE AND SCOPE OF PROJECT
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.
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.
10
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:
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.
11
PROBLEM DEFINITION AND
ANALYSIS
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
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.
12
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.
13
ABOUT PYTHON
14
Python's versatility makes it suitable for a wide range of
applications:
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
computational and visualization needs.
15
The language's growth is fueled by its vibrant and active
community, which continuously develops new tools,
provides robust support, and shares comprehensive
documentation. This collaborative environment ensures
that Python remains accessible and well-suited for
newcomers and experts alike.
In summary, Python's unparalleled combination of
simplicity, power, and versatility makes it a preferred
choice for tackling a broad spectrum of programming
challenges. Whether you are just starting your coding
journey or solving
complex problems as an
experienced developer,
Python offers the tools
and flexibility you need
to succeed.
16
ABOUT MYSQL
17
supports a variety of advanced features, such as stored
procedures, triggers, and views, enabling developers to
implement complex data management logic and optimize
application performance. Additionally, MySQL offers
transaction support, ensuring data integrity and reliability
even in systems requiring high levels of concurrency.
18
large-scale systems with millions of queries and vast
amounts of data. Features such as replication and
clustering further enhance their ability to scale, making it
suitable for high-availability applications.
19
MODULES USED
20
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.
21
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)
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.
22
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)
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,))
23
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="*")
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
24
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")
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)
25
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)
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.
26
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.
27
OUTPUT
28
29
USER MANUAL
30
1. Add a New Password:
This feature allows you to generate and store passwords
for various accounts securely. Follow the steps below:
Navigate to the "Add Password" tab in the application.
Fill in the required fields:
o Website: Enter the URL or name of the website.
o Username: Enter your username or email
associated with the account.
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.
31
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:
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
33
Windows: Version 7 or higher (Windows 10 or later
recommended).
Linux: Any modern distribution with Python 3.7+
support (e.g., Ubuntu, Fedora, Debian).
macOS: Version 10.14 (Mojave) or higher.
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
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.
34
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.
Online Usage: If the MySQL database is hosted on a
remote server, a reliable internet connection is
necessary for database interactions.
35
Database Configuration: Ensure the user account has
the necessary permissions to create, read, update,
and delete entries in the MySQL database.
BIBLIOGRAPHY
36
Authoritative resource for understanding MySQL database
installation, configuration, and query usage.
37