Graphical Passwprd Athuentication System Project Report

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 55

A

Training Report
On
INDUSTRIAL TRAINING
Graphical Password Authentication System
Using python
DIPLOMA
IN
COMPUTER SCIENCE AND ENGINEERING

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

TEEGALA KRISHNA REDDY ENGINEERING COLLEGE


(Affiliated to SBTET,2 Shift polytechnic college Medbowli, Meerpet, Balapur.Hyderabad-500097)
2023-2024

1
TKR COLLEGE OF ENGINEERING AND TECHNOLOGY
(Affiliated to SBTET,2 Shift polytechnic college Medbowli, Meerpet, Balapur.Hyderabad-500097)

This is to certify that the project work entitled "INDUSTRIAL TRAINING"as a partial
fulfillment of the academic requirements for the award of degree of DIPLOMA IN
COMPUTER SCIENCE AND ENGINEERING from STATE BOARD OF TECHNICAL
EDUCATION AND TRAINING, HYDERABAD

Team members

P.MANIKANTA (21248-CS-057)

K.CHAKRADHAR (21248-CS-038)

B.KOUSHIK KAMAL (21248-CS-007)

P.SATHVIK (21248-CS-056)

MD.UMER JAMAL (21248-CS-032)

2
ACKNOWLEDGEMENT

I take immense pleasure to express my deep sense of


gratitude to our beloved Principal Mr. Dr. P. VENKATRAM REDDY and HOD
G. PRASANNA for constant source of encouragement and inspiration
throughout my work.

I express my thanks to all teaching and non-teaching staff


who contributed for the successful completion of my work.

With gratitude,

3
DECLARATION

I hereby declare that the work which is being presented


in this project titled "INDUSTRIAL TRAINING" towards the partial fulfillment
for the award of Diploma In COMPUTER SCIENCE And Engineering, is an
authentic record of my own work carried out under theTrainer of Mr.SREERANJAN
PYTHON FACULTY,NATIONAL SMALL INDUSTRIES CORPORATION, HYDERABAD
for his valuable suggestions.

The matter embodied here, has not been submitted by me for the award of
any other degree or diploma.

4
A PROJECT DOCUMENTATION
ON

GRAPHICAL PASSWORD AUTHENTICATION


SYSTEM

GRAPHICAL PASSWORD AUTHENTICATION


SYSTEM
5
Abstract
Introduction
1.1 Introduction
1.2 Purpose of the Project
1.3 Brief Introduction about PYTHON

System Analysis
2.1 Existing System
2.2 Drawbacks of Existing System
2.3 Proposed System
2.4 Advantages of Proposed System

System Requirements
3.1 Hardware Requirements
3.2 Software Requirements
3.3 Software Descriptions: Frontend & Backend

System Design & Output Screens


4.1 Main menu
4.2 Garbled System Authentication
4.3 Obscure System Authentication
4.4 Password/Image System Authentication
4.5 Segments System Authentication
4.6 Authenticated And Get away Robot Page

System Implementation
5.1 Coding

Testcases
6.1 Testcases

Conclusion
7.1 Conclusion

Bibliography
8.1 Textbooks & Websites

6
ABSTRACT

This research introduces a robust graphical password authentication system aimed at


bolstering digital security. Traditional alphanumeric passwords are susceptible to various
attacks, prompting the need for alternative authentication methods. Our proposed
system leverages the cognitive advantages of humans in recognizing images and patterns,
offering an innovative approach to authentication.

The graphical password system employs a diverse set of images and dynamic interaction
techniques to create a unique and personalized authentication experience. Users select
and manipulate graphical elements to generate a password, thereby enhancing security
through increased complexity and reducing vulnerability to common attacks such as
brute force.

Furthermore, the system incorporates adaptive features to evolve with user behavior,
ensuring a balance between security and usability. Through rigorous usability testing and
security assessments, our findings demonstrate the effectiveness of the proposed
graphical password authentication system as a viable alternative to traditional text-based
approaches.

This research contributes to the ongoing effort to develop more secure and user-friendly
authentication mechanisms, addressing the evolving landscape of cyber threats in
the digital age.

This is used to increase the protection/security of a website. Our system is divided into
further 4 layers of protection. Each layer is totally different and diverse than the others.
This not only increases protection, but also makes sure that no non-human can log in to
your account using different activities such as Brute Force Algorithm and so on.

The motivation for this project came from a recent attack named Pegasus in which people
had their mobile phones compromised for almost a decade without them ever getting
the slightest clue. This motivated us to build a stronger authentication system that
generates randomized methods which could weaken the attack and eventually prevent it.

The 4 layers of Protection that we are using are as follows:

1 Segmented Images Authentication


2 Password Image Authentication
3 Obscured Images Authentication
4 Garbled Images Authentication

7
INTRODUCTION

1.1 Introduction
1.2 Purpose of the Project
1.3 Brief Introduction about PYTHON

8
1.1 Introduction

For this project, we designed a Graphical Password Authentication System. This


is used to increase the protection/security of a website. Our system is divided into
further 4 layers of protection. Each layer is totally different and diverse than the
others. This not only increases protection, but also makes sure that no non-human
can log in to your account using different activities such as Brute Force Algorithm and
so on. The motivation for this project came from a recent attack named Pegasus in
which people had their mobile phones compromised for almost a decade without
them ever getting the slightest clue.

1.2 Purpose of the Project

The Purpose of the Project is, the recent times Authentication System is easy to
hack by the Hackers and Bots so, This Project is used to increase the Security and
Simplicity to the Authentication System with this Your Account and your Data will be
safe.

1.3 Brief Introduction About Python

Python is a widely used general-purpose, high-level programming language. It


was initially designed by Guido van Rossum in 1991 and developed by Python
Software Foundation. It was mainly developed for emphasis on code readability, and
its syntax allows programmers to express concepts in fewer lines of code.

➢ Python laid its foundation in the late 1980s.


➢ The implementation of Python was started in the December 1989 by Guido
Van Rossum at at CWI in Netherland.
➢ In 1994, Python 1.0 was released with new features like: lambda, map, filter,
and reduce
➢ Python 2.0 added new features like: list comprehensions, garbage collection
system.
➢ On December 3, 2008, Python 3.0 (also called "Py3K") was released. It was
designed to rectify fundamental flaw of the language.
➢ ABC programming language is said to be the predecessor of Python language
which was capable of Exception Handling and interfacing with Amoeba
Operating System.
➢ Python is influenced by following programming languages:
• ABC language.
• Modula-3
9
SYSTEM ANALYSIS

