Sie sind auf Seite 1von 34

COMPUTER SCIENCE PROJECT

PASSWORD MANAGER

SUBMITTED BY:

ANIRUDH ADITHYA B S

1
MATHAKONDAPALLI MODEL SCHOOL

COMPUTER SCIENCE PROJECT


2019-2020

BONAFIED CERTIFICATE

Certified to be the Bonafied Project work done by

___________________________ANIRUDH ADITHYA B S____________________________

Of class XII in Mathakondapalli Model School, Hosur During the year 2019-2020.

Date: Teacher in Charge

Submitted for AISSCE Practical Examination held on -----------------------------------


Project Title : PASSWORD MANAGER

Name of the Candidate : ANIRUDH ADITHYA B S


Roll No : 20625538
Centre Code : 07085

External Examiner School seal Internal Examiner

2
ACKNOWLEDGEMENT

I register my sense of gratitude to Mathakondapalli Model School and our Principals for
the opportunity and facilities provided which helped me to complete this project successfully.

I am also thankful to our principal, our Co-coordinator for the help provided in referring the
required amount of resources.

It is my humble pleasure to acknowledge my deep sense of gratitude to my Computer Science


teacher Mr. Nagaraj C for his valuable support, constant help and guidance at each and every
stage of this project. His constructive advice & constant motivation have been responsible for the
successful completion of this project

Last but not least, I would like to thank my classmates for their timely help and support for
completion of this project

Name : ANIRUDH ADITHYA B S

Roll No: 20625538

3
INDEX

S.NO CONTENT PAGE NO

01 INTRODUCTION 05

02 PROJECT DESCRIPTION 05

03 PROJECT REQUIREMENT 06

04 PYTHON CONCEPTS 07

05 PROGRAM 13

06 OUTPUT 28

07 CONCLUSION 29

08 BIBLIOGRAPHY 33

09 WEBSITES REFERED 34

4
INTRODUCTION

Basically Passwords are cumbersome and hard to remember and just when you did,
you’re told to update it again after some period of time. And sometimes passwords can be
guessed and are easily hackable. Can you make them better and easier? Yes, you need a
Password Manager.

WHY TO USE PASSWORD MANGER? :

A Password Manager is a simple Python application that is used to store and manage the
passwords that a user has for various online accounts and security features. Password Managers
store the passwords in MYSQL Database and provide secure access to all the password
information with the help of a master password. This helps in the prevention of hacker attacks
like keystroke logging and it prevents the need to remember multiple passwords.

WHY TO CHOOSE PASSWORD MANAGER?

1. This application providing the Best Secure Database connected with MYSQL server to
Store your Passwords and User Friendly to Access your Stored Password.
2. This application providing the Multi Accounts Facility.
3. Users can manage not only the Passwords they can even manage their Purchase Cards
Details and Bank Details.
4. It is providing the Offline and Free Database so, users can access their Passwords any
time without Internet.
5. This application provides Easy Backup option where users can easily save their
Passwords in Text File Directly and Copy to their Compact Devices.

DESCRIPTION

Password Manager is windows console based simple software developed with Python v3.2 that
allows you to easily add or update your Passwords of various Websites and other sources on
MYSQL Database.

5
Software testing is an investigation conducted to provide stakeholders with information
about the quality of the product or service under test. Software testing can also provide an
objective, independent view of the software to allow the business to appreciate and understand
the risks of software implementation.

Test techniques include the process of executing a program or application with the intent
of finding software bugs (errors or other defects), and to verify that the software product is fit for
use.

Software testing involves the execution of a software component or system component to


evaluate one or more properties of interest. In general, these properties indicate the extent to
which the component or system under test:

● meets the requirements that guided its design and development,


● responds correctly to all kinds of inputs,
● performs its functions within an acceptable time,
● is sufficiently usable,
● can be installed and run in its intended environments, and
● Achieves the general result its stakeholder’s desire.

PROJECT REQUIREMENTS

SOFTWARE

● MYSQL SERVER
● OS SUPPORTED: WINDOWS (7, 8, 8.1, 10)
● System Architecture: 32 and 64
HARDWARE

● Processor: All AMD or INTEL Core Processors


