0% found this document useful (0 votes)
8 views11 pages

Password Gen

The document describes a Python-based password generator called PyPassGen that allows users to customize parameters like length, character sets, and complexity to generate secure passwords. It uses cryptographic techniques to randomly select characters and ensure password security. The generator has a graphical user interface for easy use.

Uploaded by

Geeth Sunil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views11 pages

Password Gen

The document describes a Python-based password generator called PyPassGen that allows users to customize parameters like length, character sets, and complexity to generate secure passwords. It uses cryptographic techniques to randomly select characters and ensure password security. The generator has a graphical user interface for easy use.

Uploaded by

Geeth Sunil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Integrated Master of Computer Applications

PASSWORD GENERATOR
Submitted by
Geeth S MY.SC.I5MCA21046
Under the guidance of
Suresha R
Department of Computer Science,
School of Computing,
Amrita Vishwa Vidyapeetham,
Mysuru, Karnataka, India
2023 - 2024
PASSWORD GENERATOR

Abstract
PyPassGen is a Python-based password generator designed to create strong and secure
passwords for various applications. This project aims to provide users with a reliable tool for
generating unique passwords with customizable parameters such as length, character sets,
and complexity levels. The generator employs cryptographic strength random number
generation to ensure the randomness and unpredictability of generated passwords,
enhancing their resistance to brute-force and dictionary attacks. PyPassGen offers a simple
and intuitive command-line interface, making it accessible to both novice and experienced
users. With its emphasis on security and flexibility, PyPassGen serves as an essential utility
for safeguarding sensitive information in today's digital age.

1. Program
from tkinter import *
from tkinter.ttk import Progressbar
import tkinter
import tkinter.messagebox
import pyperclip
import random, string

no_of_options = 0
length_value = 7

def get_slider_value(value):
global length_value
length_value = int(value)
progress_status()

def progress_status():
global no_of_options, length_value
no_of_options = upper_case.get() * 5 + small_case.get() * 5 +
special_Chars.get() * 5 + num.get() * 5 + length_value * 5
length_progress['value'] = no_of_options
def generate_pass():
global no_of_options, length_value
password = ""

switchCode =
str(upper_case.get())+str(small_case.get())+str(special_Chars.get(
))+str(num.get())

switcher = {
'1100': generate1,
'1101': generate2,
'0001': generate3,
'1111': generate4,
'0100': generate5,
'1000': generate6,
'0010': generate7,
'1001': generate8,
'0101': generate9,
'1010': generate10,
'0110': generate11,
'1110': generate12,
'0011': generate13,
'0111': generate14
}