2.1 Existing System


2.2 Drawbacks of Existing System
2.3 Proposed System
2.4 Advantages of Proposed System

10
2.1 Existing System

Authentication systems may also incorporate risk-based authentication, where the


level of security adapts based on perceived risks. Behavioural biometrics, such as
keystroke dynamics or mouse usage patterns, add an extra layer of verification. Secure
protocols like HTTPS ensure encrypted communication during the authentication process.

Many systems employ identity and access management (IAM) solutions to centralize and
control user access across applications. Regular security audits and updates are essential
to address vulnerabilities and ensure the ongoing effectiveness of
authentication mechanisms.

In addition to traditional methods, modern authentication systems often leverage


technologies like OAuth, OpenID Connect, and single sign-on (SSO) for seamless user
experiences across multiple platforms. Multi-factor authentication (MFA) is increasingly
common, combining something you know (password) with something you have (token)
or something you are (biometric).

Continuous monitoring and adaptive authentication enhance security by analysing user


behaviour for anomalies. The shift towards password less authentication using methods
like biometrics or authentication apps is gaining traction for improved security and
user convenience.

The existing authentication systems typically involve the use of passwords, biometrics, or
two-factor authentication for user verification. Security measures may also include
CAPTCHA, account recovery options, and session management to protect against
unauthorized access.

2.2 Drawbacks of Existing System

 Susceptible to theft if weak or reused.


 Immutability - biometrics cannot be easily changed if compromised.
 Inconvenience for users, especially if not seamlessly integrated.
 Risks associated with reliance on mobile devices.
 Users can unknowingly divulge credentials, undermining security.
 Challenges in accurately identifying genuine users.
 Significant investment in adopting and maintaining new technologies.
 Ensuring robust security without compromising user experience.
2.3 Proposed System
11
The Proposed system offer an alternative to text-based methods, aiming to
address some of the shortcomings of traditional authentication approaches.

It relies on the user's ability to remember and reproduce a specific sequence or


arrangement of graphical elements to gain access.

Here are key aspects:


 Image-Based Passwords
 Pattern Recognition
 Enhanced Memorability
 Categorization and Personalization
 Resistance to Traditional Attacks
 Authentication Challenges
 Usability and User Acceptance
 Variations

2.4 Advantages of Proposed System

 Graphical passwords can be more memorable for users compared to traditional


text-based passwords.
 Users often find graphical authentication more intuitive and engaging, potentially
improving the overall user experience.
 Graphical passwords can be resistant to traditional password attacks like brute
force or dictionary attacks, as the patterns may be more complex.
 Graphical passwords may be less susceptible to shoulder surfing, where an
unauthorized person observes the user entering their password.
 Users can often personalize their authentication by selecting images or patterns
that have personal significance, making the process more user-centric.
 When properly implemented, graphical password systems have the potential to
provide a higher level of security compared to traditional passwords.
 Various graphical password methods exist, providing flexibility for system
designers to choose an approach that aligns with user needs and security
requirements.
 Graphical passwords are well-suited for touchscreen devices, allowing users to
interact directly with the screen.

12
SYSTEM REQUIREMENTS

3.1 Hardware Requirements


3.2 Software Requirements
3.3 Software Descriptions: Frontend & Backend

3.1 Hardware Requirements:

13
• Processor : Intel Pentium3
• RAM : 1024MB
• Hard disk : 40GB
• Monitor : 15VGA colour

3.2. Software Requirements:

• Front end : HTML, CSS,BOOTSTRAP


• Back end : SQLITE3(Data base), PYTHON
• Operating System : Windows 11
• Browser : Google Chrome

3.3 Software descriptions: Frontend & Backend

1.HTML:
HTML (Hypertext Markup language) is the set of markup symbols or codes inserted in a
file intended for display on a World Wide Web browser page. The markup tells the web
browser how to display a web pages words and images for the user.HTML defines the
structure and layout of a web document by using a variety of tags and attributes. Each
individual markup code is referred to as an element (but many people also refer to it as a
tag). Some elements come in pairs that indicate when some display effect is to begin and
when it is to end. HTML is a formal recommendation by the World Wide Web
Consortium (W3C) and is generally adhered to by the major browsers. It’s the standard
format for formatting and displaying document on the World Wide Web. The current
version of HTML is HTML 5.0.

In order to meet the growing demand for more impressive web features, HTML has been
coupled with plugins like CSS, Flash, JavaScript etc.

14
2.CSS:
CSS stands for Cascading Style Sheets. CSS describe how HTML elements are to be
displayed on screen, paper, or in other media.CSS saves a lot of work. It can control the
layout of multiple web pages all at once. CSS will be internal or external, external
Stylesheets are stored in CSS files.
CSS is used to define styles for your web pages, including the design, layout and
variations in display for different devices and screen sizes.CSS removed the style
formatting from the HTML page. CSS is independent of HTML and can be used with any
XML based markup language. The separation of HTML from CSS makes it easier to
maintain sites, share style sheets across pages, and tailor pages to different
environment.

3.Javascript:

JavaScript is a cross-platform, object-oriented scripting language. It is a small and


lightweight language. Inside a host environment (for example, a web browser),
JavaScript can be connected to the objects of its environment to provide programmatic
control over them. JavaScript contains a standard library of objects, such as Array, Date,
and Math, and a core set of language elements such operators, control structures, and
statements. Core JavaScript can be extended for a variety of purposes by supplementing
it with additional objects.

4.Bootstrap:

1.Bootstrap is the most popular HTML, CSS and JavaScript framework for developing
responsive, mobile-first web sites.
2.Bootstrap is completely free to download and use.
3.Bootstrap gives you the ability to faster and easier web development

5.PHP:

PHP is an acronym for “PHP: Hypertext Preprocessor”. PHP is a server scripting language,
and a powerful tool for making dynamic and interactive web pages. PHP is a widely used,
free, and efficient alternative to competitors such as Microsoft’s ASP. PHP is widely used
and open-source scripting language. PHP scripts are executed on the server. It is
powerful enough to be at the core of the biggest blogging system on the web. It is deep
enough to run the largest social network such as Facebook. It is also easy enough to be a
beginner’s first server side language.