● RAM: 512 MB (Minimum)
● Storage Requirements: 1 GB (Minimum)

6
PYHTON CONCEPS USED IN PROJECT

NUMBER: Number data type stores Numerical Values. This data type is immutable value of its
object cannot be changed. Numbers are of three different types
1. Integer & Long (to store whole numbers i.e. decimal digits without fraction part)
2. Float/floating point (to store numbers with fraction part)
3. Complex (to store real and imaginary part)

CONDITIONAL STATEMENTS:

The Boolean expression in a conditional statement that determines which branch is


executed. A statement that controls the flow of execution depending on some condition.
In Python the keywords if, elif, and else are used for conditional statements.

SEQUENCE:

A sequence is an ordered collection of items, indexed by positive


integers. It is a combination of mutable (a mutable variable is one, whose value may change) and
immutable (an immutable variable is one, whose value may not change) data types. There are
three types of sequence data type available in Python; they are Strings, Lists & Tuples.

String:

String is an ordered sequence of letters/characters. They are enclosed in single quotes (' ') or
double quotes ('' "). The quotes are not part of string. They only tell the computer about where
the string constant begins and end, they can have any character or sign, including space in these
are immutable. A string with length 1 represents a character in python.

Lists:

List is also a sequence of values of any type. Values in the list are called
elements / items. These are mutable and indexed/ordered. List is enclosed in square brackets
([ ]).
7
Tuple: A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists.
The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples
use parentheses, whereas lists use square brackets. Eg: tup1 = ('python', 'password', 2019, 2020)

OPERATORS AND OPERANDS:

Operators are special symbols that represent computation like addition and
multiplication. The values that the operator is applied to be called operands. Operators when
applied on operands form an expression. Operators are categorized as Arithmetic, Relational,
Logical and Assignment. Following is the partial list of operators:

Mathematical/Arithmetic operators: +, -, *, /

Relational operators: <, <=, >, >= and ==.

Assignment Operator: =, +=

FUNCTION IN PYTHON:

A function is named sequence of statement(s) that performs a computation. It contains


line of code(s) that are executed sequentially from top to bottom by Python interpreter .They are
the most important building block for any software in Python. For working in script mode, we
need to write the Python code in functions and save it in the file having extension.
Built In Functions:

1.len (): It is used for length of list.


2.print(): It is used to print the output.
3. input(): It is used to input data from users.
4. open(): Function that is used to open files

8
LOOP:

In computer programming, a loop is a sequence of instruction s that is continually repeated until


a certain condition is reached. Typically, a certain process is done, such as getting an item of data
and changing it, and then some condition is checked such as whether a counter has reached a
prescribed number.

 WHILE LOOP:
In python, while loop is used to execute a block of statements repeatedly until a given a
condition is satisfied. And when the condition becomes false, the line immediately after the loop
in program is executed.

 FOR LOOP:
For loops are used for sequential traversal. For example: traversing a list or string or array etc. In
Python, there is no C style for loop, i.e., for (i=0; i<n; i++). There is “for in” loop which is
similar to for each loop in other languages. Let us learn how to use for in loop for sequential
traversals.

CONDITIONS:
Conditions. Python uses Boolean variables to evaluate conditions. The Boolean values True and
False are returned when an expression is compared or evaluated.

 IF:
In Python, If Statement is used for decision making. It will run the body of code only when IF
statement is true. When you want to justify one condition while the other condition is not true,
then you use "if statement".

 ELIF:
It can be used after if statement in case you have one more comparison to made and one more
and one more and so on. If you have multiple elif then you can utilize dictionary data type
in python.

9
 ELSE:
An else statement contains the block of code that executes if the conditional expression in the if
statement resolves to 0 or a FALSE value. The else statement is an optional statement and there
could be at most only one else statement following if.

EXCEPTIONAL HANDLING:

An exception is an event, which occurs during the execution of a program that disrupts
the normal flow of the program's instructions. In general, when a Python script encounters a
situation that it cannot cope with, it raises an exception. An exception is a Python object that
represents an error.

Try and Exception:

The try and except block in Python is used to catch and handle
exceptions. Python executes code following the try statement as a “normal” part of the program.
This exception error will crash the program if it is unhandled. The except clause determines how
your program responds to exceptions.

MODULES:

A module is a Python object with arbitrarily named attributes that you can bind and
reference. Simply, a module is a file consisting of Python code. A module can define functions,
classes and variables. A module can also include runnable code.

Modules Used:

1. mysql.connector: It helps to connect Mysql Database to the Python Interface.

2. tabulate: It helps to print the datas in table Format.

3. stdiomask: It helps to hide the passwords while typing.

4. datetime: It helps to get current Date and Time.

10
5. os: It is Built In Module in python. It is used to make system commands in Python.

Database Connection

In this section of the tutorial, we will discuss the steps to connect the python application to the
database.

There are the following steps to connect a python application to our database.

1. Import mysql.connector module


2. Create the connection object.
3. Create the cursor object
4. Execute the query

Creating the connection

To create a connection between the MySQL database and the python application, the connect()
method of mysql.connector module is used.

Pass the database details like Host Name, username, and the database password in the method
call. The method returns the connection object.

The syntax to use the connect() is given below.

Connection-Object= mysql.connector.connect(host = <host-


name> , user = <username> , passwd = <password> )

Creating a cursor object

The cursor object can be defined as an abstraction specified in the Python DB-API 2.0. It
facilitates us to have multiple separate working environments through the same connection to the

11
database. We can create the cursor object by calling the 'cursor' function of the connection
object. The cursor object is an important aspect of executing queries to the databases.

The syntax to create the cursor object is given below.

1. <my_cur> = conn.cursor()

Executing cursor object


After you have successfully made a new database connection in PHP, you can execute
MySQL queries from the PHP code itself. Store the query in a variable as a string. Then,
you can use mysql_query() to perform queries against the database.

Closing connection

To close the connection in mysql database we use php function mysqli_close() which disconnect
from database. It require a parameter which is a connection returned by the mysql_connect
function.

Syntax:
mysql_close(conn);

12
PROGRAM

import os

import stdiomask

import datetime

from tabulate import tabulate

import mysql.connector

try:

cre_acc=int(input("1.Login \n2.Register your Account\nEnter Your Choice: "))

if cre_acc==1:

database=input("Enter Account ID: ")

try:

connection=mysql.connector.connect(user="root",password=""+sql_pass+"",host="localhost",da
tabase=""+database+"")

mycur=connection.cursor()

password=stdiomask.getpass(prompt='Enter the Password: ', mask='*')

pass_db=("""INSERT INTO pass_db(user_choice, password) values


(3,'%s')"""%password)

mycur.execute(pass_db)

ori_pass=("select password from pass_db where user_choice=1")

check_pass=("select password from pass_db where user_choice=3")

mycur.execute(check_pass)
13
data1=mycur.fetchall()

mycur.execute(ori_pass)

data=mycur.fetchall()

if data==data1:

print("Sucessfully Loged In")

mycur.execute("delete from pass_db where user_choice=3")

break

else:

mycur.execute("delete from pass_db where user_choice=3")

input("Invalid Password !!! \nPress Any Key to Continue")

except mysql.connector.Error:

input("Invalid or Account can't be Found !!! \nPress Any Key to Continue")

elif cre_acc==2:

try:

database=input("Create your Account ID: ")

try:

connection=mysql.connector.connect(user="root",password=""+sql_pass+"",host="localhost",da
tabase=""+database+"")

print("Account Already Exists")

input("Press Any Key to Continue")

continue
14
except mysql.connector.Error:

mycur.execute("create database "+database)

connection=mysql.connector.connect(user="root",password=""+sql_pass+"",host="localhost",da
tabase=""+database+"")

mycur=connection.cursor()

mycur.execute("create table pass_db(user_choice varchar(30), password


varchar(30))")

mycur.execute("create table social_media_management(sno varchar(30), name


varchar(30), username varchar(30), password varchar(30), 2fa varchar(30), notes varchar(30))")

mycur.execute("create table inter_banking(sno varchar(30), bname varchar(30),


username varchar(30), password varchar(30), transaction_password varchar(30), register_mobile
varchar(30), notes varchar(30))")

mycur.execute("create table bank_details(sno varchar(30), bname varchar(30),


acc_holder varchar(30), acc_number varchar(30), ifsc_number varchar(30), branch_name
varchar(30), register_mobile varchar(30), register_email varchar(30), customer_number
varchar(30), cif_number varchar(30), notes varchar(30))")

mycur.execute("create table save_cards(sno varchar(30), card_provider varchar(30),


card_holder varchar(30), card_type varchar(30), card_number varchar(30), card_expiry
varchar(30), card_cvv varchar(30), card_register_mobile varchar(30), notes varchar(30))")

create_password=stdiomask.getpass(prompt='Create your Password: ', mask='*')

pass_db=("""INSERT INTO pass_db(user_choice, password) values


(1,'%s')"""%create_password)

mycur.execute(pass_db)

connection.commit()

15
print("Thank You for Choosing Password Manager\nYour Account for Password
Manager has been Created Sucessfully :) ")

input("Press Any Key to Return Home")

except mysql.connector.Error:

input("Warning!! Please Don't use Special Character \nPress Any Key to Continue")

else:

input("Invalid Option\nPress Any Key to Continue")

except ValueError:

input("Enter Only Integer, Invalid Option\nPress Any Key to Continue")

#######MAIN MENU#########

while True:

os.system("cls")

print("***Welcome To Password Manager***\n")

print("Main Menu")

print("\n1.Account Settings")

print("2.Add your Passwords and Datas")

print("3.View/Update/Delete your Password")

print("4.Save Datas to Text File")

print("5.Info about Password Manager")

print("6.Help Desk")

16
print("7.Exit")

try:

user_choice=int(input("Enter your Choice: "))

#Main

#Main Choice1

if user_choice==1:

mycur.execute("select *from pass_db")

pre_check=mycur.fetchall()

pre_check_data=len(pre_check)

if pre_check_data==0:

print("Sorry !!! Something Went Wrong :(")

print("\n#######################################################################
#")

input("Press Enter To Continue")

print("\n#######################################################################
#")

else:

password=stdiomask.getpass(prompt='Enter the Password: ', mask='*')

pass_db=("""INSERT INTO pass_db(user_choice, password) values


(3,'%s')"""%password)
17
mycur.execute(pass_db)

ori_pass=("select password from pass_db where user_choice=1")

check_pass=("select password from pass_db where user_choice=3")

mycur.execute(check_pass)

data1=mycur.fetchall()

mycur.execute(ori_pass)

data=mycur.fetchall()

if data==data1:

print("Sucessfully Loged In")

mycur.execute("delete from pass_db where user_choice=3")

while True:

os.system("cls")

print("Settings\n")

print("1.Update your Password")

print("2.Backup and Reset your Database")

print("3.Delete your Account")

print("4.Back")

try:

set_choice=int(input("Please Enter Your Choice "))

if set_choice==1:

18
new_pass=stdiomask.getpass(prompt='Enter your New Password: ',
mask='*')

mycur.execute("update pass_db set password='"+new_pass+"' where


user_choice=1")

connection.commit()

input("Sucessfully Updated :)")

elif set_choice==2:

input("Press Enter to Continue\n***Note Your Password of Your Account


will be Deleted Completly\n and Automatically your Passwords will be Saved in Text File")

print("bakuping your datas........\ncopying datas.........")

time=datetime.datetime.now()

table=('\n'+tabulate([[1, 'Social Media Accounts'], [2, 'Internet Banking


Accounts'], [3, 'Bank Details'], [4, 'Saved Cards']],

headers=['Number of Tables', 'Tables you can use'],


tablefmt='psql'))

mycur.execute("select name, username, password, 2fa, notes from


social_media_management")

social_media_data=mycur.fetchall()

social_data=((tabulate(social_media_data, headers=["Social Media


Name","Username","Password","2FA","Notes"], tablefmt="psql")))

19
mycur.execute("select bname, username, password, transaction_password,
register_mobile, notes from inter_banking")

inter_bank_data=mycur.fetchall()

inter_data=((tabulate(inter_bank_data, headers=["Bank
Name","Username","Password","Transaction Password","Mobile Number","Notes"],
tablefmt="psql")))

mycur.execute("select bname, acc_holder, acc_number, ifsc_number,


branch_name, register_mobile, register_email, customer_number, cif_number, notes from
bank_details")

bank_data=mycur.fetchall()

bank_details=((tabulate(bank_data, headers=["Bank Name","Acc Holder


Name","Acc Number","IFSC Code","Branch Name","Mobile Number","Email ID","Customer
Number","CIF Number","Notes"], tablefmt="psql")))

mycur.execute("select card_provider, card_holder, card_type, card_number,


card_expiry, card_cvv, card_register_mobile, notes from save_cards")

card_data=mycur.fetchall()

save_cards=((tabulate(card_data, headers=["Provider Name","Holder


Name","Card Type","Card Number","Expiry Data","CVV Number","Mobile Number","Notes"],
tablefmt="psql")))

test_data=open("Password Manager Backup "+time.strftime("%d %B


%Y")+".txt","w")

test_data.write("=========================================================
===================TABLE============================================
=======================\n")
20
test_data.writelines(table)

test_data.writelines("\n====================================================
==========SOCIAL MEDIA
ACCOUNTS===========================================================
======\n")

test_data.writelines(social_data)

test_data.writelines("\n====================================================
========INTERNET BANKING
ACCOUNTS===========================================================
====\n")

test_data.writelines(inter_data)

test_data.writelines("\n====================================================
==============BANK
DETAILS=============================================================
=========\n")

test_data.writelines(bank_details)

test_data.writelines("\n====================================================
===============SAVED
CARDS===============================================================
=======\n")

test_data.writelines(save_cards)

test_data.close()

21
print("Backuped your Datas to Text File ('Password Manager
Backup"+time.strftime("%d %B %Y")+".txt') Sucessfully,")

print("Reseting your tables...." )

mycur.execute("drop table social_media_management")

print("Reseting your tables...." )

mycur.execute("drop table inter_banking")

print("Reseting your tables...." )

mycur.execute("drop table bank_details")

print("Reseting your tables...." )

mycur.execute("drop table save_cards")

print("creating tables")

print("creating table social_media_management...........")

mycur.execute("create table social_media_management(sno varchar(30),


name varchar(30), username varchar(30), password varchar(30), 2fa varchar(30), notes
varchar(30))")

print("creating table inter_banking...........")

mycur.execute("create table inter_banking(sno varchar(30), bname


varchar(30), username varchar(30), password varchar(30), transaction_password varchar(30),
register_mobile varchar(30), notes varchar(30))")

print("creating table bank_details...........")

mycur.execute("create table bank_details(sno varchar(30), bname


varchar(30), acc_holder varchar(30), acc_number varchar(30), ifsc_number varchar(30),

22
branch_name varchar(30), register_mobile varchar(30), register_email varchar(30),
customer_number varchar(30), cif_number varchar(30), notes varchar(30))")

print("creating table save_cards...........")

mycur.execute("create table save_cards(sno varchar(30), card_provider


varchar(30), card_holder varchar(30), card_type varchar(30), card_number varchar(30),
card_expiry varchar(30), card_cvv varchar(30), card_register_mobile varchar(30), notes
varchar(30))")

print("Table Created Sucessfully")

print("Reseted Sucessfully")

input("Press Enter to Continue")

elif set_choice==3:

connection1=mysql.connector.connect(user="root",password=""+sql_pass+"",host="localhost")

mycur1=connection1.cursor()

mycur1.execute("drop database "+database)

input("Sucessfully Deleted\nPress Any Enter to Log Out and Quit")

quit()

elif set_choice==4:

break

else:

print("Wrong Option :(")

input("Press Enter To Continue")

except ValueError:
23
input("Invalid Option, Enter only Integers\n Press Any Key to Continue")

else:

print("Sorry!!Access Denied")

mycur.execute("delete from pass_db where user_choice=3")

connection.commit()

#connection.close()

input("Press Enter To Continue")

elif user_choice==2:

mycur.execute("select *from pass_db")

pre_check=mycur.fetchall()

pre_check_data=len(pre_check)

if pre_check_data==0:

print("Sorry !!! Something Went Wrong :(")

print("\n#######################################################################
#")

input("Press Enter To Continue")

print("\n#######################################################################
#")

else:

24
password=stdiomask.getpass(prompt='Enter the Password: ', mask='*')

pass_db=("""INSERT INTO pass_db(user_choice, password) values


(3,'%s')"""%password)

mycur.execute(pass_db)

ori_pass=("select password from pass_db where user_choice=1")

check_pass=("select password from pass_db where user_choice=3")

mycur.execute(check_pass)

data1=mycur.fetchall()

mycur.execute(ori_pass)

data=mycur.fetchall()

if data==data1:

print("Sucessfully Loged In")

mycur.execute("delete from pass_db where user_choice=3")

#After Log In

while True:

os.system("cls")

print("1.Add your Passwords of Social Media")

print("2.Add your Passwords of Internet Banking Accounts")

print("3.Add your Bank Details")

print("4.Add your Purchase Cards")

25
print("5.Back")

try:

add_choice=int(input("Select your option: "))

##SUBCHOICE1

if add_choice==1:

while True:

os.system("cls")

try:

repeat=int(input("Enter How Many Accounts to be Added in Social


Media Management\n(Only 5 Times per run Recommanded)"))

print("Fill Each Option with Correct Information ")

print("########################################################################
")

for i in range(repeat):

mycur.execute("select *from social_media_management")

row_no=mycur.fetchall()

sno=len(row_no)+1

sname=input("Enter Your Social Media Name: ")

susername=input("Enter Your "+sname+" Username: ")

spassword=input("Enter Your "+sname+" Password: ")

s2fa=input("If 2FA Authendication is Enabled (Optional): ")

26
snotes=input("You can add Aditional Information if any (optional): ")

print("########################################################################
")

##SQl CONNECTION##

add_social=("""INSERT INTO social_media_management(sno,


name, username, password, 2fa, notes) values ('%s','%s','%s','%s','%s','%s')"""%(sno, sname,
susername, spassword, s2fa, snotes))

mycur.execute(add_social)

connection.commit()

#connection.close()

print("Your Password has been Sucessfully saved in Database as


given,\nThank You Have a Nice Day :)")

input("Press Enter To Continue")

rint("########################################################################")

break

except ValueError:

print("Enter Only Integer, Invalid Option")

input("Press Enter To Continue")

27
OUTPUT

1. When User opens Program

2. Welcome Page

28
3. When User Selects “Register” for Create an Account

4.When User Select “Login”

29
5. Main Menu of the Program

6.When User Selects “Account Settings”

7.When User Selects “Backup and Reset your Account”

30
8.When User Selects “Add your Passwords and Datas” in Main Menu

9.When User Selects “Add your Password of Social Media”

10. When User Selects View/Update/Delete your Password” in Main Menu

31
11. When User Selects “View” and Selects “Social Media Accounts”

12. When User Selects “Save Datas to Text File” in Main Menu

32
CONCLUSION

This project “Password Manager” was done for using it in our school for helping to know more
about programming language. In the process of completing this project I was able to learn many
new concepts in python programming language and I also gained knowledge and experience on
how a program works practically and what type of errors arises and how to clear the errors.

Learning python and doing program first time was not a simple thing for me. But I sincerely
thank MR. NAGARAJ who helped me through the project and clarified the doubt asked.

THANK YOU

33
BIBILIOGRAPHY

BOOKS REFERED:

1. Book: Computer science with python book class XII.


AUTHOR: Sumita Arora
Publisher: DHANPAT RAI & CO.(pvt.) Ltd.

2. Book: Class XI computer science textbook.


Author: Shri Vineet Joshi
Publisher: The Secretary, Central Board of Secondary Education
Shiksha Kendra, 2, Community Centre,
Preet Vihar, Delhi-110092.

3. Book : Python Programming for ClassXI and XII


Author: Ravish Bapna.

4. Book: Practical workbook for CBSE computer science class XII


Author: Pavithra Karthik.
Publisher: LAXMI PUBLICATION (p) LTD.

5. Book: Computer science with python book class XI.


AUTHOR: Sumita Arora
Publisher: DHANPAT RAI & CO.(pvt.) Ltd.

WEBSITES REFERED:

https://stackoverflow.com/

https://www.geeksforgeeks.org/python-programming-language/

34

Das könnte Ihnen auch gefallen