password = switcher.get(switchCode, lambda: "Please select


atleast one checkbox ")()

password_entry.delete(0, END)
password_entry.insert(0, password)

def generate1():
"Upper Smaller"
try:
n = int(length_value)
password = ""
up_sm = string.ascii_uppercase + string.ascii_lowercase
password = password.join(random.sample(up_sm, n))
return password
except:
return "Invalid length_value"
def generate2():
"Upper smaller number"
try:
n = int(length_value)
password = ""
up_sm_num = string.ascii_uppercase + string.ascii_lowercase +
string.digits
password = password.join(random.sample(up_sm_num, n))
return password
except:
return "Invalid length_value"

def generate3():
"Number"
try:
n = int(length_value)
password = ""
num = string.digits
password = password.join(random.sample(num, n))
return password
except:
return "Invalid length_value"

def generate4():
"Upper smaller number special"
try:
n = int(length_value)
password = ""
up_sm_num_spc = string.ascii_uppercase +
string.ascii_lowercase + string.digits + string.punctuation
password = password.join(random.sample(up_sm_num_spc, n))
return password
except:
return "Invalid length_value"

def generate5():
"Smaller"
try:
n = int(length_value)
password = ""
sm = string.ascii_lowercase
password = password.join(random.sample(sm, n))
return password
except:
return "Invalid length_value"

def generate6():
"Upper"
try:
n = int(length_value)
password = ""
up = string.ascii_uppercase
password = password.join(random.sample(up, n))
return password
except:
return "Invalid length_value"

def generate7():
"Special"
try:
n = int(length_value)
password = ""
spc = string.punctuation
password = password.join(random.sample(spc, n))
return password
except:
return "Invalid length_value"

def generate8():
"Upper number"
try:
n = int(length_value)
password = ""
up_num = string.ascii_uppercase + string.digits
password = password.join(random.sample(up_num, n))
return password
except:
return "Invalid length_value"

def generate9():
"Smaller Number"
try:
n = int(length_value)
password = ""
sm_num = string.digits + string.ascii_lowercase
password = password.join(random.sample(sm_num, n))
return password
except:
return "Invalid length_value"

def generate10():
"Upper Special"
try:
n = int(length_value)
password = ""
up_spc = string.ascii_uppercase + string.punctuation
password = password.join(random.sample(up_spc, n))
return password
except:
return "Invalid length_value"

def generate11():
"Smaller Special"
try:
n = int(length_value)
password = ""
sm_spc = string.punctuation + string.ascii_lowercase
password = password.join(random.sample(sm_spc, n))
return password
except:
return "Invalid length_value"

def generate12():
"Smaller Upper Special"
try:
n = int(length_value)
password = ""
sm_up_spc = string.ascii_uppercase + string.ascii_lowercase +
string.punctuation
password = password.join(random.sample(sm_up_spc, n))
return password
except:
return "Invalid length_value"

def generate13():
"Number Spceial"
try:
n = int(length_value)
password = ""
num_spc = string.digits + string.punctuation
password = password.join(random.sample(num_spc, n))
return password
except:
return "Invalid length_value"

def generate14():
"Smaller Number Special"
try:
n = int(length_value)
password = ""
sm_num_spc = string.digits + string.ascii_lowercase +
string.punctuation
password = password.join(random.sample(sm_num_spc, n))
return password
except:
return "Invalid length_value"
def copyclip():
passwordcopy = password_entry["text"]
pyperclip.copy(passwordcopy)

root = Tk()
root.title("Complete Password Generator")
root.geometry("700x300")

title = Label(root, text="Complete Password Generator",


fg="Blue", font=("Arial", 15, 'bold')).place(x=200, y=10)

num = IntVar()
small_case = IntVar()
upper_case = IntVar()
special_Chars = IntVar()
length = IntVar()
password_str = StringVar()

# Checkboxes
C1 = Checkbutton(root, text="A-Z", variable=upper_case, onvalue=1,
offvalue=0, command=progress_status)
C1.place(x=100, y=40)
C2 = Checkbutton(root, text="a-z", variable=small_case, onvalue=1,
offvalue=0, command=progress_status)
C2.place(x=180, y=40)
C3 = Checkbutton(root, text="0-9", variable=num, onvalue=1,
offvalue=0, command=progress_status)
C3.place(x=250, y=40)
C4 = Checkbutton(root, text="Special Characters",
variable=special_Chars, onvalue=1, offvalue=0,
command=progress_status)
C4.place(x=320, y=40)

# Length scale
s1 = Scale(root, variable=length,
from_=7, to=16,
orient=HORIZONTAL, command=get_slider_value
)
s1.place(x=550, y=40)
scale_lable = Label(root, text="Length",
font=("Arial", 11)).place(x=500, y=40)

strength_lable = Label(root, text="Password Strength",


font=("Arial", 12, "bold")).place(x=280, y=80)

# Progressbar to show strength


length_progress = Progressbar(root, orient=HORIZONTAL,
length=400, mode='determinate')
length_progress.place(x=150, y=120)

btn = Button(master=root, text="Generate", fg="green",


font=("Arial", 10, 'bold'),
command=generate_pass).place(x=300, y=150)

password_entry = Entry(root, width=30)


password_entry.place(x=220, y=200)

copy_btn = Button(master=root, text="Copy", fg="green",


font=("Arial", 10, 'bold'), command=copyclip).place(x=320,
y=230)

root.mainloop()
2. Result
3. Conclusion

In conclusion, PyPassGen, our Python password generator, offers a reliable


solution for generating strong and secure passwords. By leveraging
cryptographic random number generation, it ensures the unpredictability of
passwords, crucial for thwarting cyber threats. With its customizable
parameters and intuitive command-line interface, PyPassGen provides users
with flexibility and ease of use. As digital security remains a priority,
PyPassGen stands as a valuable tool for safeguarding sensitive information in
today's interconnected world.

You might also like