15
PHP files can contain text, HTML, CSS, JavaScript, and PHP code. PHP code are executed
on the server, and the result is returned to the browser as plain HTML. PHP files have
extension”.php”.
PHP can generate dynamic page content. PHP can create, open, read, write, delete, and
close files on the server, can collect form data, can send and receive cookies. PHP can
add, delete, modify data in your database. PHP can be used to control user access, can
encrypt data. With PHP you are not limited to output HTML. You can output images, PDF
files, and even Flash movies. You can also output any text, such as XHTML and XML. PHP
runs on various platforms (Windows, Linux, Mac OS X, etc.). PHP is compatible with
almost all servers used today (Apache, IIS, etc.). PHP supports a wide range of databases.
PHP is easy to learn and runs efficiently on the server side.
Its popularity derives from its C-like syntax, and simplicity. PHP is currently divided into
two major versions: PHP 4 and PHP 5, although PHP 4 is deprecated and no longer
developed or supplied with critical bug fixes. PHP 6 is currently under development. PHP
was designed by Ramus Lerdorf to display his resume online and to collect data from his
visitors.

6.MYSQL:

MySQL is an open-source relational database management system (RDBMS) based on


Structured Query Language (SQL). MySQL runs on virtually all platforms, including Linux,
UNIX, and Windows. Although it can used in a wide range of application, MySQL is most
often associated with web-based applications and online publishing and is an important
component of an open-source enterprise stack called LAMP. LAMP is a web development
platform that uses Linux as the operating system, Apache as the Web server, MySQL as
the relational database management system and PHP as the object-oriented scripting
language.
MySQL, which was originally conceived by the Swedish company
MySQL AB, was acquired by Oracle in 2008.

MySQL is a popular choice of database for use in web


applications and is a central component of the widely used XAMPP open source web
application software stack (and other ‘AFM’ stacks). XAMPP is an acronym for “All
Windows, MySQL, Perl/PHP Python”. Free-software- open source projects that require a
full featured database management system often use MySQL. MySQL can be built and
installed manually from source code, but can be tedious so it is more commonly installed
from a binary package unless special customization are required.

16
SYSTEM DESIGN

4.1 Main menu


4.2 Garbled System Authentication
4.3 Obscure System Authentication
4.4 Password/Image System Authentication
4.5 Segments System Authentication
4.6 Authenticated And Get away Robot Page

4.1 Main Menu :

17
18
4.2 Garbled System Authentication :

19
4.3 Obscure System Authentication :

20
4.4 Password/Image System Authentication :

21
4.5 Segmented System Authentication :

22
4.6 Authenticated and GO away Robot Page :

23
SYSTEM IMPLEMENTATION

5.1 Coding

24
5.1 CODING

 main_menu.py

# Import the required libraries


from tkinter import *
from tkinter import font
import custom_button
import garbled
import obscure
import password
import segments

def load_garbled(window, menu_frame):


menu_frame.pack_forget()
garbled.start(window)

def load_obscured(window, menu_frame):


menu_frame.pack_forget()
obscure.start(window)

def load_segmented(window, menu_frame):


menu_frame.pack_forget()
segments.start(window)

def load_password(window, menu_frame):


menu_frame.pack_forget()
password.start(window)

def start(win):
win.geometry("1280x600")
win.title("Graphical Authentication Password System")

menu_frame = Frame(win, height=600, width=1280)


menu_frame.pack(fill='both', expand=1)

label = Label(menu_frame, text="Graphical Authentication Password System",


font=('Trebuchet MS', 47))
label.pack(padx=40, pady=30)

btn_height = 150
btn_width = 450
btn_font = ('Trebuchet MS', 14)

25
btn1 = custom_button.TkinterCustomButton(master=menu_frame,
text="Test Garbled Images", text_font=btn_font,
height=btn_height,width=btn_width, corner_radius=10,
command=lambda: load_garbled(win, menu_frame))
.place(relx=0.3, rely=0.4, anchor=CENTER)

btn2 = custom_button.TkinterCustomButton(master=menu_frame,
text="Test Segmented Images", text_font=btn_font,
height=btn_height, width=btn_width, corner_radius=10,
command=lambda: load_segmented(win, menu_frame))
.place(relx=0.3, rely=0.7, anchor=CENTER)

btn3 = custom_button.TkinterCustomButton(master=menu_frame,
text="Test Obscured Images", text_font=btn_font,
height=btn_height, width=btn_width, corner_radius=10,
command=lamload_obscured(win,menu_frame))
.place(relx=0.7,rely=0.4,anchor=CENTER)

btn4 = custom_button.TkinterCustomButton(master=menu_frame,
text="Test Password/Image Authentication",text_font=btn_font,
height=btn_height, width=btn_width, corner_radius=10,
command=lambda: load_password(win, menu_frame))
.place(relx=0.7,rely=0.7,anchor=CENTER)

win.mainloop()

if __name__ == "__main__":
win = Tk()
start(win)

 custom_button.py

import tkinter
import sys

class TkinterCustomButton(tkinter.Frame):

def __init__(self,
bg_color=None,
fg_color="#2874A6",
hover_color="#5499C7",
border_color=None,
border_width=0,
command=None,
width=120,
height=40,
corner_radius=10,
text_font=None,
text_color="white",

26
text="CustomButton",
hover=True,
image=None,
*args, **kwargs):
super().__init__(*args, **kwargs)

if bg_color is None:
self.bg_color = self.master.cget("bg")
else:
self.bg_color = bg_color

self.fg_color = fg_color
self.hover_color = hover_color
self.border_color = border_color

self.width = width
self.height = height

if corner_radius*2 > self.height:


self.corner_radius = self.height/2
elif corner_radius*2 > self.width:
self.corner_radius = self.width/2
else:
self.corner_radius = corner_radius

self.border_width = border_width

if self.corner_radius >= self.border_width:


self.inner_corner_radius = self.corner_radius - self.border_width
else:
self.inner_corner_radius = 0

self.text = text
self.text_color = text_color
if text_font is None:
if sys.platform == "darwin": # macOS
self.text_font = ("Avenir", 13)
elif "win" in sys.platform: # Windows
self.text_font = ("Century Gothic", 11)
else:
self.text_font = ("TkDefaultFont")
else:
self.text_font = text_font

self.image = image

self.function = command
self.hover = hover

self.configure(width=self.width, height=self.height)

if sys.platform == "darwin" and self.function is not None:


self.configure(cursor="pointinghand")

self.canvas = tkinter.Canvas(master=self,
highlightthicknes=0,
background=self.bg_color,
width=self.width,

27
height=self.height)
self.canvas.place(x=0, y=0)

if self.hover is True:
self.canvas.bind("<Enter>", self.on_enter)
self.canvas.bind("<Leave>", self.on_leave)

self.canvas.bind("<Button-1>", self.clicked)
self.canvas.bind("<Button-1>", self.clicked)

self.canvas_fg_parts = []
self.canvas_border_parts = []
self.text_part = None
self.text_label = None
self.image_label = None

self.draw()

def draw(self):
self.canvas.delete("all")
self.canvas_fg_parts = []
self.canvas_border_parts = []
self.canvas.configure(bg=self.bg_color)

# border button parts


if self.border_width > 0:

if self.corner_radius > 0:
self.canvas_border_parts.append(self.canvas.create_oval(0,
0,

self.corner_radius * 2,

self.corner_radius * 2))
self.canvas_border_parts.append(self.canvas.create_oval(self.width -
self.corner_radius * 2,
0,
self.width,

self.corner_radius * 2))
self.canvas_border_parts.append(self.canvas.create_oval(0,
self.height
- self.corner_radius * 2,

self.corner_radius * 2,

self.height))
self.canvas_border_parts.append(self.canvas.create_oval(self.width -
self.corner_radius * 2,
self.height
- self.corner_radius * 2,
self.width,

self.height))

self.canvas_border_parts.append(self.canvas.create_rectangle(0,

self.corner_radius,

28
self.width,
self.height
- self.corner_radius))

self.canvas_border_parts.append(self.canvas.create_rectangle(self.corner_radius,
0,
self.width
- self.corner_radius,

self.height))

# inner button parts

if self.corner_radius > 0:
self.canvas_fg_parts.append(self.canvas.create_oval(self.border_width,
self.border_width,
self.border_width +
self.inner_corner_radius * 2,
self.border_width +
self.inner_corner_radius * 2))
self.canvas_fg_parts.append(self.canvas.create_oval(self.width -
self.border_width - self.inner_corner_radius * 2,
self.border_width,
self.width -
self.border_width,
self.border_width +
self.inner_corner_radius * 2))
self.canvas_fg_parts.append(self.canvas.create_oval(self.border_width,
self.height -
self.border_width - self.inner_corner_radius * 2,
self.border_width +
self.inner_corner_radius * 2,
self.height-
self.border_width))
self.canvas_fg_parts.append(self.canvas.create_oval(self.width -
self.border_width - self.inner_corner_radius * 2,
self.height -
self.border_width - self.inner_corner_radius * 2,
self.width -
self.border_width,
self.height -
self.border_width))

self.canvas_fg_parts.append(self.canvas.create_rectangle(self.border_width +
self.inner_corner_radius,
self.border_width,
self.width -
self.border_width - self.inner_corner_radius,
self.height -
self.border_width))
self.canvas_fg_parts.append(self.canvas.create_rectangle(self.border_width,
self.border_width +
self.inner_corner_radius,
self.width -
self.border_width,
self.height -
self.inner_corner_radius - self.border_width))

29
for part in self.canvas_fg_parts:
self.canvas.itemconfig(part, fill=self.fg_color, width=0)

for part in self.canvas_border_parts:


self.canvas.itemconfig(part, fill=self.border_color, width=0)

# no image given
if self.image is None:
# create tkinter.Label with text
self.text_label = tkinter.Label(master=self,
text=self.text,
font=self.text_font,
bg=self.fg_color,
fg=self.text_color)
self.text_label.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)

# bind events the the button click and hover events also to the
text_label
if self.hover is True:
self.text_label.bind("<Enter>", self.on_enter)
self.text_label.bind("<Leave>", self.on_leave)

self.text_label.bind("<Button-1>", self.clicked)
self.text_label.bind("<Button-1>", self.clicked)

self.set_text(self.text)

# use the given image


else:
# create tkinter.Label with image on it
self.image_label = tkinter.Label(master=self,
image=self.image,
bg=self.fg_color)

self.image_label.place(relx=0.5,
rely=0.5,
anchor=tkinter.CENTER)

# bind events the the button click and hover events also to the
image_label
if self.hover is True:
self.image_label.bind("<Enter>", self.on_enter)
self.image_label.bind("<Leave>", self.on_leave)

self.image_label.bind("<Button-1>", self.clicked)
self.image_label.bind("<Button-1>", self.clicked)

def configure_color(self, bg_color=None, fg_color=None, hover_color=None,


text_color=None):
if bg_color is not None:
self.bg_color = bg_color
else:
self.bg_color = self.master.cget("bg")

if fg_color is not None:


self.fg_color = fg_color

# change background color of image_label

30
if self.image is not None:
self.image_label.configure(bg=self.fg_color)

if hover_color is not None:


self.hover_color = hover_color

if text_color is not None:


self.text_color = text_color
if self.text_part is not None:
self.canvas.itemconfig(self.text_part, fill=self.text_color)

self.draw()

def set_text(self, text):


if self.text_label is not None:
self.text_label.configure(text=text)

def on_enter(self, event=0):


for part in self.canvas_fg_parts:
self.canvas.itemconfig(part, fill=self.hover_color, width=0)

if self.text_label is not None:


# change background color of image_label
self.text_label.configure(bg=self.hover_color)

if self.image_label is not None:


# change background color of image_label
self.image_label.configure(bg=self.hover_color)

def on_leave(self, event=0):


for part in self.canvas_fg_parts:
self.canvas.itemconfig(part, fill=self.fg_color, width=0)

if self.text_label is not None:


# change background color of image_label
self.text_label.configure(bg=self.fg_color)

if self.image_label is not None:


# change background color of image_label
self.image_label.configure(bg=self.fg_color)

def clicked(self, event=0):


if self.function is None:
return
self.function()
self.on_leave()

 Garbled.py
import tkinter
from tkinter import *
import custom_button
import main_menu

import utils
from PIL import ImageTk, Image

31
from tkinter import Entry
import random

def load_menu(window, frame):


frame.pack_forget()
main_menu.start(window)

def start(window):
filepath = "garbledImages/original_garbled.txt" # File Path
garbledImages = utils.getgarbledImages()
num = random.randint(0, len(garbledImages) - 1)
filename = garbledImages[num]

f = open(filepath, "r")

while True:
string = f.readline() # Reading file line by line
s1 = string.split(' ')[0]
if s1 == filename[0:len(filename) - 4]:
break
# print("Original = ", string)
string = string[9:] # Cropping string
string = string.replace(' ', '-') # Replacing spaces with dashes
original_text = string
original_text = original_text.rstrip() # Removing \n
f.close()

print(original_text)
print(filename)

window.title("Graphical Authentication System")


window.geometry("1280x600")

garbled_frame = Frame(window, height=600, width=1280)


garbled_frame.pack(fill='both', expand=1)

label = Label(garbled_frame, text="Type the words in the image",


font=('Calibri', 20))
label.pack(padx=40, pady=10)

canvas = Canvas(garbled_frame, width=450, height=300)


img = (Image.open("garbledImages/" + filename))
img = img.resize((450, 300))
img = ImageTk.PhotoImage(img)
canvas.create_image(10, 10, anchor=NW, image=img)
canvas.place(relx=0.45, rely=0.5, anchor=E)

def check():
entered_text = input.get()
if entered_text == original_text:
print("Authenticated")
utils.create_popup(msg="Authenticated :)", font="C")
else:
print("Authentication Failed")
utils.create_popup(msg="Go Away Robot >_<", font="C")

32
input = StringVar()
Label(garbled_frame, text="Enter word", font="ariel 16 bold").place(relx=0.7,
rely=0.40, anchor=CENTER)
Entry(garbled_frame, textvariable=input, font="ariel 12 bold",
relief="groove", width=30, justify=CENTER).place(
relx=0.7,
rely=0.5,
anchor=CENTER)

custom_button.TkinterCustomButton(master=garbled_frame, text="Check",
height=40, corner_radius=10,
command=check).place(relx=0.7, rely=0.6,
anchor=CENTER)

custom_button.TkinterCustomButton(master=garbled_frame, text="Go Back",


height=40, corner_radius=10,
command=lambda: load_menu(window,
garbled_frame)).place(relx=0.08, rely=0.08, anchor=CENTER)

while True:
window.update_idletasks()
window.update

 Obscure.py

import tkinter
from tkinter import *
import custom_button
import main_menu
import speech_recognition as sr

import utils
from PIL import ImageTk, Image
import random

def load_menu(window, frame):


frame.pack_forget()
main_menu.start(window)

original_text = []

def toggle(event):
input_text = None

while True:
e = sr.Recognizer() # Recognizes all input devices
with sr.Microphone() as source: # setting microphone as default input
device
try:
print("Say Something. Say 'stop' inorder to stop")
audio = e.listen(source) # Listens audio
input_text = e.recognize_google(audio)
if input_text == "stop": # Break conditiono
break

33
except:
print("Exception occured when trying to record")
break
input_text = input_text[:-5] # Removing stop from the end of line
input_text = input_text.rstrip() # Removing \n
input_text = input_text.lower() # Converting everything to lowercase
input_text = input_text.replace(' ', '-') # Replacing spaces with dashes

print("Original Text = ", original_text[0])


print("Input Text = ", input_text)

if original_text[0] == input_text:
print("Authenticated")
utils.create_popup(msg="Authenticated :)", font="Gabriola 28 bold")
else:
print("Authentication Failed")
utils.create_popup(msg="Go Away Robot >_<", font="Gabriola 28 bold")

def start(window):
obscuredImages = utils.getObscuredImages()
num = random.randint(1, len(obscuredImages) - 1)
filename = obscuredImages[num] # Filename that will be displayed
filepath = "obscuredImages/original_obscure.txt" # File Path

f = open(filepath, "r")

while True:
string = f.readline() # Reading file line by line
s1 = string.split(' ')[0] # Getting first word (filename) of line
if s1 == filename[0:len(filename) - 4]: # Don't need the file extension,
only name
break)
string = string[9:] # Cropping string
string = string.replace(' ', '-') # Replacing spaces with dashes
string = string
original_text.append(string.rstrip()) # Removing \n
f.close()

obscure_frame = Frame(window, height=600, width=1280)


obscure_frame.pack(fill='both', expand=1)

window.title("Graphical Authentication System")


window.geometry("1280x600")

label = Label(obscure_frame, text="Click on the microphone and speak the words


in the following image",
font=('Calibri', 20))
label.pack(padx=40, pady=10)

canvas = Canvas(obscure_frame, width=450, height=300)


img = (Image.open("obscuredImages/" + filename))
img = img.resize((450, 300),)
img = ImageTk.PhotoImage(img)
canvas.create_image(10, 10, anchor=NW, image=img)
canvas.pack(padx=10, pady=10)

canvas2 = Canvas(obscure_frame, width=200, height=170)

34
canvas2.bind("<Button-1>", toggle)
img2 = (Image.open("assets/mic.jpg"))
img2 = img2.resize((200, 170),)
img2 = ImageTk.PhotoImage(img2)
canvas2.create_image(10, 10, anchor=NW, image=img2)
canvas2.pack(padx=20, pady=20)

custom_button.TkinterCustomButton(master=obscure_frame, text="Go Back",


height=40, corner_radius=10,
command=lambda: load_menu(window,
obscure_frame)).place(relx=0.08, rely=0.08,

anchor=CENTER)

while True:
window.update_idletasks()
window.update()

 Password.py

from tkinter import messagebox


import copy
import hashlib
from random import randint

import tkinter
from tkinter import *
import custom_button
import main_menu

import utils
from PIL import ImageTk, Image
from tkinter import Entry

s_image = []
s_image.append("")

def load_menu(window, frame):


frame.pack_forget()
main_menu.start(window)

# saves image selected by user


def clicked(canvas, img_name, event):
canvas.config(highlightthickness=1, highlightbackground="black")
s_image[0] = img_name;
# print(s_image[0])

# authenticate credentials provided by users


def authenticate(selected_image, Mani, Manikanta):
# checks if there is no empty entry
if Manikanta == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif Mani == "":
messagebox.showinfo("Login System", "Please enter the Password")
35
elif Manikanta == "" and Mani == "":
messagebox.showinfo("Login System", "Please enter the Username and
Password")
# print("hiii",selected_image)

# taking hash of password entered as its hash stored in backend


h = hashlib.new('sha512_256')
h.update(Mani.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""
str = ""
isUser = 0
# file reading to get original credentials
while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()

# checks the credentials by somparing with original one


if name == Manikanta:
isUser = 1
if password == Mani:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

def authenticate(selected_image, Chakri, Chakradhar):


# checks if there is no empty entry
if Chakradhar == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif Chakri == "":
messagebox.showinfo("Login System", "Please enter the Password")
elif Chakradhar == "" and Chakri == "":

36
messagebox.showinfo("Login System", "Please enter the Username and
Password")
# print("hiii",selected_image)

# taking hash of password entered as its hash stored in backend


h = hashlib.new('sha512_256')
h.update(Chakri.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""
str = ""
isUser = 0
# file reading to get original credentials
while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()

if name == Chakradhar:
isUser = 1
if password == Chakri:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

def authenticate(selected_image, Yeetman, Koushik):


if Koushik == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif Yeetman == "":
messagebox.showinfo("Login System", "Please enter the Password")
elif Koushik == "" and Yeetman == "":
messagebox.showinfo("Login System", "Please enter the Username and
Password")
h = hashlib.new('sha512_256')

37
h.update(Yeetman.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""
str = ""
isUser = 0
while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()
if name == Koushik:
isUser = 1
if password == Yeetman:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

def authenticate(selected_image, Mani, Manikanta):


# checks if there is no empty entry
if Manikanta == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif Mani == "":
messagebox.showinfo("Login System", "Please enter the Password")
elif Manikanta == "" and Mani == "":
messagebox.showinfo("Login System", "Please enter the Username and
Password")
h = hashlib.new('sha512_256')
h.update(Mani.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""

38
str = ""
isUser = 0
while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()

if name == Manikanta:
isUser = 1
if password == Mani:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

def authenticate(selected_image, sathvik, Sathvik):


if Sathvik == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif sathvik == "":
messagebox.showinfo("Login System", "Please enter the Password")
elif Sathvik == "" and sathvik == "":
messagebox.showinfo("Login System", "Please enter the Username and
Password")
h = hashlib.new('sha512_256')
h.update(sathvik.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""
str = ""
isUser = 0 while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct

39
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()

if name == Sathvik:
isUser = 1
if password == sathvik:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break
def create_canvas(window):
window.title("Login Page")
window.geometry("1280x600")

root = Frame(window, height=600, width=1280)


root.pack(fill='both', expand=1)
width = 700
height = 700
img_name1 = "cat"
img_name2 = "flower"
img_name3 = "mouse"

num = randint(0, 2)
print("Random number = ", num)
selected_image = ""

imgList = utils.getCredentialImages()

canvas = Canvas(root, width=width, height=height, bd=0, highlightthickness=0)


canvas.pack(fill=BOTH, expand=True)
canvas.create_image(0, 0, anchor='nw')
label = Label(root, text="Login Page", font=("Ariel 15 bold"))
canvas.create_window(550, 40, anchor="nw", window=label)

user_label = Label(root, text="User name:", font=("Ariel 12 bold"))


canvas.create_window(480, 130, anchor="nw", window=user_label)

password_label = Label(root, text="Password:", font=("Ariel 12 bold"))


canvas.create_window(480, 210, anchor="nw", window=password_label)

user_entry = Entry(root, font=("Ariel 12"))


user_entry.focus()

40
selected_name = user_entry.get()
canvas.create_window(580, 130, anchor="nw", window=user_entry)

pas = StringVar()
password_entry = Entry(root, textvar=pas, font=("Ariel 12"), show="*")
selected_password = password_entry.get()
canvas.create_window(580, 210, anchor="nw", window=password_entry)

canvas2 = Canvas(root, width=110, height=70)


canvas2.bind("<Button-1>",
lambda event: clicked(canvas2, img_name1, event)) # binding button
to check if image is clicked
canvas2.place(x=450, y=290)
img2 = (Image.open("credentialImages/" + imgList[num]))
img2 = img2.resize((90, 60),)
img2 = ImageTk.PhotoImage(img2)
canvas2.create_image(10, 10, anchor="nw", image=img2)

canvas3 = Canvas(root, width=110, height=70)


canvas3.bind("<Button-1>",
lambda event: clicked(canvas3, img_name2, event)) # binding button
to check if image is clicked
canvas3.place(x=600, y=290)
img3 = (Image.open("credentialImages/" + imgList[num + 3]))
img3 = img3.resize((90, 60),)
img3 = ImageTk.PhotoImage(img3)
canvas3.create_image(10, 10, anchor="nw", image=img3)

canvas4 = Canvas(root, width=110, height=70)


canvas4.bind("<Button-1>",
lambda event: clicked(canvas4, img_name3, event)) # binding button
to check if image is clicked
canvas4.place(x=750, y=290)
img4 = (Image.open("credentialImages/" + imgList[num + 6]))
img4 = img4.resize((90, 60),)
img4 = ImageTk.PhotoImage(img4)
canvas4.create_image(10, 10, anchor="nw", image=img4)
login = custom_button.TkinterCustomButton(master=root, text="Log In", height=40,
corner_radius=10,
command=lambda: authenticate(s_image[0], password_entry.get(),
user_entry.get())).place(relx=0.5, rely=0.7, anchor=CENTER)

custom_button.TkinterCustomButton(master=root, text="Go Back", height=40,


corner_radius=10,
command=lambda: load_menu(window,
root)).place(relx=0.08, rely=0.08,

anchor=CENTER)

window.mainloop()

def start(window):
create_canvas(window)

 Segments.py

41
import tkinter
from tkinter import *
import custom_button
import main_menu

import utils
from PIL import ImageTk, Image
import random

def load_menu(window, frame):


frame.pack_forget()
main_menu.start(window)

def start(window):
window.title("Graphical Authentication System")
window.geometry("1280x600")

segments_frame = Frame(window, height=600, width=1280)


segments_frame.pack(fill='both', expand=1)

label = Label(segments_frame, text="Please select the pictures in correct


order", font=('Calibri', 20))
label.pack(padx=400, pady=10)

# Draw order image

canvas = Canvas(segments_frame, width=300, height=250)


canvas.bind("<Button-1>", utils.callback)
img = (Image.open("segmentedImages/order.jpg"))
img = img.resize((300, 250),)
img = ImageTk.PhotoImage(img)
canvas.create_image(10, 10, anchor=NW, image=img)
canvas.pack(padx=10, pady=10)

imglist = utils.getSegmentedImages("circle")
random.shuffle(imglist)
imgClickData = []

for imgPath in imglist:


var = utils.imageClick(imgPath)
imgClickData.append(var)

# Draw shuffled segments

canvas2 = Canvas(segments_frame, width=200, height=150)


canvas2.bind("<Button-1>", imgClickData[0].clicked)
canvas2.place(x=100, y=400)
img2 = (Image.open(imglist[0]))
img2 = img2.resize((200, 150),)
img2 = ImageTk.PhotoImage(img2)
canvas2.create_image(10, 10, anchor=NW, image=img2)

canvas3 = Canvas(segments_frame, width=200, height=150)


canvas3.bind("<Button-1>", imgClickData[1].clicked)
canvas3.place(x=400, y=400)
img3 = (Image.open(imglist[1]))

42
img3 = img3.resize((200, 150),)
img3 = ImageTk.PhotoImage(img3)
canvas3.create_image(10, 10, anchor=NW, image=img3)

canvas4 = Canvas(segments_frame, width=200, height=150)


canvas4.bind("<Button-1>", imgClickData[2].clicked)
canvas4.place(x=700, y=400)
img4 = (Image.open(imglist[2]))
img4 = img4.resize((200, 150),)
img4 = ImageTk.PhotoImage(img4)
canvas4.create_image(10, 10, anchor=NW, image=img4)

canvas5 = Canvas(segments_frame, width=200, height=150)


canvas5.bind("<Button-1>", imgClickData[3].clicked)
canvas5.place(x=1000, y=400)
img5 = (Image.open(imglist[3]))
img5 = img5.resize((200, 150),)
img5 = ImageTk.PhotoImage(img5)
canvas5.create_image(10, 10, anchor=NW, image=img5)

custom_button.TkinterCustomButton(master=segments_frame, text="Go Back",


height=40, corner_radius=10,
command=lambda: load_menu(window,
segments_frame)).place(relx=0.08, rely=0.08,

anchor=CENTER)

while True:
window.update_idletasks()
window.update()

if utils.checkAllClicked(imgClickData):
sortedClickList = sorted(imgClickData)

if (sortedClickList[0].id == 1) and (sortedClickList[1].id == 2) and


(sortedClickList[2].id == 3) and (
sortedClickList[3].id == 4):
utils.create_popup(msg="Authenticated :)", font="Gabriola 28 bold")
else:
utils.create_popup(msg="Go Away Robot >_<", font="Gabriola 28 bold")

utils.setAllUnclicked(imgClickData)

# file reading to get original credentials


while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()

43
image = image.rstrip()

# checks the credentials by somparing with original one


if name == Chakradhar:
isUser = 1
if password == Chakri:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

def authenticate(selected_image, Yeetman, Koushik):


# checks if there is no empty entry
if Koushik == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif Yeetman == "":
messagebox.showinfo("Login System", "Please enter the Password")
elif Koushik == "" and Yeetman == "":
messagebox.showinfo("Login System", "Please enter the Username and
Password")
# print("hiii",selected_image)

# taking hash of password entered as its hash stored in backend


h = hashlib.new('sha512_256')
h.update(Yeetman.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""
str = ""
isUser = 0
# file reading to get original credentials
while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()

44
# checks the credentials by somparing with original one
if name == Koushik:
isUser = 1
if password == Yeetman:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

def authenticate(selected_image, Mani, Manikanta):


# checks if there is no empty entry
if Manikanta == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif Mani == "":
messagebox.showinfo("Login System", "Please enter the Password")
elif Manikanta == "" and Mani == "":
messagebox.showinfo("Login System", "Please enter the Username and
Password")
# print("hiii",selected_image)

# taking hash of password entered as its hash stored in backend


h = hashlib.new('sha512_256')
h.update(Mani.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""
str = ""
isUser = 0
# file reading to get original credentials
while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()

45
# checks the credentials by somparing with original one
if name == Manikanta:
isUser = 1
if password == Mani:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

def authenticate(selected_image, sathvik, Sathvik):


# checks if there is no empty entry
if Sathvik == "":
messagebox.showinfo("Login System", "Please enter the Username")
elif sathvik == "":
messagebox.showinfo("Login System", "Please enter the Password")
elif Sathvik == "" and sathvik == "":
messagebox.showinfo("Login System", "Please enter the Username and
Password")
# print("hiii",selected_image)

# taking hash of password entered as its hash stored in backend


h = hashlib.new('sha512_256')
h.update(sathvik.encode())
selected_password = h.hexdigest()
filepath = "credentialImages/orig_credentials.txt" # File Path
f = open(filepath, "r")
name = ""
password = ""
image = ""
str = ""
isUser = 0
# file reading to get original credentials
while True:
string = f.readline() # Reading file line by line
if string == "":
if (isUser == 0):
print("username not exist")
messagebox.showinfo("Login System", "Please enter the correct
Username")
break
info = string.split(" ")
name = copy.deepcopy(info[0])
password = copy.deepcopy(info[1])
image = copy.deepcopy(info[2])
name = name.rstrip()
password = password.rstrip()
image = image.rstrip()

# checks the credentials by somparing with original one

46
if name == Sathvik:
isUser = 1
if password == sathvik:
if image == selected_image:
print("authenticated!!")
messagebox.showinfo("Login System", "authenticated!!")
break
else:
print("image is not correct")
messagebox.showinfo("Login System", "image is not correct")

break
else:
print("password is not correct")
messagebox.showinfo("Login System", "password is not correct")
break

# login page canvas


def create_canvas(window):
window.title("Login Page")
window.geometry("1280x600")

root = Frame(window, height=600, width=1280)


root.pack(fill='both', expand=1)

#root.title("Login Page")
#root.resizable(0, 0)
width = 700
height = 700
# image class names
img_name1 = "cat"
img_name2 = "flower"
img_name3 = "mouse"

# Generates random number to display images


num = randint(0, 2)
print("Random number = ", num)
selected_image = ""

# getting image paths from utils


imgList = utils.getCredentialImages()

# canvas for title


canvas = Canvas(root, width=width, height=height, bd=0, highlightthickness=0)
canvas.pack(fill=BOTH, expand=True)
canvas.create_image(0, 0, anchor='nw')
label = Label(root, text="Login Page", font=("Ariel 15 bold"))
canvas.create_window(550, 40, anchor="nw", window=label)

# canvas for username title


user_label = Label(root, text="User name:", font=("Ariel 12 bold"))
canvas.create_window(480, 130, anchor="nw", window=user_label)

# canvas for password title


password_label = Label(root, text="Password:", font=("Ariel 12 bold"))
canvas.create_window(480, 210, anchor="nw", window=password_label)

47
# usernmae input feild display
user_entry = Entry(root, font=("Ariel 12"))
user_entry.focus()
selected_name = user_entry.get()
canvas.create_window(580, 130, anchor="nw", window=user_entry)

# password input feild display


pas = StringVar()
password_entry = Entry(root, textvar=pas, font=("Ariel 12"), show="*")
selected_password = password_entry.get()
canvas.create_window(580, 210, anchor="nw", window=password_entry)

# Random image display from first class


canvas2 = Canvas(root, width=110, height=70)
canvas2.bind("<Button-1>",
lambda event: clicked(canvas2, img_name1, event)) # binding button
to check if image is clicked
canvas2.place(x=450, y=290)
img2 = (Image.open("credentialImages/" + imgList[num]))
img2 = img2.resize((90, 60),)
img2 = ImageTk.PhotoImage(img2)
canvas2.create_image(10, 10, anchor="nw", image=img2)

# Random image display from second class


canvas3 = Canvas(root, width=110, height=70)
canvas3.bind("<Button-1>",
lambda event: clicked(canvas3, img_name2, event)) # binding button
to check if image is clicked
canvas3.place(x=600, y=290)
img3 = (Image.open("credentialImages/" + imgList[num + 3]))
img3 = img3.resize((90, 60),)
img3 = ImageTk.PhotoImage(img3)
canvas3.create_image(10, 10, anchor="nw", image=img3)

# Random image display from third class


canvas4 = Canvas(root, width=110, height=70)
canvas4.bind("<Button-1>",
lambda event: clicked(canvas4, img_name3, event)) # binding button
to check if image is clicked
canvas4.place(x=750, y=290)
img4 = (Image.open("credentialImages/" + imgList[num + 6]))
img4 = img4.resize((90, 60),)
img4 = ImageTk.PhotoImage(img4)
canvas4.create_image(10, 10, anchor="nw", image=img4)

# login button display


# calls authenticate on click with credentials as arguments
login = custom_button.TkinterCustomButton(master=root, text="Log In", height=40,
corner_radius=10,
command=lambda: authenticate(s_image[0], password_entry.get(),
user_entry.get())).place(relx=0.5, rely=0.7, anchor=CENTER)

custom_button.TkinterCustomButton(master=root, text="Go Back", height=40,


corner_radius=10,
command=lambda: load_menu(window,
root)).place(relx=0.08, rely=0.08,

anchor=CENTER)

48
window.mainloop()

def start(window):
create_canvas(window)

 Utils.py

import os
import datetime
from tkinter import *
from tkinter.ttk import *
from PIL import ImageTk, Image

def callback(event):
print("clicked at", event.x, event.y)

def getSegmentedImages(shape):
parentDir = "segmentedImages/" + shape
imagePaths = os.listdir(parentDir)
imagePaths = [parentDir + "/" + _path for _path in imagePaths]
return imagePaths

def getObscuredImages():
imagePaths = os.listdir("obscuredImages")
return imagePaths

def getgarbledImages():
imagePaths = os.listdir("garbledImages")
return imagePaths[:-1] # last file is txt file, don't need thats

def getCredentialImages():
imagePaths = os.listdir("credentialImages")
return imagePaths[:-1] # last file is txt file, don't need thats

class customImage:
def __init__(self, path, width=200, height=150):
self.path = path
self.img_width = width
self.img_height = height

def draw(self, window, c_width=200, c_height=150, img_x=0, img_y=400):


# Create a canvas
canvas = Canvas(window, width=c_width, height=c_height)
canvas.place(x=img_x, y=img_y)

# Load an image in the script


img = Image.open(self.path)

# Resize the Image using resize method


img = img.resize((self.img_width, self.img_height), Image.ANTIALIAS)
img = ImageTk.PhotoImage(img)

49
# Add image to the Canvas Items
canvas.create_image(10, 10, anchor=NW, image=img)

return canvas

class imageClick:
def __init__(self, path):
self.id = int(path[-5])
self.path = path
self.isClicked = False
self.timeClicked = None

def clicked(self, event):


self.isClicked = True
self.timeClicked = datetime.datetime.now()

print("img id = ", self.id, " has been clicked")

def __lt__(self, other):


return self.timeClicked < other.timeClicked

def setAllUnclicked(imgClickedData):
for obj in imgClickedData:
obj.isClicked = False

def checkAllClicked(imgClickedData):
for obj in imgClickedData:
if obj.isClicked is False:
return False

return True

def create_popup(size="500x200", msg="default", font='Arial 24', x=140, y=70):


win = Tk()
win.geometry(size)
win.title("Message")
Label(win, text=msg, font=font).place(x=x, y=y)

for i in range(300000):
win.update_idletasks()
win.update()

win.destroy()
return

50
TESTCASES

6.1 Testcases

51
6.1 Testcases

S.No Test case name Test procedure Pre condition Expected Output
result
1. Main Menu Heading, HOME Next Page Success
Garbled System,
Obscure System,
Segmented System,
Password/Image
System,

2. Garbled Type the Garbled Authenticated Success


System words in Page or
the image, Get Away
Image, Robot.
Enter
word
Check
button .
3. Obscured Click the Obscured Authenticated Success
System microphone button Page or
and speak the Get Away
words in the image, Robot.
Image,
Microphone button.
4. Password/Image Username, Password/Image Authenticated, Success
System Password, Page Password
Cat; Flower; incorrect,
Mouse Photos, Enter Correct
Login button. Username,
Image is
incorrect.

5. Segmented Select The Pictures Segmented Authenticated Success


System in correct order, Page or
1;2;3;4 Pictures. Get Away
Robot.

52
Conclusion

In conclusion, the graphical password authentication system project represents a


promising avenue for enhancing security and user experience. By leveraging visual
elements, it offers a unique approach to authentication. The project's successful
implementation underscores its potential as a viable alternative to traditional text-based
methods. However, ongoing user feedback and continuous evaluation are essential to
refine and optimize the system for real-world usability and effectiveness. As technology
evolves, this graphical authentication system stands as a testament to the dynamic
landscape of cybersecurity solutions.

Furthermore, the project highlights the importance of user-centric design in security


measures. The graphical password system addresses potential vulnerabilities associated
with traditional alphanumeric passwords, providing a potentially more robust defence
against various cyber threats.

The user-friendliness of the system could encourage widespread adoption, but it also
necessitates careful consideration of potential misuse or unintended access. Ongoing
research and updates should be integrated to adapt to emerging security challenges and
ensure the system's resilience in the face of evolving cyber threats.

In summary, while the graphical password authentication system demonstrates


promising features, ongoing refinement, user education, and adaptability to emerging
security landscapes are crucial for its long-term success and relevance in
safeguarding digital assets.

Moreover, the project's implementation and evaluation shed light on the balance
between security and usability. Striking the right equilibrium ensures that users find the
authentication process intuitive while maintaining a high level of protection against
unauthorized access. Continuous monitoring of the system's performance, user
satisfaction, and security metrics will contribute to its overall effectiveness.

The project also serves as a foundation for potential future enhancements, such as
incorporating machine learning algorithms to adapt to user behaviour or integrating
multi-factor authentication for an added layer of security. Collaborative efforts with
cybersecurity communities can foster innovation and contribute to the ongoing
evolution of authentication systems.

Bibliography :
53
8.1 Textbooks
Computer science with python By M.Suresh.

Websites
https://www.jetbrains.com/pycharm/download/
https://github.com/
https://chat.openai.com/
https://python.org/

54
55

You might also like